use of com.cinchapi.concourse.server.aop.VerifyReadPermission 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.VerifyReadPermission 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.VerifyReadPermission 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);
}
use of com.cinchapi.concourse.server.aop.VerifyReadPermission in project concourse by cinchapi.
the class ConcourseServer method describeTime.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Set<String> describeTime(long timestamp, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AtomicSupport store = getStore(transaction, environment);
Set<String> result = Sets.newLinkedHashSet();
AtomicOperations.executeWithRetry(store, (atomic) -> {
Set<Long> records = store.getAllRecords();
for (long record : records) {
result.addAll(store.describe(record, timestamp));
}
});
return result;
}
use of com.cinchapi.concourse.server.aop.VerifyReadPermission in project concourse by cinchapi.
the class ConcourseServer method getKeysRecordTime.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<String, TObject> getKeysRecordTime(List<String> keys, long record, long timestamp, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AtomicSupport store = getStore(transaction, environment);
Map<String, Set<TObject>> selected = Stores.select(store, keys, record, timestamp);
Map<String, TObject> data = new LinkedHashMap<>(selected.size());
for (Entry<String, Set<TObject>> entry : selected.entrySet()) {
Set<TObject> values = entry.getValue();
if (!values.isEmpty()) {
data.put(entry.getKey(), Iterables.getLast(values));
}
}
return data;
}
Aggregations