use of com.cinchapi.concourse.thrift.TransactionToken in project concourse by cinchapi.
the class ConcourseServer method selectKeysCclTimeOrder.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Map<String, Set<TObject>>> selectKeysCclTimeOrder(List<String> keys, 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.selectKeysAstAtomic(keys, 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.thrift.TransactionToken in project concourse by cinchapi.
the class ConcourseThriftDriver method commit.
@Override
public boolean commit() {
return execute(() -> {
final TransactionToken token = transaction;
transaction = null;
return token != null ? core.commit(creds, token, environment) : false;
});
}
use of com.cinchapi.concourse.thrift.TransactionToken in project concourse by cinchapi.
the class ConcourseServer method findCriteria.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Set<Long> findCriteria(TCriteria criteria, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AbstractSyntaxTree ast = compiler.parse(criteria);
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.thrift.TransactionToken in project concourse by cinchapi.
the class ConcourseServer method selectKeyRecord.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Set<TObject> selectKeyRecord(String key, long record, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AtomicSupport store = getStore(transaction, environment);
Function<Store, Set<TObject>> function = $store -> Stores.select($store, key, record);
try {
return function.apply(store);
} catch (InsufficientAtomicityException e) {
return AtomicOperations.supplyWithRetry(store, atomic -> function.apply(atomic));
}
}
use of com.cinchapi.concourse.thrift.TransactionToken in project concourse by cinchapi.
the class RemoteMethodRequest method deserialize.
@Override
public void deserialize(Buffer buffer) {
this.method = buffer.readUTF8();
byte[] creds0 = new byte[buffer.readInt()];
buffer.read(creds0);
this.creds = new AccessToken(ByteBuffer.wrap(creds0));
boolean transaction0 = buffer.readByte() == 1 ? true : false;
this.transaction = null;
if (transaction0) {
long timestamp = buffer.readLong();
this.transaction = new TransactionToken(creds, timestamp);
}
this.environment = buffer.readUTF8();
this.args = Lists.newArrayList();
while (buffer.hasRemaining()) {
int length = buffer.readInt();
byte[] arg = new byte[length];
buffer.read(arg);
args.add(ComplexTObject.fromByteBuffer(ByteBuffer.wrap(arg)));
}
}
Aggregations