use of com.cinchapi.concourse.server.storage.Transaction in project concourse by cinchapi.
the class ConcourseServer method getKeyRecord.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public TObject getKeyRecord(String key, long record, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AtomicSupport store = getStore(transaction, environment);
Function<Store, TObject> function = $store -> Iterables.getLast(Stores.select($store, key, record), TObject.NULL);
try {
return function.apply(store);
} catch (InsufficientAtomicityException e) {
return AtomicOperations.supplyWithRetry(store, atomic -> function.apply(atomic));
}
}
use of com.cinchapi.concourse.server.storage.Transaction in project concourse by cinchapi.
the class ConcourseServer method findKeyOperatorValuesTimePage.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Set<Long> findKeyOperatorValuesTimePage(String key, Operator operator, List<TObject> values, long timestamp, TPage page, AccessToken creds, TransactionToken transaction, String environment) throws TException {
TObject[] tValues = values.toArray(Array.containing());
AtomicSupport store = getStore(transaction, environment);
Function<Store, Set<Long>> function = $store -> Stores.find($store, timestamp, key, operator, tValues);
Set<Long> records;
try {
records = function.apply(store);
} catch (InsufficientAtomicityException e) {
records = AtomicOperations.supplyWithRetry(store, atomic -> function.apply(atomic));
}
return Paging.page(records, Pages.from(page));
}
use of com.cinchapi.concourse.server.storage.Transaction in project concourse by cinchapi.
the class ConcourseServer method stage.
@Override
@TranslateClientExceptions
@PluginRestricted
@VerifyAccessToken
public TransactionToken stage(AccessToken creds, String env) throws TException {
TransactionToken token = new TransactionToken(creds, Time.now());
Transaction transaction = getEngine(env).startTransaction();
transactions.put(token, transaction);
Logger.info("Started Transaction {}", transaction);
return token;
}
use of com.cinchapi.concourse.server.storage.Transaction in project concourse by cinchapi.
the class ConcourseServer method selectKeysCriteriaTimeOrder.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Map<String, Set<TObject>>> selectKeysCriteriaTimeOrder(List<String> keys, TCriteria criteria, long timestamp, TOrder order, 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, timestamp, result, null, $result -> $result.sort(Sorting.byValues(Orders.from(order), atomic), timestamp), atomic));
return result;
}
use of com.cinchapi.concourse.server.storage.Transaction in project concourse by cinchapi.
the class ConcourseServer method getKeysCriteriaTimeOrder.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Map<String, TObject>> getKeysCriteriaTimeOrder(List<String> keys, TCriteria criteria, long timestamp, TOrder order, 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.getKeysAstAtomic(keys, ast, timestamp, result, null, $result -> $result.sort(Sorting.byValue(Orders.from(order), atomic), timestamp), atomic));
return result;
}
Aggregations