@Override public Index createIndex(String bagName, CompositeIndexField compositeIndexFields, boolean unique, IndexField... values) throws JasDBStorageException { KeyInfo keyInfo; if(unique) { keyInfo = new KeyInfoImpl(compositeIndexFields.getIndexFields(), guaranteeIdKey(values)); } else { List<IndexField> indexFields = Lists.newArrayList(compositeIndexFields.getIndexFields()); indexFields.add(new SimpleIndexField(SimpleEntity.DOCUMENT_ID, new UUIDKeyType())); keyInfo = new KeyInfoImpl(indexFields, Lists.newArrayList(values)); } return createInStore(bagName, keyInfo); }
@Override public void ensureIndex(CompositeIndexField queryFields, boolean isUnique, IndexField... valueFields) throws JasDBStorageException { BagConnector connector = RemoteConnectorFactory.createConnector(nodeInformation, BagConnector.class); KeyInfo keyInfo = new KeyInfoImpl(queryFields.getIndexFields(), Lists.newArrayList(valueFields)); connector.createIndex(context, instance, meta.getName(), new IndexDefinition(keyInfo.getKeyName(), keyInfo.keyAsHeader(), keyInfo.valueAsHeader(), -1), isUnique); }