use of com.cinchapi.concourse.thrift.TObject in project concourse by cinchapi.
the class ConcourseServer method getKeysRecord.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<String, TObject> getKeysRecord(List<String> keys, long record, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AtomicSupport store = getStore(transaction, environment);
return AtomicOperations.supplyWithRetry(store, atomic -> {
Map<String, Set<TObject>> selected = Stores.select(atomic, keys, record);
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;
});
}
use of com.cinchapi.concourse.thrift.TObject in project concourse by cinchapi.
the class ConcourseServer method selectKeysCclOrderPage.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Map<String, Set<TObject>>> selectKeysCclOrderPage(List<String> keys, String ccl, TOrder order, TPage page, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AbstractSyntaxTree ast = compiler.parse(ccl);
AtomicSupport store = getStore(transaction, environment);
Supplier<SortableTable<Set<TObject>>> supplier = () -> emptySortableResultDataset();
return AtomicOperations.supplyWithRetry(store, atomic -> Operations.selectKeysAstAtomic(atomic, keys, ast, Orders.from(order), Pages.from(page), supplier));
}
use of com.cinchapi.concourse.thrift.TObject in project concourse by cinchapi.
the class ConcourseServer method selectKeyCriteriaTimeOrderPage.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Set<TObject>> selectKeyCriteriaTimeOrderPage(String key, TCriteria criteria, long timestamp, TOrder order, TPage page, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AbstractSyntaxTree ast = compiler.parse(criteria);
AtomicSupport store = getStore(transaction, environment);
Supplier<SortableColumn<Set<TObject>>> supplier = () -> SortableColumn.multiValued(key, new LinkedHashMap<>());
return AtomicOperations.supplyWithRetry(store, atomic -> Operations.selectKeyAstOptionalAtomic(atomic, key, ast, timestamp, Orders.from(order), Pages.from(page), supplier));
}
use of com.cinchapi.concourse.thrift.TObject in project concourse by cinchapi.
the class ConcourseServer method verifyOrSet.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyWritePermission
public void verifyOrSet(String key, TObject value, long record, AccessToken creds, TransactionToken transaction, String env) throws TException {
AtomicSupport store = getStore(transaction, env);
AtomicOperations.executeWithRetry(store, (atomic) -> {
Set<TObject> values = atomic.select(key, record);
for (TObject val : values) {
if (!val.equals(value)) {
atomic.remove(key, val, record);
}
}
if (!atomic.verify(key, value, record)) {
atomic.add(key, value, record);
}
});
}
use of com.cinchapi.concourse.thrift.TObject in project concourse by cinchapi.
the class ConcourseServer method selectCclOrderPage.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Map<String, Set<TObject>>> selectCclOrderPage(String ccl, TOrder order, TPage page, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AbstractSyntaxTree ast = compiler.parse(ccl);
AtomicSupport store = getStore(transaction, environment);
Supplier<SortableTable<Set<TObject>>> supplier = () -> emptySortableResultDataset();
return AtomicOperations.supplyWithRetry(store, atomic -> Operations.selectAstAtomic(atomic, ast, Orders.from(order), Pages.from(page), supplier));
}
Aggregations