Search in sources :

Example 6 with InMemoryKeyValueService

use of com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService in project atlasdb by palantir.

the class InMemoryAtlasDbFactory method createInMemoryTransactionManagerInternal.

private static SerializableTransactionManager createInMemoryTransactionManagerInternal(Set<Schema> schemas) {
    TimestampService ts = new InMemoryTimestampService();
    KeyValueService keyValueService = new InMemoryKeyValueService(false);
    schemas.forEach(s -> Schemas.createTablesAndIndexes(s, keyValueService));
    TransactionTables.createTables(keyValueService);
    TransactionService transactionService = TransactionServices.createTransactionService(keyValueService);
    LockService lock = LockRefreshingLockService.create(LockServiceImpl.create(LockServerOptions.builder().isStandaloneServer(false).build()));
    LockClient client = LockClient.of("in memory atlasdb instance");
    ConflictDetectionManager conflictManager = ConflictDetectionManagers.createWithoutWarmingCache(keyValueService);
    SweepStrategyManager sweepStrategyManager = SweepStrategyManagers.createDefault(keyValueService);
    CleanupFollower follower = CleanupFollower.create(schemas);
    Cleaner cleaner = new DefaultCleanerBuilder(keyValueService, lock, ts, client, ImmutableList.of(follower), transactionService).buildCleaner();
    SerializableTransactionManager ret = SerializableTransactionManager.createForTest(keyValueService, ts, client, lock, transactionService, Suppliers.ofInstance(AtlasDbConstraintCheckingMode.FULL_CONSTRAINT_CHECKING_THROWS_EXCEPTIONS), conflictManager, sweepStrategyManager, cleaner, DEFAULT_MAX_CONCURRENT_RANGES, DEFAULT_GET_RANGES_CONCURRENCY, () -> DEFAULT_TIMESTAMP_CACHE_SIZE, MultiTableSweepQueueWriter.NO_OP);
    cleaner.start(ret);
    return ret;
}
Also used : SweepStrategyManager(com.palantir.atlasdb.transaction.impl.SweepStrategyManager) InMemoryKeyValueService(com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService) KeyValueService(com.palantir.atlasdb.keyvalue.api.KeyValueService) TransactionService(com.palantir.atlasdb.transaction.service.TransactionService) LockRefreshingLockService(com.palantir.lock.client.LockRefreshingLockService) LockService(com.palantir.lock.LockService) InMemoryKeyValueService(com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService) SerializableTransactionManager(com.palantir.atlasdb.transaction.impl.SerializableTransactionManager) LockClient(com.palantir.lock.LockClient) DefaultCleanerBuilder(com.palantir.atlasdb.cleaner.DefaultCleanerBuilder) ConflictDetectionManager(com.palantir.atlasdb.transaction.impl.ConflictDetectionManager) InMemoryTimestampService(com.palantir.timestamp.InMemoryTimestampService) InMemoryTimestampService(com.palantir.timestamp.InMemoryTimestampService) TimestampService(com.palantir.timestamp.TimestampService) CleanupFollower(com.palantir.atlasdb.cleaner.CleanupFollower) Cleaner(com.palantir.atlasdb.cleaner.Cleaner)

Example 7 with InMemoryKeyValueService

use of com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService in project atlasdb by palantir.

the class KeyValueServiceScrubberStoreTest method before.

@Before
public void before() {
    kvs = new InMemoryKeyValueService(false, MoreExecutors.newDirectExecutorService());
    scrubStore = KeyValueServiceScrubberStore.create(kvs);
}
Also used : InMemoryKeyValueService(com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService) Before(org.junit.Before)

Example 8 with InMemoryKeyValueService

use of com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService in project atlasdb by palantir.

the class KvsBackedPersistentLockServiceTest method canCreatePersistentLockService.

@Test
public void canCreatePersistentLockService() {
    KeyValueService kvs = new InMemoryKeyValueService(false);
    PersistentLockService pls = KvsBackedPersistentLockService.create(kvs);
    assertNotNull(pls);
}
Also used : KeyValueService(com.palantir.atlasdb.keyvalue.api.KeyValueService) InMemoryKeyValueService(com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService) InMemoryKeyValueService(com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService) Test(org.junit.Test)

Example 9 with InMemoryKeyValueService

use of com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService in project atlasdb by palantir.

the class KvsBackedPersistentLockServiceTest method setUp.

@Before
public void setUp() {
    KeyValueService kvs = new InMemoryKeyValueService(false);
    lockStore = spy(LockStoreImpl.createImplForTest(kvs));
    service = new KvsBackedPersistentLockService(lockStore);
}
Also used : KeyValueService(com.palantir.atlasdb.keyvalue.api.KeyValueService) InMemoryKeyValueService(com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService) InMemoryKeyValueService(com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService) Before(org.junit.Before)

Example 10 with InMemoryKeyValueService

use of com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService in project atlasdb by palantir.

the class LockEntryTest method fromRowResultProducesLockEntry.

@Test
public void fromRowResultProducesLockEntry() {
    KeyValueService kvs = new InMemoryKeyValueService(false);
    kvs.createTable(TEST_TABLE, AtlasDbConstants.GENERIC_TABLE_METADATA);
    kvs.checkAndSet(CheckAndSetRequest.newCell(TEST_TABLE, LOCK_ENTRY.cell(), LOCK_ENTRY.value()));
    Iterator<RowResult<Value>> range = kvs.getRange(TEST_TABLE, RangeRequest.all(), AtlasDbConstants.TRANSACTION_TS + 1);
    RowResult<Value> onlyEntry = Iterables.getOnlyElement(ImmutableSet.copyOf(range));
    LockEntry lockEntry = LockEntry.fromRowResult(onlyEntry);
    assertEquals(LOCK_ENTRY, lockEntry);
}
Also used : RowResult(com.palantir.atlasdb.keyvalue.api.RowResult) InMemoryKeyValueService(com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService) KeyValueService(com.palantir.atlasdb.keyvalue.api.KeyValueService) InMemoryKeyValueService(com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService) Value(com.palantir.atlasdb.keyvalue.api.Value) Test(org.junit.Test)

Aggregations

InMemoryKeyValueService (com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService)14 KeyValueService (com.palantir.atlasdb.keyvalue.api.KeyValueService)8 Before (org.junit.Before)6 Test (org.junit.Test)4 ImmutableMap (com.google.common.collect.ImmutableMap)2 Namespace (com.palantir.atlasdb.keyvalue.api.Namespace)2 RowResult (com.palantir.atlasdb.keyvalue.api.RowResult)2 TableReference (com.palantir.atlasdb.keyvalue.api.TableReference)2 ValueType (com.palantir.atlasdb.table.description.ValueType)2 ConflictDetectionManager (com.palantir.atlasdb.transaction.impl.ConflictDetectionManager)2 SweepStrategyManager (com.palantir.atlasdb.transaction.impl.SweepStrategyManager)2 Iterables (com.google.common.collect.Iterables)1 Lists (com.google.common.collect.Lists)1 AtlasDbTestCase (com.palantir.atlasdb.AtlasDbTestCase)1 Cleaner (com.palantir.atlasdb.cleaner.Cleaner)1 CleanupFollower (com.palantir.atlasdb.cleaner.CleanupFollower)1 DefaultCleanerBuilder (com.palantir.atlasdb.cleaner.DefaultCleanerBuilder)1 PtBytes (com.palantir.atlasdb.encoding.PtBytes)1 Cell (com.palantir.atlasdb.keyvalue.api.Cell)1 RangeRequest (com.palantir.atlasdb.keyvalue.api.RangeRequest)1