Search in sources :

Example 86 with TranslateClientExceptions

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

the class ConcourseServer method getKeyCriteriaTimePage.

@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, TObject> getKeyCriteriaTimePage(String key, 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<SortableColumn<TObject>> supplier = () -> SortableColumn.singleValued(key, new LinkedHashMap<>());
    return Operations.getKeyAstOptionalAtomic(store, key, 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) 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 87 with TranslateClientExceptions

use of com.cinchapi.concourse.server.aop.TranslateClientExceptions 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);
        }
    });
}
Also used : ComplexTObject(com.cinchapi.concourse.thrift.ComplexTObject) TObject(com.cinchapi.concourse.thrift.TObject) 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 88 with TranslateClientExceptions

use of com.cinchapi.concourse.server.aop.TranslateClientExceptions 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));
}
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) 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 89 with TranslateClientExceptions

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

the class ConcourseServer method clearRecords.

@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyWritePermission
public void clearRecords(List<Long> records, AccessToken creds, TransactionToken transaction, String environment) throws TException {
    AtomicSupport store = getStore(transaction, environment);
    AtomicOperations.executeWithRetry(store, (atomic) -> {
        for (long record : records) {
            Operations.clearRecordAtomic(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)

Example 90 with TranslateClientExceptions

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

the class ConcourseServer method clearKeyRecord.

@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyWritePermission
public void clearKeyRecord(String key, long record, AccessToken creds, TransactionToken transaction, String environment) throws TException {
    AtomicSupport store = getStore(transaction, environment);
    AtomicOperations.executeWithRetry(store, (atomic) -> {
        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