Search in sources :

Example 1 with CheckAndSetRequest

use of com.palantir.atlasdb.keyvalue.api.CheckAndSetRequest in project atlasdb by palantir.

the class TracingKeyValueServiceTest method checkAndSet.

@Test
public void checkAndSet() throws Exception {
    CheckAndSetRequest request = CheckAndSetRequest.singleCell(TABLE_REF, CELL, ROW_NAME, ROW_NAME);
    kvs.checkAndSet(request);
    checkSpan("atlasdb-kvs.checkAndSet({table})");
    verify(delegate).checkAndSet(request);
    verifyNoMoreInteractions(delegate);
}
Also used : CheckAndSetRequest(com.palantir.atlasdb.keyvalue.api.CheckAndSetRequest) Test(org.junit.Test)

Example 2 with CheckAndSetRequest

use of com.palantir.atlasdb.keyvalue.api.CheckAndSetRequest in project atlasdb by palantir.

the class LockStoreImpl method acquireBackupLock.

@Override
public LockEntry acquireBackupLock(String reason) throws CheckAndSetException {
    LockEntry lockEntry = generateUniqueBackupLockEntry(reason);
    CheckAndSetRequest request = CheckAndSetRequest.singleCell(AtlasDbConstants.PERSISTED_LOCKS_TABLE, lockEntry.cell(), LOCK_OPEN.value(), lockEntry.value());
    keyValueService.checkAndSet(request);
    log.info("Successfully acquired the persistent lock: {}", SafeArg.of("lockEntry", lockEntry));
    return lockEntry;
}
Also used : CheckAndSetRequest(com.palantir.atlasdb.keyvalue.api.CheckAndSetRequest)

Example 3 with CheckAndSetRequest

use of com.palantir.atlasdb.keyvalue.api.CheckAndSetRequest in project atlasdb by palantir.

the class LockStoreImpl method releaseLock.

@Override
public void releaseLock(LockEntry lockEntry) throws CheckAndSetException {
    CheckAndSetRequest request = CheckAndSetRequest.singleCell(AtlasDbConstants.PERSISTED_LOCKS_TABLE, lockEntry.cell(), lockEntry.value(), LOCK_OPEN.value());
    keyValueService.checkAndSet(request);
    log.info("Successfully released the persistent lock: {}", SafeArg.of("lockEntry", lockEntry));
}
Also used : CheckAndSetRequest(com.palantir.atlasdb.keyvalue.api.CheckAndSetRequest)

Example 4 with CheckAndSetRequest

use of com.palantir.atlasdb.keyvalue.api.CheckAndSetRequest in project atlasdb by palantir.

the class AbstractKeyValueServiceTest method testCheckAndSetFromOtherValue.

@Test
public void testCheckAndSetFromOtherValue() {
    Assume.assumeTrue(checkAndSetSupported());
    CheckAndSetRequest request = CheckAndSetRequest.newCell(TEST_TABLE, TEST_CELL, value00);
    keyValueService.checkAndSet(request);
    CheckAndSetRequest secondRequest = CheckAndSetRequest.singleCell(TEST_TABLE, TEST_CELL, value00, value01);
    keyValueService.checkAndSet(secondRequest);
    verifyCheckAndSet(TEST_CELL, value01);
}
Also used : CheckAndSetRequest(com.palantir.atlasdb.keyvalue.api.CheckAndSetRequest) Test(org.junit.Test)

Example 5 with CheckAndSetRequest

use of com.palantir.atlasdb.keyvalue.api.CheckAndSetRequest in project atlasdb by palantir.

the class AbstractKeyValueServiceTest method testCheckAndSetFromEmpty.

@Test
public void testCheckAndSetFromEmpty() {
    Assume.assumeTrue(checkAndSetSupported());
    CheckAndSetRequest request = CheckAndSetRequest.newCell(TEST_TABLE, TEST_CELL, value00);
    keyValueService.checkAndSet(request);
    verifyCheckAndSet(TEST_CELL, value00);
}
Also used : CheckAndSetRequest(com.palantir.atlasdb.keyvalue.api.CheckAndSetRequest) Test(org.junit.Test)

Aggregations

CheckAndSetRequest (com.palantir.atlasdb.keyvalue.api.CheckAndSetRequest)12 Test (org.junit.Test)7 CheckAndSetException (com.palantir.atlasdb.keyvalue.api.CheckAndSetException)3 Cell (com.palantir.atlasdb.keyvalue.api.Cell)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 ImmutableMultimap (com.google.common.collect.ImmutableMultimap)1 Iterables (com.google.common.collect.Iterables)1 AsyncInitializer (com.palantir.async.initializer.AsyncInitializer)1 AtlasDbConstants (com.palantir.atlasdb.AtlasDbConstants)1 PtBytes (com.palantir.atlasdb.encoding.PtBytes)1 ImmutableCheckAndSetRequest (com.palantir.atlasdb.keyvalue.api.ImmutableCheckAndSetRequest)1 InsufficientConsistencyException (com.palantir.atlasdb.keyvalue.api.InsufficientConsistencyException)1 KeyAlreadyExistsException (com.palantir.atlasdb.keyvalue.api.KeyAlreadyExistsException)1 KeyValueService (com.palantir.atlasdb.keyvalue.api.KeyValueService)1 RangeRequest (com.palantir.atlasdb.keyvalue.api.RangeRequest)1 Value (com.palantir.atlasdb.keyvalue.api.Value)1 SchemaMetadata (com.palantir.atlasdb.schema.SchemaMetadata)1 FunctionCheckedException (com.palantir.common.base.FunctionCheckedException)1 PalantirRuntimeException (com.palantir.common.exception.PalantirRuntimeException)1