use of com.cinchapi.concourse.server.aop.VerifyReadPermission in project concourse by cinchapi.
the class ConcourseServer method getKeyRecordsOrder.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, TObject> getKeyRecordsOrder(String key, List<Long> records, TOrder order, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AtomicSupport store = getStore(transaction, environment);
SortableColumn<TObject> result = SortableColumn.singleValued(key, TMaps.newLinkedHashMapWithCapacity(records.size()));
AtomicOperations.executeWithRetry(store, atomic -> Operations.getKeyRecordsAtomic(key, records, result, null, $result -> $result.sort(Sorting.byValue(Orders.from(order), atomic)), atomic));
return result;
}
use of com.cinchapi.concourse.server.aop.VerifyReadPermission in project concourse by cinchapi.
the class ConcourseServer method findKeyOperatorValuesTimeOrder.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Set<Long> findKeyOperatorValuesTimeOrder(String key, Operator operator, List<TObject> values, long timestamp, TOrder order, AccessToken creds, TransactionToken transaction, String environment) throws TException {
TObject[] tValues = values.toArray(Array.containing());
AtomicSupport store = getStore(transaction, environment);
Function<Store, SortableSet<Set<TObject>>> function = $store -> {
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.
$records.sort(Sorting.byValues(Orders.from(order), store));
return $records;
};
SortableSet<Set<TObject>> records = null;
boolean isAtomic = order != NO_ORDER;
while (records == null) {
try {
if (isAtomic) {
records = AtomicOperations.<SortableSet<Set<TObject>>>supplyWithRetry(store, atomic -> function.apply(atomic));
} else {
records = function.apply(store);
}
} catch (InsufficientAtomicityException e) {
isAtomic = true;
}
}
return records;
}
use of com.cinchapi.concourse.server.aop.VerifyReadPermission in project concourse by cinchapi.
the class ConcourseServer method getCclOrder.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Map<String, TObject>> getCclOrder(String ccl, TOrder order, AccessToken creds, TransactionToken transaction, String environment) throws TException {
try {
AbstractSyntaxTree ast = compiler.parse(ccl);
AtomicSupport store = getStore(transaction, environment);
SortableTable<TObject> result = SortableTable.singleValued(Maps.newLinkedHashMap());
AtomicOperations.executeWithRetry(store, atomic -> Operations.getAstAtomic(ast, Time.NONE, result, null, $result -> $result.sort(Sorting.byValue(Orders.from(order), atomic)), atomic));
return result;
} catch (Exception e) {
throw new ParseException(e.getMessage());
}
}
use of com.cinchapi.concourse.server.aop.VerifyReadPermission in project concourse by cinchapi.
the class ConcourseServer method selectCclOrder.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Map<String, Set<TObject>>> selectCclOrder(String ccl, TOrder order, AccessToken creds, TransactionToken transaction, String environment) throws TException {
try {
AbstractSyntaxTree ast = compiler.parse(ccl);
AtomicSupport store = getStore(transaction, environment);
SortableTable<Set<TObject>> result = emptySortableResultDataset();
AtomicOperations.executeWithRetry(store, atomic -> Operations.selectAstAtomic(ast, Time.NONE, result, null, $result -> $result.sort(Sorting.byValues(Orders.from(order), atomic)), atomic));
return result;
} catch (Exception e) {
throw new ParseException(e.getMessage());
}
}
use of com.cinchapi.concourse.server.aop.VerifyReadPermission in project concourse by cinchapi.
the class ConcourseServer method selectKeysRecordsOrder.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Map<String, Set<TObject>>> selectKeysRecordsOrder(List<String> keys, List<Long> records, TOrder order, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AtomicSupport store = getStore(transaction, environment);
SortableTable<Set<TObject>> result = emptySortableResultDatasetWithCapacity(records.size());
AtomicOperations.executeWithRetry(store, atomic -> Operations.selectKeysRecordsAtomic(keys, records, result, null, $result -> $result.sort(Sorting.byValues(Orders.from(order), atomic)), atomic));
return result;
}
Aggregations