Java Code Examples for com.arangodb.model.CollectionCreateOptions#shardKeys()
The following examples show how to use
com.arangodb.model.CollectionCreateOptions#shardKeys() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultArangoPersistentEntity.java From spring-data with Apache License 2.0 | 5 votes |
private static CollectionCreateOptions createCollectionOptions(final Document annotation) { final CollectionCreateOptions options = new CollectionCreateOptions().type(CollectionType.DOCUMENT) .waitForSync(annotation.waitForSync()).doCompact(annotation.doCompact()) .isVolatile(annotation.isVolatile()).isSystem(annotation.isSystem()); if (annotation.journalSize() > -1) { options.journalSize(annotation.journalSize()); } if (annotation.replicationFactor() > -1) { options.replicationFactor(annotation.replicationFactor()); } if (annotation.satellite()) { options.satellite(annotation.satellite()); } final String[] shardKeys = annotation.shardKeys(); if (shardKeys.length > 1 || (shardKeys.length > 0 && StringUtils.hasText(shardKeys[0]))) { options.shardKeys(shardKeys); } if (annotation.numberOfShards() > -1) { options.numberOfShards(annotation.numberOfShards()); } if (annotation.indexBuckets() > -1) { options.indexBuckets(annotation.indexBuckets()); } if (annotation.allowUserKeys()) { options.keyOptions(annotation.allowUserKeys(), annotation.keyType(), annotation.keyIncrement() > -1 ? annotation.keyIncrement() : null, annotation.keyOffset() > -1 ? annotation.keyOffset() : null); } return options; }
Example 2
Source File: DefaultArangoPersistentEntity.java From spring-data with Apache License 2.0 | 5 votes |
private static CollectionCreateOptions createCollectionOptions(final Edge annotation) { final CollectionCreateOptions options = new CollectionCreateOptions().type(CollectionType.EDGES) .waitForSync(annotation.waitForSync()).doCompact(annotation.doCompact()) .isVolatile(annotation.isVolatile()).isSystem(annotation.isSystem()); if (annotation.journalSize() > -1) { options.journalSize(annotation.journalSize()); } if (annotation.replicationFactor() > -1) { options.replicationFactor(annotation.replicationFactor()); } final String[] shardKeys = annotation.shardKeys(); if (shardKeys.length > 0) { options.shardKeys(shardKeys); } if (annotation.numberOfShards() > -1) { options.numberOfShards(annotation.numberOfShards()); } if (annotation.indexBuckets() > -1) { options.indexBuckets(annotation.indexBuckets()); } if (annotation.allowUserKeys()) { options.keyOptions(annotation.allowUserKeys(), annotation.keyType(), annotation.keyIncrement() > -1 ? annotation.keyIncrement() : null, annotation.keyOffset() > -1 ? annotation.keyOffset() : null); } return options; }