use of voldemort.store.versioned.VersionIncrementingStore in project voldemort by voldemort.
the class InMemoryMultiThreadedTest method main.
public static void main(String[] args) throws Exception {
Store<byte[], byte[], byte[]> store = new VersionIncrementingStore<byte[], byte[], byte[]>(new InMemoryStorageEngine<byte[], byte[], byte[]>("test"), 0, new SystemTime());
store = new InconsistencyResolvingStore<byte[], byte[], byte[]>(store, new VectorClockInconsistencyResolver<byte[]>());
new MultithreadedStressTest(store, 5, 1000000, 10).testGetAndPut();
}
use of voldemort.store.versioned.VersionIncrementingStore in project voldemort by voldemort.
the class MockStoreClientFactory method getRawStore.
private <K1, V1, T1> Store<K1, V1, T1> getRawStore(String storeName) {
List<StoreDefinition> storeDefs = storeMapper.readStoreList(new StringReader(storesXml));
StoreDefinition storeDef = null;
for (StoreDefinition d : storeDefs) if (d.getName().equals(storeName))
storeDef = d;
if (storeDef == null)
throw new BootstrapFailureException("Unknown store '" + storeName + "'.");
DefaultSerializerFactory serializerFactory = new DefaultSerializerFactory();
Serializer<K1> keySerializer = (Serializer<K1>) serializerFactory.getSerializer(storeDef.getKeySerializer());
Serializer<V1> valueSerializer = (Serializer<V1>) serializerFactory.getSerializer(storeDef.getValueSerializer());
Serializer<T1> transformsSerializer = null;
if (storeDef.isView())
transformsSerializer = (Serializer<T1>) serializerFactory.getSerializer(storeDef.getTransformsSerializer());
// Add inconsistency resolving decorator, using their inconsistency
// resolver (if they gave us one)
InconsistencyResolver<Versioned<V1>> secondaryResolver = new TimeBasedInconsistencyResolver();
StorageEngine engine;
if (storeDef.isView())
engine = new InMemoryStorageEngine(storeDef.getViewTargetStoreName());
else
engine = new InMemoryStorageEngine(storeDef.getName());
if (storeDef.isView()) {
// instantiate view
String targetName = storeDef.getViewTargetStoreName();
StoreDefinition targetDef = StoreUtils.getStoreDef(storeDefs, targetName);
engine = new ViewStorageEngine(storeName, engine, this.viewValueSerializer != null ? this.viewValueSerializer : serializerFactory.getSerializer(storeDef.getValueSerializer()), this.transformsSerializer != null ? this.transformsSerializer : serializerFactory.getSerializer(storeDef.getTransformsSerializer()), this.keySerializer != null ? this.keySerializer : serializerFactory.getSerializer(targetDef.getKeySerializer()), this.valueSerializer != null ? this.valueSerializer : serializerFactory.getSerializer(targetDef.getValueSerializer()), null, ViewStorageConfiguration.loadTransformation(storeDef.getValueTransformation()));
}
Store store = new VersionIncrementingStore(engine, nodeId, time);
store = new SerializingStore(store, this.keySerializer != null ? this.keySerializer : keySerializer, this.valueSerializer != null ? this.valueSerializer : valueSerializer, this.transformsSerializer != null ? this.transformsSerializer : transformsSerializer);
Store<K1, V1, T1> consistentStore = new InconsistencyResolvingStore<K1, V1, T1>(store, new ChainedResolver<Versioned<V1>>(new VectorClockInconsistencyResolver(), secondaryResolver));
return consistentStore;
}
use of voldemort.store.versioned.VersionIncrementingStore in project voldemort by voldemort.
the class MockStoreClientFactory method getRawStore.
public <K1, V1, T1> Store<K1, V1, T1> getRawStore(String storeName, InconsistencyResolver<Versioned<V1>> resolver) {
if (this.storesXml != null)
return getRawStore(storeName);
// Add inconsistency resolving decorator, using their inconsistency
// resolver (if they gave us one)
InconsistencyResolver<Versioned<V1>> secondaryResolver = new TimeBasedInconsistencyResolver();
if (resolver != null)
secondaryResolver = resolver;
Store store = new VersionIncrementingStore(new InMemoryStorageEngine(storeName), nodeId, time);
if (isSerialized())
store = new SerializingStore(store, keySerializer, valueSerializer, transformsSerializer);
Store<K1, V1, T1> consistentStore = new InconsistencyResolvingStore<K1, V1, T1>(store, new ChainedResolver<Versioned<V1>>(new VectorClockInconsistencyResolver(), secondaryResolver));
return consistentStore;
}
Aggregations