use of com.cinchapi.concourse.server.aop.VerifyWritePermission in project concourse by cinchapi.
the class ConcourseServer method addKeyValue.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyWritePermission
public long addKeyValue(String key, TObject value, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AtomicSupport store = getStore(transaction, environment);
return AtomicOperations.supplyWithRetry(store, (atomic) -> {
long record = Time.now();
Operations.addIfEmptyAtomic(key, value, record, atomic);
return record;
});
}
use of com.cinchapi.concourse.server.aop.VerifyWritePermission in project concourse by cinchapi.
the class ConcourseServer method insertJsonRecord.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyWritePermission
public boolean insertJsonRecord(String json, long record, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AtomicSupport store = getStore(transaction, environment);
try {
Multimap<String, Object> data = Convert.jsonToJava(json);
AtomicOperation atomic = store.startAtomicOperation();
List<DeferredWrite> deferred = Lists.newArrayList();
return Operations.insertAtomic(data, record, atomic, deferred) && Operations.insertDeferredAtomic(deferred, atomic) && atomic.commit(CommitVersions.next());
} catch (TransactionStateException e) {
throw new TransactionException();
} catch (AtomicStateException e) {
return false;
}
}
use of com.cinchapi.concourse.server.aop.VerifyWritePermission in project concourse by cinchapi.
the class ConcourseServer method revertKeyRecordTime.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyWritePermission
public void revertKeyRecordTime(String key, long record, long timestamp, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AtomicSupport store = getStore(transaction, environment);
AtomicOperations.executeWithRetry(store, (atomic) -> {
Operations.revertAtomic(key, record, timestamp, atomic);
});
}
use of com.cinchapi.concourse.server.aop.VerifyWritePermission in project concourse by cinchapi.
the class ConcourseServer method addKeyValueRecords.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyWritePermission
public Map<Long, Boolean> addKeyValueRecords(String key, TObject value, List<Long> records, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AtomicSupport store = getStore(transaction, environment);
Map<Long, Boolean> result = Maps.newLinkedHashMap();
AtomicOperations.executeWithRetry(store, (atomic) -> {
for (long record : records) {
result.put(record, atomic.add(key, value, record));
}
});
return result;
}
use of com.cinchapi.concourse.server.aop.VerifyWritePermission in project concourse by cinchapi.
the class ConcourseServer method revertKeysRecordsTime.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyWritePermission
public void revertKeysRecordsTime(List<String> keys, List<Long> records, long timestamp, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AtomicSupport store = getStore(transaction, environment);
AtomicOperations.executeWithRetry(store, (atomic) -> {
for (long record : records) {
for (String key : keys) {
Operations.revertAtomic(key, record, timestamp, atomic);
}
}
});
}
Aggregations