Search in sources :

Example 76 with TranslateClientExceptions

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

the class ConcourseServer method revertKeyRecordsTime.

@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyWritePermission
public void revertKeyRecordsTime(String key, List<Long> records, long timestamp, AccessToken creds, TransactionToken transaction, String environment) throws TException {
    AtomicSupport store = getStore(transaction, environment);
    AtomicOperations.executeWithRetry(store, (atomic) -> {
        for (long record : records) {
            Operations.revertAtomic(key, record, timestamp, atomic);
        }
    });
}
Also used : AtomicSupport(com.cinchapi.concourse.server.storage.AtomicSupport) VerifyWritePermission(com.cinchapi.concourse.server.aop.VerifyWritePermission) VerifyAccessToken(com.cinchapi.concourse.server.aop.VerifyAccessToken) TranslateClientExceptions(com.cinchapi.concourse.server.aop.TranslateClientExceptions)

Example 77 with TranslateClientExceptions

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

the class ConcourseServer method findOrInsertCclJson.

@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyWritePermission
public long findOrInsertCclJson(String ccl, String json, AccessToken creds, TransactionToken transaction, String environment) throws TException {
    List<Multimap<String, Object>> objects = Lists.newArrayList(Convert.jsonToJava(json));
    AtomicSupport store = getStore(transaction, environment);
    Set<Long> records = Sets.newLinkedHashSet();
    AtomicOperations.executeWithRetry(store, (atomic) -> {
        records.clear();
        AbstractSyntaxTree ast;
        if (objects.size() == 1) {
            // CON-321: Support local resolution when the data blob is a
            // single object
            ast = compiler.parse(ccl, objects.get(0));
        } else {
            ast = compiler.parse(ccl);
        }
        Operations.findOrInsertAtomic(records, objects, ast, atomic);
    });
    if (records.size() == 1) {
        return Iterables.getOnlyElement(records);
    } else {
        throw new DuplicateEntryException(AnyStrings.joinWithSpace("Found", records.size(), "records that match", ccl));
    }
}
Also used : Multimap(com.google.common.collect.Multimap) AbstractSyntaxTree(com.cinchapi.ccl.syntax.AbstractSyntaxTree) AtomicSupport(com.cinchapi.concourse.server.storage.AtomicSupport) DuplicateEntryException(com.cinchapi.concourse.thrift.DuplicateEntryException) VerifyWritePermission(com.cinchapi.concourse.server.aop.VerifyWritePermission) VerifyAccessToken(com.cinchapi.concourse.server.aop.VerifyAccessToken) TranslateClientExceptions(com.cinchapi.concourse.server.aop.TranslateClientExceptions)

Example 78 with TranslateClientExceptions

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

the class ConcourseServer method getCriteriaOrderPage.

@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Map<String, TObject>> getCriteriaOrderPage(TCriteria criteria, TOrder order, 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 AtomicOperations.supplyWithRetry(store, atomic -> Operations.getAstAtomic(atomic, ast, Orders.from(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 79 with TranslateClientExceptions

use of com.cinchapi.concourse.server.aop.TranslateClientExceptions 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));
}
Also used : ComplexTObject(com.cinchapi.concourse.thrift.ComplexTObject) TObject(com.cinchapi.concourse.thrift.TObject) AbstractSyntaxTree(com.cinchapi.ccl.syntax.AbstractSyntaxTree) AtomicSupport(com.cinchapi.concourse.server.storage.AtomicSupport) SortableColumn(com.cinchapi.concourse.data.sort.SortableColumn) VerifyAccessToken(com.cinchapi.concourse.server.aop.VerifyAccessToken) VerifyReadPermission(com.cinchapi.concourse.server.aop.VerifyReadPermission) TranslateClientExceptions(com.cinchapi.concourse.server.aop.TranslateClientExceptions)

Example 80 with TranslateClientExceptions

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

the class ConcourseServer method clearKeysRecords.

@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyWritePermission
public void clearKeysRecords(List<String> keys, List<Long> records, AccessToken creds, TransactionToken transaction, String environment) throws TException {
    AtomicSupport store = getStore(transaction, environment);
    AtomicOperations.executeWithRetry(store, (atomic) -> {
        for (long record : records) {
            for (String key : keys) {
                Operations.clearKeyRecordAtomic(key, record, atomic);
            }
        }
    });
}
Also used : AtomicSupport(com.cinchapi.concourse.server.storage.AtomicSupport) VerifyWritePermission(com.cinchapi.concourse.server.aop.VerifyWritePermission) VerifyAccessToken(com.cinchapi.concourse.server.aop.VerifyAccessToken) 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