Search in sources :

Example 96 with AtomicSupport

use of com.cinchapi.concourse.server.storage.AtomicSupport in project concourse by cinchapi.

the class ConcourseServer method maxKeyCriteria.

@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public TObject maxKeyCriteria(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 max = Operations.maxKeyRecordsAtomic(key, records, Time.NONE, atomic);
        return Convert.javaToThrift(max);
    });
}
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 97 with AtomicSupport

use of com.cinchapi.concourse.server.storage.AtomicSupport in project concourse by cinchapi.

the class ConcourseServer method sumKeyCclTime.

@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public TObject sumKeyCclTime(String key, 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);
        Number sum = Operations.sumKeyRecordsAtomic(key, records, timestamp, atomic);
        return Convert.javaToThrift(sum);
    });
}
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 98 with AtomicSupport

use of com.cinchapi.concourse.server.storage.AtomicSupport in project concourse by cinchapi.

the class ConcourseServer method getCriteriaTimeOrderPage.

@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Map<String, TObject>> getCriteriaTimeOrderPage(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<SortableTable<TObject>> supplier = () -> SortableTable.singleValued(new LinkedHashMap<>());
    return AtomicOperations.supplyWithRetry(store, atomic -> Operations.getAstOptionalAtomic(atomic, ast, timestamp, 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 99 with AtomicSupport

use of com.cinchapi.concourse.server.storage.AtomicSupport in project concourse by cinchapi.

the class OperationsTest method testBrowseNavigationKeyAtomic.

@Test
public void testBrowseNavigationKeyAtomic() {
    AtomicSupport store = getStore();
    try {
        setupGraph(store);
        String key = "foo.bar.baz.name";
        Map<TObject, Set<Long>> data = Operations.browseNavigationKeyOptionalAtomic(key, Time.NONE, store);
        Assert.assertEquals(ImmutableMap.of(Convert.javaToThrift("C"), ImmutableSet.of(1L, 4L), Convert.javaToThrift("D"), ImmutableSet.of(1L, 4L), Convert.javaToThrift("E"), ImmutableSet.of(1L, 4L)), data);
    } finally {
        store.stop();
    }
}
Also used : TObject(com.cinchapi.concourse.thrift.TObject) ImmutableSet(com.google.common.collect.ImmutableSet) Set(java.util.Set) AtomicSupport(com.cinchapi.concourse.server.storage.AtomicSupport) Test(org.junit.Test)

Example 100 with AtomicSupport

use of com.cinchapi.concourse.server.storage.AtomicSupport in project concourse by cinchapi.

the class OperationsTest method testTraverseKeyRecordAtomic.

@Test
public void testTraverseKeyRecordAtomic() {
    AtomicSupport store = getStore();
    try {
        setupGraph(store);
        String key = "bar.baz.name";
        Set<TObject> data = Operations.traverseKeyRecordOptionalAtomic(key, 3, Time.NONE, store);
        Assert.assertTrue(data.isEmpty());
    } finally {
        store.stop();
    }
}
Also used : TObject(com.cinchapi.concourse.thrift.TObject) AtomicSupport(com.cinchapi.concourse.server.storage.AtomicSupport) Test(org.junit.Test)

Aggregations

AtomicSupport (com.cinchapi.concourse.server.storage.AtomicSupport)192 TranslateClientExceptions (com.cinchapi.concourse.server.aop.TranslateClientExceptions)179 VerifyAccessToken (com.cinchapi.concourse.server.aop.VerifyAccessToken)179 VerifyReadPermission (com.cinchapi.concourse.server.aop.VerifyReadPermission)157 AbstractSyntaxTree (com.cinchapi.ccl.syntax.AbstractSyntaxTree)120 TObject (com.cinchapi.concourse.thrift.TObject)101 ComplexTObject (com.cinchapi.concourse.thrift.ComplexTObject)96 SortableTable (com.cinchapi.concourse.data.sort.SortableTable)87 Set (java.util.Set)78 VerifyWritePermission (com.cinchapi.concourse.server.aop.VerifyWritePermission)76 SortableSet (com.cinchapi.concourse.data.sort.SortableSet)73 SortableColumn (com.cinchapi.concourse.data.sort.SortableColumn)72 Map (java.util.Map)62 AtomicOperation (com.cinchapi.concourse.server.storage.AtomicOperation)60 AtomicReference (java.util.concurrent.atomic.AtomicReference)59 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