use of io.pravega.segmentstore.storage.AsyncStorageWrapper in project pravega by pravega.
the class ExtendedS3StorageFactory method createStorageAdapter.
@Override
public Storage createStorageAdapter() {
S3Config s3Config = new S3Config(config.getUrl()).withIdentity(config.getAccessKey()).withSecretKey(config.getSecretKey()).withNamespace(config.getNamespace());
S3JerseyClient client = new S3JerseyClient(s3Config);
ExtendedS3Storage s = new ExtendedS3Storage(client, this.config);
return new AsyncStorageWrapper(new RollingStorage(s), this.executor);
}
use of io.pravega.segmentstore.storage.AsyncStorageWrapper in project pravega by pravega.
the class InMemoryStorageTests method testFencing.
@Test
@Override
public void testFencing() throws Exception {
final String segment1 = "segment1";
final String segment2 = "segment2";
@Cleanup val baseStorage = new InMemoryStorage();
@Cleanup val storage = new AsyncStorageWrapper(baseStorage, executorService());
storage.initialize(DEFAULT_EPOCH);
// Part 1: Create a segment and verify all operations are allowed.
storage.create(segment1, TIMEOUT).get(TIMEOUT.toMillis(), TimeUnit.MILLISECONDS);
SegmentHandle handle1 = storage.openWrite(segment1).join();
verifyAllOperationsSucceed(handle1, storage);
// Part 2: Change owner, verify segment operations are not allowed until a call to open() is made.
baseStorage.changeOwner();
verifyWriteOperationsFail(handle1, storage);
handle1 = storage.openWrite(segment1).join();
verifyAllOperationsSucceed(handle1, storage);
// Part 3: Create new segment and verify all operations are allowed.
storage.create(segment2, TIMEOUT).get(TIMEOUT.toMillis(), TimeUnit.MILLISECONDS);
SegmentHandle handle2 = storage.openWrite(segment2).join();
verifyAllOperationsSucceed(handle2, storage);
// Cleanup.
storage.delete(handle1, TIMEOUT).get(TIMEOUT.toMillis(), TimeUnit.MILLISECONDS);
storage.delete(handle2, TIMEOUT).get(TIMEOUT.toMillis(), TimeUnit.MILLISECONDS);
}
Aggregations