use of com.cinchapi.concourse.server.aop.TranslateClientExceptions in project concourse by cinchapi.
the class ConcourseServer method revertKeyRecordsTime.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyWritePermission
public void revertKeyRecordsTime(String key, 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) {
Operations.revertAtomic(key, record, timestamp, atomic);
}
});
}
use of com.cinchapi.concourse.server.aop.TranslateClientExceptions in project concourse by cinchapi.
the class ConcourseServer method findOrInsertCclJson.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyWritePermission
public long findOrInsertCclJson(String ccl, String json, AccessToken creds, TransactionToken transaction, String environment) throws TException {
List<Multimap<String, Object>> objects = Lists.newArrayList(Convert.jsonToJava(json));
AtomicSupport store = getStore(transaction, environment);
Set<Long> records = Sets.newLinkedHashSet();
AtomicOperations.executeWithRetry(store, (atomic) -> {
records.clear();
AbstractSyntaxTree ast;
if (objects.size() == 1) {
// CON-321: Support local resolution when the data blob is a
// single object
ast = compiler.parse(ccl, objects.get(0));
} else {
ast = compiler.parse(ccl);
}
Operations.findOrInsertAtomic(records, objects, ast, atomic);
});
if (records.size() == 1) {
return Iterables.getOnlyElement(records);
} else {
throw new DuplicateEntryException(AnyStrings.joinWithSpace("Found", records.size(), "records that match", ccl));
}
}
use of com.cinchapi.concourse.server.aop.TranslateClientExceptions in project concourse by cinchapi.
the class ConcourseServer method getCriteriaOrderPage.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Map<String, TObject>> getCriteriaOrderPage(TCriteria criteria, TOrder order, TPage page, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AbstractSyntaxTree ast = compiler.parse(criteria);
AtomicSupport store = getStore(transaction, environment);
Supplier<SortableTable<TObject>> supplier = () -> SortableTable.singleValued(new LinkedHashMap<>());
return AtomicOperations.supplyWithRetry(store, atomic -> Operations.getAstAtomic(atomic, ast, Orders.from(order), Pages.from(page), supplier));
}
use of com.cinchapi.concourse.server.aop.TranslateClientExceptions in project concourse by cinchapi.
the class ConcourseServer method selectKeyCriteriaTimeOrderPage.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Set<TObject>> selectKeyCriteriaTimeOrderPage(String key, TCriteria criteria, long timestamp, TOrder order, TPage page, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AbstractSyntaxTree ast = compiler.parse(criteria);
AtomicSupport store = getStore(transaction, environment);
Supplier<SortableColumn<Set<TObject>>> supplier = () -> SortableColumn.multiValued(key, new LinkedHashMap<>());
return AtomicOperations.supplyWithRetry(store, atomic -> Operations.selectKeyAstOptionalAtomic(atomic, key, ast, timestamp, Orders.from(order), Pages.from(page), supplier));
}
use of com.cinchapi.concourse.server.aop.TranslateClientExceptions in project concourse by cinchapi.
the class ConcourseServer method clearKeysRecords.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyWritePermission
public void clearKeysRecords(List<String> keys, List<Long> records, 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.clearKeyRecordAtomic(key, record, atomic);
}
}
});
}
Aggregations