use of com.cinchapi.concourse.server.aop.TranslateClientExceptions in project concourse by cinchapi.
the class ConcourseServer method getCriteriaTimeOrderPage.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Map<String, TObject>> getCriteriaTimeOrderPage(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<SortableTable<TObject>> supplier = () -> SortableTable.singleValued(new LinkedHashMap<>());
return AtomicOperations.supplyWithRetry(store, atomic -> Operations.getAstOptionalAtomic(atomic, 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 findKeyOperatorValuesTimeOrderPage.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Set<Long> findKeyOperatorValuesTimeOrderPage(String key, Operator operator, List<TObject> values, long timestamp, TOrder order, TPage page, AccessToken creds, TransactionToken transaction, String environment) throws TException {
TObject[] tValues = values.toArray(Array.containing());
AtomicSupport store = getStore(transaction, environment);
return AtomicOperations.supplyWithRetry(store, atomic -> {
SortableSet<Set<TObject>> records = SortableSet.of(Stores.find(store, timestamp, key, operator, tValues));
// NOTE: The #timestamp is not considered when sorting because it is
// a component of criteria evaluation and no data is being selected.
// The presence of a present state Order also necessities this
// operation being performed atomically
records.sort(Sorting.byValues(Orders.from(order), store));
return Paging.page(records, Pages.from(page));
});
}
use of com.cinchapi.concourse.server.aop.TranslateClientExceptions in project concourse by cinchapi.
the class ConcourseServer method findCcl.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Set<Long> findCcl(String ccl, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AbstractSyntaxTree ast = compiler.parse(ccl);
AtomicSupport store = getStore(transaction, environment);
Function<Store, Set<Long>> function = $store -> ast.accept(Finder.instance(), $store);
try {
return function.apply(store);
} catch (InsufficientAtomicityException e) {
return AtomicOperations.supplyWithRetry(store, atomic -> function.apply(atomic));
}
}
use of com.cinchapi.concourse.server.aop.TranslateClientExceptions in project concourse by cinchapi.
the class ConcourseServer method removeKeyValueRecords.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyWritePermission
public Map<Long, Boolean> removeKeyValueRecords(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.remove(key, value, record));
}
});
return result;
}
use of com.cinchapi.concourse.server.aop.TranslateClientExceptions in project concourse by cinchapi.
the class ConcourseServer method selectKeyRecordsTimePage.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Set<TObject>> selectKeyRecordsTimePage(String key, List<Long> records, long timestamp, TPage page, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AtomicSupport store = getStore(transaction, environment);
Supplier<SortableColumn<Set<TObject>>> supplier = () -> SortableColumn.multiValued(key, new LinkedHashMap<>(records.size()));
return Operations.selectKeyRecordsOptionalAtomic(store, key, records, timestamp, Orders.from(NO_ORDER), Pages.from(page), supplier);
}
Aggregations