use of com.cinchapi.concourse.server.aop.TranslateClientExceptions in project concourse by cinchapi.
the class ConcourseServer method getCriteriaTimePage.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Map<String, TObject>> getCriteriaTimePage(TCriteria criteria, long timestamp, 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 Operations.getAstOptionalAtomic(store, ast, timestamp, Orders.from(NO_ORDER), Pages.from(page), supplier);
}
use of com.cinchapi.concourse.server.aop.TranslateClientExceptions in project concourse by cinchapi.
the class ConcourseServer method describeRecordsTime.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Set<String>> describeRecordsTime(List<Long> records, long timestamp, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AtomicSupport store = getStore(transaction, environment);
Map<Long, Set<String>> result = TMaps.newLinkedHashMapWithCapacity(records.size());
for (long record : records) {
result.put(record, store.describe(record, timestamp));
}
return result;
}
use of com.cinchapi.concourse.server.aop.TranslateClientExceptions in project concourse by cinchapi.
the class ConcourseServer method countKeyCriteria.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public long countKeyCriteria(String key, TCriteria criteria, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AbstractSyntaxTree ast = compiler.parse(criteria);
AtomicSupport store = getStore(transaction, environment);
return AtomicOperations.supplyWithRetry(store, (atomic) -> {
Set<Long> records = ast.accept(Finder.instance(), atomic);
return Operations.countKeyRecordsAtomic(key, records, Time.NONE, atomic);
});
}
use of com.cinchapi.concourse.server.aop.TranslateClientExceptions in project concourse by cinchapi.
the class ConcourseServer method insertJsonRecords.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyWritePermission
public Map<Long, Boolean> insertJsonRecords(String json, List<Long> records, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AtomicSupport store = getStore(transaction, environment);
Multimap<String, Object> data = Convert.jsonToJava(json);
Map<Long, Boolean> result = Maps.newLinkedHashMap();
AtomicOperations.executeWithRetry(store, (atomic) -> {
List<DeferredWrite> deferred = Lists.newArrayList();
for (long record : records) {
result.put(record, Operations.insertAtomic(data, record, atomic, deferred));
}
Operations.insertDeferredAtomic(deferred, atomic);
});
return result;
}
use of com.cinchapi.concourse.server.aop.TranslateClientExceptions in project concourse by cinchapi.
the class ConcourseServer method averageKeyCriteria.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public TObject averageKeyCriteria(String key, TCriteria criteria, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AbstractSyntaxTree ast = compiler.parse(criteria);
AtomicSupport store = getStore(transaction, environment);
return AtomicOperations.supplyWithRetry(store, (atomic) -> {
Set<Long> records = ast.accept(Finder.instance(), atomic);
Number average = Operations.avgKeyRecordsAtomic(key, records, Time.NONE, atomic);
return Convert.javaToThrift(average);
});
}
Aggregations