@Override public List<String> getIndexNames() throws JasDBStorageException { BagConnector connector = RemoteConnectorFactory.createConnector(nodeInformation, BagConnector.class); List<IndexDefinition> indexDefinitions = connector.getIndexDefinitions(context, instance, meta.getName()); List<String> indexNames = new ArrayList<>(indexDefinitions.size()); for(IndexDefinition definition : indexDefinitions) { indexNames.add(definition.getIndexName()); } return indexNames; }
@Override public boolean equals(Object o) { if(o instanceof IndexDefinition) { IndexDefinition other = (IndexDefinition) o; if(other.getHeaderDescriptor().equals(headerDescriptor) && other.getValueDescriptor().equals(valueDescriptor) && other.getIndexName().equals(indexName) && other.getIndexType() == indexType) { return true; } } return false; }
private Index loadIndex(String bagName, IndexDefinition indexDefinition) throws JasDBStorageException { try { KeyInfo keyInfo = new KeyInfoImpl(indexDefinition.getHeaderDescriptor(), indexDefinition.getValueDescriptor()); File indexFile = createIndexFile(bagName, indexDefinition.getIndexName(), false); switch(IndexTypes.getTypeFor(indexDefinition.getIndexType())) { case BTREE: LOG.debug("Loaded BTree Index for key: {}", indexDefinition.getIndexName()); Index btreeIndex = new BTreeIndex(indexFile, keyInfo); return configureIndex(IndexTypes.BTREE, btreeIndex); default: throw new JasDBStorageException("Reading from this index type: " + indexDefinition.getIndexName() + " is not supported"); } } catch(ConfigurationException e) { throw new JasDBStorageException("Unable to load index, invalid configuration", e); } }
public static IndexEntry map(IndexDefinition definition, boolean isUnique) { return new IndexEntry(definition.getIndexName(), definition.getHeaderDescriptor(), definition.getValueDescriptor(), isUnique, definition.getIndexType()); }