use of com.cinchapi.concourse.server.storage.Transaction in project concourse by cinchapi.
the class ConcourseServer method selectKeysCriteriaPage.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Map<String, Set<TObject>>> selectKeysCriteriaPage(List<String> keys, TCriteria criteria, TPage page, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AbstractSyntaxTree ast = compiler.parse(criteria);
AtomicSupport store = getStore(transaction, environment);
SortableTable<Set<TObject>> result = emptySortableResultDataset();
AtomicOperations.executeWithRetry(store, atomic -> Operations.selectKeysAstAtomic(keys, ast, Time.NONE, result, records -> Paging.paginate(records, Pages.from(page)), null, atomic));
return result;
}
use of com.cinchapi.concourse.server.storage.Transaction in project concourse by cinchapi.
the class ConcourseServer method getKeyRecordsPage.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, TObject> getKeyRecordsPage(String key, List<Long> records, TPage page, 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, $records -> Paging.paginate($records, Pages.from(page)), null, atomic));
return result;
}
use of com.cinchapi.concourse.server.storage.Transaction in project concourse by cinchapi.
the class ConcourseServer method getCriteriaPage.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Map<String, TObject>> getCriteriaPage(TCriteria criteria, TPage page, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AbstractSyntaxTree ast = compiler.parse(criteria);
AtomicSupport store = getStore(transaction, environment);
SortableTable<TObject> result = SortableTable.singleValued(Maps.newLinkedHashMap());
AtomicOperations.executeWithRetry(store, atomic -> Operations.getAstAtomic(ast, Time.NONE, result, records -> Paging.paginate(records, Pages.from(page)), null, atomic));
return result;
}
use of com.cinchapi.concourse.server.storage.Transaction in project concourse by cinchapi.
the class ConcourseServer method selectCclTimeOrder.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Map<String, Set<TObject>>> selectCclTimeOrder(String ccl, long timestamp, 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, timestamp, result, null, $result -> $result.sort(Sorting.byValues(Orders.from(order), atomic), timestamp), atomic));
return result;
} catch (Exception e) {
throw new ParseException(e.getMessage());
}
}
use of com.cinchapi.concourse.server.storage.Transaction in project concourse by cinchapi.
the class ConcourseServer method findKeyOperatorValuesOrder.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Set<Long> findKeyOperatorValuesOrder(String key, Operator operator, List<TObject> values, 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, key, operator, tValues));
$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;
}
Aggregations