Search in sources :

Example 81 with TranslateClientExceptions

use of com.cinchapi.concourse.server.aop.TranslateClientExceptions in project concourse by cinchapi.

the class ConcourseServer method getCriteriaTimePage.

@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Map<String, TObject>> getCriteriaTimePage(TCriteria criteria, long timestamp, TPage page, AccessToken creds, TransactionToken transaction, String environment) throws TException {
    AbstractSyntaxTree ast = compiler.parse(criteria);
    AtomicSupport store = getStore(transaction, environment);
    Supplier<SortableTable<TObject>> supplier = () -> SortableTable.singleValued(new LinkedHashMap<>());
    return Operations.getAstOptionalAtomic(store, ast, timestamp, Orders.from(NO_ORDER), Pages.from(page), supplier);
}
Also used : AbstractSyntaxTree(com.cinchapi.ccl.syntax.AbstractSyntaxTree) AtomicSupport(com.cinchapi.concourse.server.storage.AtomicSupport) SortableTable(com.cinchapi.concourse.data.sort.SortableTable) VerifyAccessToken(com.cinchapi.concourse.server.aop.VerifyAccessToken) VerifyReadPermission(com.cinchapi.concourse.server.aop.VerifyReadPermission) TranslateClientExceptions(com.cinchapi.concourse.server.aop.TranslateClientExceptions)

Example 82 with TranslateClientExceptions

use of com.cinchapi.concourse.server.aop.TranslateClientExceptions in project concourse by cinchapi.

the class ConcourseServer method describeRecordsTime.

@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Set<String>> describeRecordsTime(List<Long> records, long timestamp, AccessToken creds, TransactionToken transaction, String environment) throws TException {
    AtomicSupport store = getStore(transaction, environment);
    Map<Long, Set<String>> result = TMaps.newLinkedHashMapWithCapacity(records.size());
    for (long record : records) {
        result.put(record, store.describe(record, timestamp));
    }
    return result;
}
Also used : SortableSet(com.cinchapi.concourse.data.sort.SortableSet) Set(java.util.Set) AtomicSupport(com.cinchapi.concourse.server.storage.AtomicSupport) VerifyAccessToken(com.cinchapi.concourse.server.aop.VerifyAccessToken) VerifyReadPermission(com.cinchapi.concourse.server.aop.VerifyReadPermission) TranslateClientExceptions(com.cinchapi.concourse.server.aop.TranslateClientExceptions)

Example 83 with TranslateClientExceptions

use of com.cinchapi.concourse.server.aop.TranslateClientExceptions in project concourse by cinchapi.

the class ConcourseServer method countKeyCriteria.

@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public long countKeyCriteria(String key, TCriteria criteria, AccessToken creds, TransactionToken transaction, String environment) throws TException {
    AbstractSyntaxTree ast = compiler.parse(criteria);
    AtomicSupport store = getStore(transaction, environment);
    return AtomicOperations.supplyWithRetry(store, (atomic) -> {
        Set<Long> records = ast.accept(Finder.instance(), atomic);
        return Operations.countKeyRecordsAtomic(key, records, Time.NONE, atomic);
    });
}
Also used : AbstractSyntaxTree(com.cinchapi.ccl.syntax.AbstractSyntaxTree) AtomicSupport(com.cinchapi.concourse.server.storage.AtomicSupport) VerifyAccessToken(com.cinchapi.concourse.server.aop.VerifyAccessToken) VerifyReadPermission(com.cinchapi.concourse.server.aop.VerifyReadPermission) TranslateClientExceptions(com.cinchapi.concourse.server.aop.TranslateClientExceptions)

Example 84 with TranslateClientExceptions

use of com.cinchapi.concourse.server.aop.TranslateClientExceptions in project concourse by cinchapi.

the class ConcourseServer method insertJsonRecords.

@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyWritePermission
public Map<Long, Boolean> insertJsonRecords(String json, List<Long> records, AccessToken creds, TransactionToken transaction, String environment) throws TException {
    AtomicSupport store = getStore(transaction, environment);
    Multimap<String, Object> data = Convert.jsonToJava(json);
    Map<Long, Boolean> result = Maps.newLinkedHashMap();
    AtomicOperations.executeWithRetry(store, (atomic) -> {
        List<DeferredWrite> deferred = Lists.newArrayList();
        for (long record : records) {
            result.put(record, Operations.insertAtomic(data, record, atomic, deferred));
        }
        Operations.insertDeferredAtomic(deferred, atomic);
    });
    return result;
}
Also used : AtomicSupport(com.cinchapi.concourse.server.storage.AtomicSupport) ComplexTObject(com.cinchapi.concourse.thrift.ComplexTObject) TObject(com.cinchapi.concourse.thrift.TObject) VerifyWritePermission(com.cinchapi.concourse.server.aop.VerifyWritePermission) VerifyAccessToken(com.cinchapi.concourse.server.aop.VerifyAccessToken) TranslateClientExceptions(com.cinchapi.concourse.server.aop.TranslateClientExceptions)

Example 85 with TranslateClientExceptions

use of com.cinchapi.concourse.server.aop.TranslateClientExceptions in project concourse by cinchapi.

the class ConcourseServer method averageKeyCriteria.

@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public TObject averageKeyCriteria(String key, TCriteria criteria, AccessToken creds, TransactionToken transaction, String environment) throws TException {
    AbstractSyntaxTree ast = compiler.parse(criteria);
    AtomicSupport store = getStore(transaction, environment);
    return AtomicOperations.supplyWithRetry(store, (atomic) -> {
        Set<Long> records = ast.accept(Finder.instance(), atomic);
        Number average = Operations.avgKeyRecordsAtomic(key, records, Time.NONE, atomic);
        return Convert.javaToThrift(average);
    });
}
Also used : AbstractSyntaxTree(com.cinchapi.ccl.syntax.AbstractSyntaxTree) AtomicSupport(com.cinchapi.concourse.server.storage.AtomicSupport) VerifyAccessToken(com.cinchapi.concourse.server.aop.VerifyAccessToken) VerifyReadPermission(com.cinchapi.concourse.server.aop.VerifyReadPermission) TranslateClientExceptions(com.cinchapi.concourse.server.aop.TranslateClientExceptions)

Aggregations

TranslateClientExceptions (com.cinchapi.concourse.server.aop.TranslateClientExceptions)180 VerifyAccessToken (com.cinchapi.concourse.server.aop.VerifyAccessToken)180 AtomicSupport (com.cinchapi.concourse.server.storage.AtomicSupport)179 VerifyReadPermission (com.cinchapi.concourse.server.aop.VerifyReadPermission)157 AbstractSyntaxTree (com.cinchapi.ccl.syntax.AbstractSyntaxTree)120 ComplexTObject (com.cinchapi.concourse.thrift.ComplexTObject)96 TObject (com.cinchapi.concourse.thrift.TObject)96 SortableTable (com.cinchapi.concourse.data.sort.SortableTable)87 VerifyWritePermission (com.cinchapi.concourse.server.aop.VerifyWritePermission)76 SortableSet (com.cinchapi.concourse.data.sort.SortableSet)73 Set (java.util.Set)73 SortableColumn (com.cinchapi.concourse.data.sort.SortableColumn)72 Map (java.util.Map)58 NonBlockingHashMap (org.cliffc.high_scale_lib.NonBlockingHashMap)58 AtomicStateException (com.cinchapi.concourse.server.storage.AtomicStateException)57 TransactionStateException (com.cinchapi.concourse.server.storage.TransactionStateException)57 Diff (com.cinchapi.concourse.thrift.Diff)57 TransactionException (com.cinchapi.concourse.thrift.TransactionException)57 AtomicReference (java.util.concurrent.atomic.AtomicReference)57 AtomicOperation (com.cinchapi.concourse.server.storage.AtomicOperation)56