private static Map<String, IndexProvider> getIndexes(Configuration config) { ImmutableMap.Builder<String, IndexProvider> builder = ImmutableMap.builder(); for (String index : config.getContainedNamespaces(INDEX_NS)) { Preconditions.checkArgument(StringUtils.isNotBlank(index), "Invalid index name [%s]", index); log.info("Configuring index [{}]", index); IndexProvider provider = getImplementationClass(config.restrictTo(index), config.get(INDEX_BACKEND,index), StandardIndexProvider.getAllProviderClasses()); Preconditions.checkNotNull(provider); builder.put(index, provider); } return builder.build(); }
public static KeyColumnValueStoreManager getStorageManager(Configuration storageConfig) { StoreManager manager = getImplementationClass(storageConfig, storageConfig.get(STORAGE_BACKEND), StandardStoreManager.getAllManagerClasses()); if (manager instanceof OrderedKeyValueStoreManager) { manager = new OrderedKeyValueStoreManagerAdapter((OrderedKeyValueStoreManager) manager, ImmutableMap.of(EDGESTORE_NAME, 8, EDGESTORE_NAME + LOCK_STORE_SUFFIX, 8, storageConfig.get(IDS_STORE_NAME), 8)); } Preconditions.checkArgument(manager instanceof KeyColumnValueStoreManager,"Invalid storage manager: %s",manager.getClass()); return (KeyColumnValueStoreManager) manager; }
private static LogManager getLogManager(Configuration config, String logName, KeyColumnValueStoreManager sm) { Configuration logConfig = config.restrictTo(logName); String backend = logConfig.get(LOG_BACKEND); if (backend.equalsIgnoreCase(LOG_BACKEND.getDefaultValue())) { return new KCVSLogManager(sm,logConfig); } else { Preconditions.checkArgument(config!=null); LogManager lm = getImplementationClass(logConfig,logConfig.get(LOG_BACKEND),REGISTERED_LOG_MANAGERS); Preconditions.checkNotNull(lm); return lm; } }
public TestMockIndexProvider(Configuration config) { this.index = Backend.getImplementationClass(config, config.get(INDEX_BACKEND_PROXY), StandardIndexProvider.getAllProviderClasses()); this.failAdds = config.get(INDEX_MOCK_FAILADD); }
public VertexIDAssigner(Configuration config, IDAuthority idAuthority, StoreFeatures idAuthFeatures) { Preconditions.checkNotNull(idAuthority); this.idAuthority = idAuthority; int partitionBits = NumberUtil.getPowerOf2(config.get(CLUSTER_MAX_PARTITIONS)); idManager = new IDManager(partitionBits); Preconditions.checkArgument(idManager.getPartitionBound() <= Integer.MAX_VALUE && idManager.getPartitionBound()>0); this.partitionIdBound = (int)idManager.getPartitionBound(); hasLocalPartitions = idAuthFeatures.hasLocalKeyPartition(); placementStrategy = Backend.getImplementationClass(config, config.get(PLACEMENT_STRATEGY), REGISTERED_PLACEMENT_STRATEGIES); placementStrategy.injectIDManager(idManager); log.debug("Partition IDs? [{}], Local Partitions? [{}]",true,hasLocalPartitions); long baseBlockSize = config.get(IDS_BLOCK_SIZE); idAuthority.setIDBlockSizer(new SimpleVertexIDBlockSizer(baseBlockSize)); renewTimeoutMS = config.get(IDS_RENEW_TIMEOUT); renewBufferPercentage = config.get(IDS_RENEW_BUFFER_PERCENTAGE); idPools = new ConcurrentHashMap<>(partitionIdBound); schemaIdPool = new StandardIDPool(idAuthority, IDManager.SCHEMA_PARTITION, PoolType.SCHEMA.getIDNamespace(), IDManager.getSchemaCountBound(), renewTimeoutMS, renewBufferPercentage); partitionVertexIdPool = new StandardIDPool(idAuthority, IDManager.PARTITIONED_VERTEX_PARTITION, PoolType.PARTITIONED_VERTEX.getIDNamespace(), PoolType.PARTITIONED_VERTEX.getCountBound(idManager), renewTimeoutMS, renewBufferPercentage); setLocalPartitions(partitionBits); }