Search in sources :

Example 81 with VerifyReadPermission

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

the class ConcourseServer method findKeyOperatorValuesTimeOrderPage.

@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Set<Long> findKeyOperatorValuesTimeOrderPage(String key, Operator operator, List<TObject> values, long timestamp, TOrder order, TPage page, AccessToken creds, TransactionToken transaction, String environment) throws TException {
    TObject[] tValues = values.toArray(Array.containing());
    AtomicSupport store = getStore(transaction, environment);
    return AtomicOperations.supplyWithRetry(store, atomic -> {
        SortableSet<Set<TObject>> records = SortableSet.of(Stores.find(store, timestamp, key, operator, tValues));
        // NOTE: The #timestamp is not considered when sorting because it is
        // a component of criteria evaluation and no data is being selected.
        // The presence of a present state Order also necessities this
        // operation being performed atomically
        records.sort(Sorting.byValues(Orders.from(order), store));
        return Paging.page(records, Pages.from(page));
    });
}
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) 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 82 with VerifyReadPermission

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

the class ConcourseServer method findCcl.

@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Set<Long> findCcl(String ccl, AccessToken creds, TransactionToken transaction, String environment) throws TException {
    AbstractSyntaxTree ast = compiler.parse(ccl);
    AtomicSupport store = getStore(transaction, environment);
    Function<Store, Set<Long>> function = $store -> ast.accept(Finder.instance(), $store);
    try {
        return function.apply(store);
    } catch (InsufficientAtomicityException e) {
        return AtomicOperations.supplyWithRetry(store, atomic -> function.apply(atomic));
    }
}
Also used : UpgradeTasks(com.cinchapi.concourse.server.upgrade.UpgradeTasks) TServer(org.apache.thrift.server.TServer) Transaction(com.cinchapi.concourse.server.storage.Transaction) Constants(com.cinchapi.concourse.Constants) Permission(com.cinchapi.concourse.security.Permission) ServerSocket(java.net.ServerSocket) ConcourseCalculateService(com.cinchapi.concourse.thrift.ConcourseCalculateService) TransactionStateException(com.cinchapi.concourse.server.storage.TransactionStateException) SortableColumn(com.cinchapi.concourse.data.sort.SortableColumn) SecurityException(com.cinchapi.concourse.thrift.SecurityException) Map(java.util.Map) TThreadPoolServer(org.apache.thrift.server.TThreadPoolServer) TransactionException(com.cinchapi.concourse.thrift.TransactionException) Link(com.cinchapi.concourse.Link) SortableSet(com.cinchapi.concourse.data.sort.SortableSet) SortableTable(com.cinchapi.concourse.data.sort.SortableTable) AccessToken(com.cinchapi.concourse.thrift.AccessToken) UserService(com.cinchapi.concourse.security.UserService) TranslateClientExceptions(com.cinchapi.concourse.server.aop.TranslateClientExceptions) Orders(com.cinchapi.concourse.server.query.sort.Orders) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) FileSystem(com.cinchapi.concourse.server.io.FileSystem) Set(java.util.Set) DuplicateEntryException(com.cinchapi.concourse.thrift.DuplicateEntryException) Executors(java.util.concurrent.Executors) ConcourseManagementService(com.cinchapi.concourse.server.management.ConcourseManagementService) MalformedObjectNameException(javax.management.MalformedObjectNameException) AtomicOperation(com.cinchapi.concourse.server.storage.AtomicOperation) Operator(com.cinchapi.concourse.thrift.Operator) VerifyReadPermission(com.cinchapi.concourse.server.aop.VerifyReadPermission) TProcessor(org.apache.thrift.TProcessor) VerifyAccessToken(com.cinchapi.concourse.server.aop.VerifyAccessToken) PluginManager(com.cinchapi.concourse.server.plugin.PluginManager) Stores(com.cinchapi.concourse.server.ops.Stores) Iterables(com.google.common.collect.Iterables) Environments(com.cinchapi.concourse.util.Environments) TMultiplexedProcessor(org.apache.thrift.TMultiplexedProcessor) Sorting(com.cinchapi.concourse.server.query.sort.Sorting) Timestamps(com.cinchapi.concourse.util.Timestamps) Supplier(java.util.function.Supplier) ConcourseCompiler(com.cinchapi.concourse.lang.ConcourseCompiler) LinkedHashMap(java.util.LinkedHashMap) Strings(com.google.common.base.Strings) Reflection(com.cinchapi.common.reflect.Reflection) AtomicSupport(com.cinchapi.concourse.server.storage.AtomicSupport) Lists(com.google.common.collect.Lists) InsufficientAtomicityException(com.cinchapi.concourse.server.ops.InsufficientAtomicityException) ManagementFactory(java.lang.management.ManagementFactory) TSimpleServer(org.apache.thrift.server.TSimpleServer) Array(com.cinchapi.common.base.Array) Nullable(javax.annotation.Nullable) ConcourseServerAdvisor(com.cinchapi.concourse.server.aop.ConcourseServerAdvisor) NonBlockingHashMap(org.cliffc.high_scale_lib.NonBlockingHashMap) Engine(com.cinchapi.concourse.server.storage.Engine) TException(org.apache.thrift.TException) CommandLine(com.cinchapi.concourse.shell.CommandLine) File(java.io.File) Args(org.apache.thrift.server.TThreadPoolServer.Args) NaturalLanguage(com.cinchapi.ccl.util.NaturalLanguage) CommitVersions(com.cinchapi.concourse.server.storage.CommitVersions) Guice(com.google.inject.Guice) Preconditions(com.google.common.base.Preconditions) ConcourseNavigateService(com.cinchapi.concourse.thrift.ConcourseNavigateService) AnyStrings(com.cinchapi.common.base.AnyStrings) TCriteria(com.cinchapi.concourse.thrift.TCriteria) TTransportException(org.apache.thrift.transport.TTransportException) Logger(com.cinchapi.concourse.util.Logger) AtomicStateException(com.cinchapi.concourse.server.storage.AtomicStateException) Paging(com.cinchapi.concourse.server.query.paginate.Paging) ByteBuffer(java.nio.ByteBuffer) InstanceAlreadyExistsException(javax.management.InstanceAlreadyExistsException) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Convert(com.cinchapi.concourse.util.Convert) PluginRestricted(com.cinchapi.concourse.server.plugin.PluginRestricted) BufferedStore(com.cinchapi.concourse.server.storage.BufferedStore) TOrder(com.cinchapi.concourse.thrift.TOrder) Internal(com.cinchapi.concourse.server.aop.Internal) AtomicOperations(com.cinchapi.concourse.server.ops.AtomicOperations) Timestamp(com.cinchapi.concourse.Timestamp) Version(com.cinchapi.concourse.util.Version) ComplexTObject(com.cinchapi.concourse.thrift.ComplexTObject) AbstractSyntaxTree(com.cinchapi.ccl.syntax.AbstractSyntaxTree) ManagedOperation(com.cinchapi.concourse.server.jmx.ManagedOperation) Operations(com.cinchapi.concourse.server.ops.Operations) Language(com.cinchapi.concourse.lang.Language) Sets(com.google.common.collect.Sets) List(java.util.List) Entry(java.util.Map.Entry) VerifyWritePermission(com.cinchapi.concourse.server.aop.VerifyWritePermission) CheckedExceptions(com.cinchapi.common.base.CheckedExceptions) Role(com.cinchapi.concourse.security.Role) ManagementException(com.cinchapi.concourse.thrift.ManagementException) ThreadFactoryBuilder(com.google.common.util.concurrent.ThreadFactoryBuilder) Store(com.cinchapi.concourse.server.storage.Store) HttpServer(com.cinchapi.concourse.server.http.HttpServer) ConcourseService(com.cinchapi.concourse.thrift.ConcourseService) TransactionToken(com.cinchapi.concourse.thrift.TransactionToken) Multimap(com.google.common.collect.Multimap) AtomicReference(java.util.concurrent.atomic.AtomicReference) Function(java.util.function.Function) ParseException(com.cinchapi.concourse.thrift.ParseException) TObject(com.cinchapi.concourse.thrift.TObject) GlobalState(com.cinchapi.concourse.server.GlobalState) TMaps(com.cinchapi.concourse.util.TMaps) MBeanRegistrationException(javax.management.MBeanRegistrationException) MemoryUsage(java.lang.management.MemoryUsage) Time(com.cinchapi.concourse.time.Time) Iterator(java.util.Iterator) Order(com.cinchapi.concourse.lang.sort.Order) LazyTrackingTObjectResultDataset(com.cinchapi.concourse.server.plugin.data.LazyTrackingTObjectResultDataset) TPage(com.cinchapi.concourse.thrift.TPage) Pages(com.cinchapi.concourse.server.query.paginate.Pages) Maps(com.google.common.collect.Maps) Injector(com.google.inject.Injector) TServerSocket(org.apache.thrift.transport.TServerSocket) Finder(com.cinchapi.concourse.server.query.Finder) ClientInvokable(com.cinchapi.concourse.server.management.ClientInvokable) Immutable(javax.annotation.concurrent.Immutable) Diff(com.cinchapi.concourse.thrift.Diff) SortableSet(com.cinchapi.concourse.data.sort.SortableSet) Set(java.util.Set) AbstractSyntaxTree(com.cinchapi.ccl.syntax.AbstractSyntaxTree) AtomicSupport(com.cinchapi.concourse.server.storage.AtomicSupport) BufferedStore(com.cinchapi.concourse.server.storage.BufferedStore) Store(com.cinchapi.concourse.server.storage.Store) InsufficientAtomicityException(com.cinchapi.concourse.server.ops.InsufficientAtomicityException) VerifyAccessToken(com.cinchapi.concourse.server.aop.VerifyAccessToken) VerifyReadPermission(com.cinchapi.concourse.server.aop.VerifyReadPermission) TranslateClientExceptions(com.cinchapi.concourse.server.aop.TranslateClientExceptions)

Example 83 with VerifyReadPermission

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

the class ConcourseServer method selectKeyRecordsTimePage.

@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Set<TObject>> selectKeyRecordsTimePage(String key, List<Long> records, long timestamp, TPage page, AccessToken creds, TransactionToken transaction, String environment) throws TException {
    AtomicSupport store = getStore(transaction, environment);
    Supplier<SortableColumn<Set<TObject>>> supplier = () -> SortableColumn.multiValued(key, new LinkedHashMap<>(records.size()));
    return Operations.selectKeyRecordsOptionalAtomic(store, key, records, timestamp, Orders.from(NO_ORDER), Pages.from(page), supplier);
}
Also used : ComplexTObject(com.cinchapi.concourse.thrift.ComplexTObject) TObject(com.cinchapi.concourse.thrift.TObject) 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 84 with VerifyReadPermission

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

the class ConcourseServer method describeTime.

@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Set<String> describeTime(long timestamp, AccessToken creds, TransactionToken transaction, String environment) throws TException {
    AtomicSupport store = getStore(transaction, environment);
    Set<String> result = Sets.newLinkedHashSet();
    AtomicOperations.executeWithRetry(store, (atomic) -> {
        Set<Long> records = store.getAllRecords();
        for (long record : records) {
            result.addAll(store.describe(record, timestamp));
        }
    });
    return result;
}
Also used : 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 85 with VerifyReadPermission

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

the class ConcourseServer method getKeysRecordTime.

@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<String, TObject> getKeysRecordTime(List<String> keys, long record, long timestamp, AccessToken creds, TransactionToken transaction, String environment) throws TException {
    AtomicSupport store = getStore(transaction, environment);
    Map<String, Set<TObject>> selected = Stores.select(store, keys, record, timestamp);
    Map<String, TObject> data = new LinkedHashMap<>(selected.size());
    for (Entry<String, Set<TObject>> entry : selected.entrySet()) {
        Set<TObject> values = entry.getValue();
        if (!values.isEmpty()) {
            data.put(entry.getKey(), Iterables.getLast(values));
        }
    }
    return data;
}
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) AtomicSupport(com.cinchapi.concourse.server.storage.AtomicSupport) LinkedHashMap(java.util.LinkedHashMap) 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