Search in sources :

Example 91 with VerifyReadPermission

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

the class ConcourseServer method selectCclTimePage.

@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Map<String, Set<TObject>>> selectCclTimePage(String ccl, long timestamp, 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 Operations.selectAstOptionalAtomic(store, ast, timestamp, Orders.from(NO_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 92 with VerifyReadPermission

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

the class ConcourseServer method diffKeyRecordStartEnd.

@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Diff, Set<TObject>> diffKeyRecordStartEnd(String key, long record, long start, long end, AccessToken creds, TransactionToken transaction, String environment) throws TException {
    AtomicSupport store = getStore(transaction, environment);
    AtomicReference<Set<TObject>> startValues = new AtomicReference<>(null);
    AtomicReference<Set<TObject>> endValues = new AtomicReference<>(null);
    AtomicOperations.executeWithRetry(store, (atomic) -> {
        startValues.set(store.select(key, record, start));
        endValues.set(store.select(key, record, end));
    });
    Map<Diff, Set<TObject>> result = Maps.newHashMapWithExpectedSize(2);
    Set<TObject> xor = Sets.symmetricDifference(startValues.get(), endValues.get());
    int expectedSize = xor.size() / 2;
    Set<TObject> added = Sets.newHashSetWithExpectedSize(expectedSize);
    Set<TObject> removed = Sets.newHashSetWithExpectedSize(expectedSize);
    for (TObject current : xor) {
        if (!startValues.get().contains(current))
            added.add(current);
        else {
            removed.add(current);
        }
    }
    if (!added.isEmpty()) {
        result.put(Diff.ADDED, added);
    }
    if (!removed.isEmpty()) {
        result.put(Diff.REMOVED, removed);
    }
    return result;
}
Also used : ComplexTObject(com.cinchapi.concourse.thrift.ComplexTObject) TObject(com.cinchapi.concourse.thrift.TObject) SortableSet(com.cinchapi.concourse.data.sort.SortableSet) Set(java.util.Set) Diff(com.cinchapi.concourse.thrift.Diff) AtomicSupport(com.cinchapi.concourse.server.storage.AtomicSupport) AtomicReference(java.util.concurrent.atomic.AtomicReference) VerifyAccessToken(com.cinchapi.concourse.server.aop.VerifyAccessToken) VerifyReadPermission(com.cinchapi.concourse.server.aop.VerifyReadPermission) TranslateClientExceptions(com.cinchapi.concourse.server.aop.TranslateClientExceptions)

Example 93 with VerifyReadPermission

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

the class ConcourseServer method navigateKeysCclTime.

@SuppressWarnings("deprecation")
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
@Deprecated
public Map<Long, Map<String, Set<TObject>>> navigateKeysCclTime(List<String> keys, String ccl, long timestamp, AccessToken creds, TransactionToken transaction, String environment) throws TException {
    AbstractSyntaxTree ast = compiler.parse(ccl);
    AtomicSupport store = getStore(transaction, environment);
    return AtomicOperations.supplyWithRetry(store, (atomic) -> {
        Set<Long> records = ast.accept(Finder.instance(), atomic);
        return Operations.navigateKeysRecordsAtomic(keys, records, timestamp, 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 94 with VerifyReadPermission

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

the class ConcourseServer method getKeysCclTimePage.

@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Map<String, TObject>> getKeysCclTimePage(List<String> keys, String ccl, long timestamp, TPage page, AccessToken creds, TransactionToken transaction, String environment) throws TException {
    AbstractSyntaxTree ast = compiler.parse(ccl);
    AtomicSupport store = getStore(transaction, environment);
    Supplier<SortableTable<TObject>> supplier = () -> SortableTable.singleValued(new LinkedHashMap<>());
    return Operations.getKeysAstOptionalAtomic(store, keys, 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 95 with VerifyReadPermission

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

the class ConcourseServer method describeRecords.

@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Set<String>> describeRecords(List<Long> records, AccessToken creds, TransactionToken transaction, String environment) throws TException {
    AtomicSupport store = getStore(transaction, environment);
    Map<Long, Set<String>> result = Maps.newLinkedHashMap();
    AtomicOperations.executeWithRetry(store, (atomic) -> {
        for (long record : records) {
            result.put(record, atomic.describe(record));
        }
    });
    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)

Aggregations

TranslateClientExceptions (com.cinchapi.concourse.server.aop.TranslateClientExceptions)157 VerifyAccessToken (com.cinchapi.concourse.server.aop.VerifyAccessToken)157 VerifyReadPermission (com.cinchapi.concourse.server.aop.VerifyReadPermission)157 AtomicSupport (com.cinchapi.concourse.server.storage.AtomicSupport)157 AbstractSyntaxTree (com.cinchapi.ccl.syntax.AbstractSyntaxTree)118 ComplexTObject (com.cinchapi.concourse.thrift.ComplexTObject)90 TObject (com.cinchapi.concourse.thrift.TObject)90 SortableTable (com.cinchapi.concourse.data.sort.SortableTable)87 SortableColumn (com.cinchapi.concourse.data.sort.SortableColumn)72 SortableSet (com.cinchapi.concourse.data.sort.SortableSet)72 Set (java.util.Set)72 Map (java.util.Map)58 NonBlockingHashMap (org.cliffc.high_scale_lib.NonBlockingHashMap)58 Diff (com.cinchapi.concourse.thrift.Diff)57 AtomicReference (java.util.concurrent.atomic.AtomicReference)57 List (java.util.List)56 NaturalLanguage (com.cinchapi.ccl.util.NaturalLanguage)54 AnyStrings (com.cinchapi.common.base.AnyStrings)54 Array (com.cinchapi.common.base.Array)54 CheckedExceptions (com.cinchapi.common.base.CheckedExceptions)54