Search in sources :

Example 26 with Store

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

the class ConcourseServer method selectKeysCclTimeOrder.

@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Map<String, Set<TObject>>> selectKeysCclTimeOrder(List<String> keys, String ccl, long timestamp, TOrder order, AccessToken creds, TransactionToken transaction, String environment) throws TException {
    try {
        AbstractSyntaxTree ast = compiler.parse(ccl);
        AtomicSupport store = getStore(transaction, environment);
        SortableTable<Set<TObject>> result = emptySortableResultDataset();
        AtomicOperations.executeWithRetry(store, atomic -> Operations.selectKeysAstAtomic(keys, ast, timestamp, result, null, $result -> $result.sort(Sorting.byValues(Orders.from(order), atomic), timestamp), atomic));
        return result;
    } catch (Exception e) {
        throw new ParseException(e.getMessage());
    }
}
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) ConcourseCompiler(com.cinchapi.concourse.lang.ConcourseCompiler) 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) NoSuchElementException(java.util.NoSuchElementException) 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) ParseException(com.cinchapi.concourse.thrift.ParseException) TransactionStateException(com.cinchapi.concourse.server.storage.TransactionStateException) SecurityException(com.cinchapi.concourse.thrift.SecurityException) TransactionException(com.cinchapi.concourse.thrift.TransactionException) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) DuplicateEntryException(com.cinchapi.concourse.thrift.DuplicateEntryException) MalformedObjectNameException(javax.management.MalformedObjectNameException) InsufficientAtomicityException(com.cinchapi.concourse.server.ops.InsufficientAtomicityException) TException(org.apache.thrift.TException) TTransportException(org.apache.thrift.transport.TTransportException) AtomicStateException(com.cinchapi.concourse.server.storage.AtomicStateException) InstanceAlreadyExistsException(javax.management.InstanceAlreadyExistsException) ManagementException(com.cinchapi.concourse.thrift.ManagementException) ParseException(com.cinchapi.concourse.thrift.ParseException) MBeanRegistrationException(javax.management.MBeanRegistrationException) NoSuchElementException(java.util.NoSuchElementException) VerifyAccessToken(com.cinchapi.concourse.server.aop.VerifyAccessToken) VerifyReadPermission(com.cinchapi.concourse.server.aop.VerifyReadPermission) TranslateClientExceptions(com.cinchapi.concourse.server.aop.TranslateClientExceptions)

Example 27 with Store

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

the class Stores method serialSelect.

/**
 * Select the values stored for {@code key} in {@code record} at
 * {@code timestamp} from the {@code store}.
 * <p>
 * If the {@code key} is primitive, the store retrieval is usually a simple
 * {@link Store#select(long) select}. However, if the key is a navigation
 * key, this method will process it via
 * {@link Operations#traverseKeyRecordOptionalAtomic(String, long, long, AtomicOperation)}
 * if the {@code store} is an {@link AtomicOperation} or
 * {@link AtomicSupport supports} starting one.
 * </p>
 *
 * @param store
 * @param key
 * @param record
 * @param timestamp
 *
 * @return the values stored for {@code key} in {@code record} at
 *         {@code timestamp} according to the {@code store}
 */
protected static Set<TObject> serialSelect(Store store, String key, long record, long timestamp) {
    Function evalFunc;
    if (Keys.isNavigationKey(key)) {
        if (store instanceof AtomicOperation || timestamp != Time.NONE) {
            return Operations.traverseKeyRecordOptionalAtomic(key, record, timestamp, store);
        } else if (store instanceof AtomicSupport) {
            AtomicReference<Set<TObject>> value = new AtomicReference<>(ImmutableSet.of());
            AtomicOperations.executeWithRetry((AtomicSupport) store, (atomic) -> {
                value.set(Operations.traverseKeyRecordOptionalAtomic(key, record, timestamp, atomic));
            });
            return value.get();
        } else {
            throw new UnsupportedOperationException("Cannot fetch the current values of a navigation key using a Store that does not support atomic operations");
        }
    } else if ((evalFunc = Keys.tryParseFunction(key)) != null) {
        String method = Calculations.alias(evalFunc.operation()) + "KeyRecordAtomic";
        Number value = Reflection.callStatic(Operations.class, method, evalFunc.key(), record, timestamp, store);
        return value != null ? ImmutableSet.of(Convert.javaToThrift(value)) : ImmutableSet.of();
    } else if (key.equals(Constants.JSON_RESERVED_IDENTIFIER_NAME)) {
        return ImmutableSet.of(Convert.javaToThrift(record));
    } else {
        Source source;
        if (Command.isSet()) {
            Strategy strategy = new Strategy(Command.current(), store);
            source = strategy.source(key, record);
        } else {
            source = Source.FIELD;
        }
        Set<TObject> values;
        if (source == Source.RECORD) {
            // @formatter:off
            Map<String, Set<TObject>> data = timestamp == Time.NONE ? store.select(record) : store.select(record, timestamp);
            values = data.getOrDefault(key, ImmutableSet.of());
        // @formatter:on
        } else if (source == Source.FIELD) {
            // @formatter:off
            values = timestamp == Time.NONE ? store.select(key, record) : store.select(key, record, timestamp);
        // @formatter:on
        } else {
            // source == Source.INDEX
            // @formatter:off
            values = timestamp == Time.NONE ? store.gather(key, record) : store.gather(key, record, timestamp);
        // @formatter:on
        }
        return values;
    }
}
Also used : Function(com.cinchapi.ccl.type.Function) ArrayBuilder(com.cinchapi.common.base.ArrayBuilder) Source(com.cinchapi.concourse.server.ops.Strategy.Source) Store(com.cinchapi.concourse.server.storage.Store) AbstractSet(java.util.AbstractSet) AdHocIterator(com.cinchapi.common.base.AdHocIterator) HashMap(java.util.HashMap) IndexFunction(com.cinchapi.ccl.type.function.IndexFunction) Constants(com.cinchapi.concourse.Constants) AtomicReference(java.util.concurrent.atomic.AtomicReference) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) Calculations(com.cinchapi.concourse.server.calculate.Calculations) Reflection(com.cinchapi.common.reflect.Reflection) AtomicSupport(com.cinchapi.concourse.server.storage.AtomicSupport) ImmutableList(com.google.common.collect.ImmutableList) TObject(com.cinchapi.concourse.thrift.TObject) Convert(com.cinchapi.concourse.util.Convert) Keys(com.cinchapi.concourse.validate.Keys) TemporalFunction(com.cinchapi.ccl.type.function.TemporalFunction) Map(java.util.Map) Link(com.cinchapi.concourse.Link) LinkedHashSet(java.util.LinkedHashSet) Nullable(javax.annotation.Nullable) KeyType(com.cinchapi.concourse.validate.Keys.KeyType) Time(com.cinchapi.concourse.time.Time) ImmutableSet(com.google.common.collect.ImmutableSet) Iterator(java.util.Iterator) ImmutableMap(com.google.common.collect.ImmutableMap) Collection(java.util.Collection) Set(java.util.Set) KeyConditionFunction(com.cinchapi.ccl.type.function.KeyConditionFunction) MoreObjects(com.google.common.base.MoreObjects) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) AtomicOperation(com.cinchapi.concourse.server.storage.AtomicOperation) Operator(com.cinchapi.concourse.thrift.Operator) ForwardingMap(com.google.common.collect.ForwardingMap) Finder(com.cinchapi.concourse.server.query.Finder) Key(com.cinchapi.concourse.validate.Keys.Key) Type(com.cinchapi.concourse.thrift.Type) Queue(java.util.Queue) ArrayDeque(java.util.ArrayDeque) KeyValue(com.cinchapi.concourse.util.KeyValue) KeyRecordsFunction(com.cinchapi.ccl.type.function.KeyRecordsFunction) TObject(com.cinchapi.concourse.thrift.TObject) AbstractSet(java.util.AbstractSet) LinkedHashSet(java.util.LinkedHashSet) ImmutableSet(com.google.common.collect.ImmutableSet) Set(java.util.Set) AtomicSupport(com.cinchapi.concourse.server.storage.AtomicSupport) AtomicReference(java.util.concurrent.atomic.AtomicReference) Source(com.cinchapi.concourse.server.ops.Strategy.Source) Function(com.cinchapi.ccl.type.Function) IndexFunction(com.cinchapi.ccl.type.function.IndexFunction) TemporalFunction(com.cinchapi.ccl.type.function.TemporalFunction) KeyConditionFunction(com.cinchapi.ccl.type.function.KeyConditionFunction) KeyRecordsFunction(com.cinchapi.ccl.type.function.KeyRecordsFunction) AtomicOperation(com.cinchapi.concourse.server.storage.AtomicOperation)

Example 28 with Store

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

the class Stores method find.

/**
 * Find the records that contain values that are stored for {@code key} and
 * satisfy {@code operator} in relation to the specified {@code values} at
 * {@code timestamp}.
 * <p>
 * If the {@code key} is primitive, the store lookup is usually a simple
 * {@link Store#find(String, Operator, TObject[]) find}. However, if the key
 * is a navigation key, this method will process it by
 * {@link #browse(Store, String) browsing} the destination values and
 * checking the operator validity of each if and only if the {@code store}
 * is an {@link AtomicOperation} or {@link AtomicSupport supports} starting
 * one.
 * </p>
 *
 * @param store
 * @param timestamp
 * @param key
 * @param operator
 * @param values
 * @return the records that satisfy the query
 */
public static Set<Long> find(Store store, long timestamp, String key, Operator operator, TObject... values) {
    for (int i = 0; i < values.length; ++i) {
        TObject value = values[i];
        if (value.getType() == Type.FUNCTION) {
            Function function = (Function) Convert.thriftToJava(value);
            TemporalFunction func = (TemporalFunction) function;
            String method = Calculations.alias(function.operation());
            ArrayBuilder<Object> args = ArrayBuilder.builder();
            method += "Key";
            args.add(function.key());
            if (function instanceof KeyRecordsFunction || function instanceof KeyConditionFunction) {
                method += "Records";
                Collection<Long> records = function instanceof KeyRecordsFunction ? ((KeyRecordsFunction) function).source() : Finder.instance().visit(((KeyConditionFunction) function).source(), store);
                args.add(records);
            } else if (!(function instanceof IndexFunction)) {
                throw new IllegalStateException("Invalid function value");
            }
            method += "Atomic";
            args.add(func.timestamp());
            args.add(store);
            values[i] = Convert.javaToThrift(Reflection.callStatic(Operations.class, method, args.build()));
        }
    }
    if (Keys.isNavigationKey(key)) {
        Map<TObject, Set<Long>> index = timestamp == Time.NONE ? browse(store, key) : browse(store, key, timestamp);
        Set<Long> records = index.entrySet().stream().filter(e -> e.getKey().is(operator, values)).map(e -> e.getValue()).flatMap(Set::stream).collect(Collectors.toCollection(LinkedHashSet::new));
        return records;
    } else if (Keys.isFunctionKey(key)) {
        Set<Long> records = Sets.newLinkedHashSet();
        for (long record : store.getAllRecords()) {
            Set<TObject> aggregate = select(store, key, record, timestamp);
            for (TObject tobject : aggregate) {
                if (tobject.is(operator, values)) {
                    records.add(record);
                    break;
                }
            }
        }
        return records;
    } else {
        return timestamp == Time.NONE ? store.find(key, operator, values) : store.find(timestamp, key, operator, values);
    }
}
Also used : Function(com.cinchapi.ccl.type.Function) ArrayBuilder(com.cinchapi.common.base.ArrayBuilder) Source(com.cinchapi.concourse.server.ops.Strategy.Source) Store(com.cinchapi.concourse.server.storage.Store) AbstractSet(java.util.AbstractSet) AdHocIterator(com.cinchapi.common.base.AdHocIterator) HashMap(java.util.HashMap) IndexFunction(com.cinchapi.ccl.type.function.IndexFunction) Constants(com.cinchapi.concourse.Constants) AtomicReference(java.util.concurrent.atomic.AtomicReference) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) Calculations(com.cinchapi.concourse.server.calculate.Calculations) Reflection(com.cinchapi.common.reflect.Reflection) AtomicSupport(com.cinchapi.concourse.server.storage.AtomicSupport) ImmutableList(com.google.common.collect.ImmutableList) TObject(com.cinchapi.concourse.thrift.TObject) Convert(com.cinchapi.concourse.util.Convert) Keys(com.cinchapi.concourse.validate.Keys) TemporalFunction(com.cinchapi.ccl.type.function.TemporalFunction) Map(java.util.Map) Link(com.cinchapi.concourse.Link) LinkedHashSet(java.util.LinkedHashSet) Nullable(javax.annotation.Nullable) KeyType(com.cinchapi.concourse.validate.Keys.KeyType) Time(com.cinchapi.concourse.time.Time) ImmutableSet(com.google.common.collect.ImmutableSet) Iterator(java.util.Iterator) ImmutableMap(com.google.common.collect.ImmutableMap) Collection(java.util.Collection) Set(java.util.Set) KeyConditionFunction(com.cinchapi.ccl.type.function.KeyConditionFunction) MoreObjects(com.google.common.base.MoreObjects) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) AtomicOperation(com.cinchapi.concourse.server.storage.AtomicOperation) Operator(com.cinchapi.concourse.thrift.Operator) ForwardingMap(com.google.common.collect.ForwardingMap) Finder(com.cinchapi.concourse.server.query.Finder) Key(com.cinchapi.concourse.validate.Keys.Key) Type(com.cinchapi.concourse.thrift.Type) Queue(java.util.Queue) ArrayDeque(java.util.ArrayDeque) KeyValue(com.cinchapi.concourse.util.KeyValue) KeyRecordsFunction(com.cinchapi.ccl.type.function.KeyRecordsFunction) TObject(com.cinchapi.concourse.thrift.TObject) AbstractSet(java.util.AbstractSet) LinkedHashSet(java.util.LinkedHashSet) ImmutableSet(com.google.common.collect.ImmutableSet) Set(java.util.Set) KeyRecordsFunction(com.cinchapi.ccl.type.function.KeyRecordsFunction) TemporalFunction(com.cinchapi.ccl.type.function.TemporalFunction) Function(com.cinchapi.ccl.type.Function) IndexFunction(com.cinchapi.ccl.type.function.IndexFunction) TemporalFunction(com.cinchapi.ccl.type.function.TemporalFunction) KeyConditionFunction(com.cinchapi.ccl.type.function.KeyConditionFunction) KeyRecordsFunction(com.cinchapi.ccl.type.function.KeyRecordsFunction) IndexFunction(com.cinchapi.ccl.type.function.IndexFunction) TObject(com.cinchapi.concourse.thrift.TObject) KeyConditionFunction(com.cinchapi.ccl.type.function.KeyConditionFunction)

Example 29 with Store

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

the class Operations method browseNavigationKeyOptionalAtomic.

/**
 * Perform "browse" functionality on a navigation key.
 *
 * @param key
 * @param timestamp
 * @param store
 * @return a mapping from each possible destination value for a given
 *         navigation {@code key} to the records where the navigation could
 *         begin to retrieve the value by selecting the navigation
 *         {@code key}
 */
public static Map<TObject, Set<Long>> browseNavigationKeyOptionalAtomic(String key, long timestamp, Store store) {
    String[] toks = key.split("\\.");
    if (toks.length == 1) {
        return timestamp == Time.NONE ? store.browse(key) : store.browse(key, timestamp);
    } else {
        String start = toks[0];
        StringBuilder $key = new StringBuilder();
        for (int i = 1; i < toks.length - 1; ++i) {
            $key.append(toks[i]).append('.');
        }
        $key.append(toks[toks.length - 1]);
        Map<TObject, Set<Long>> root = timestamp == Time.NONE ? store.browse(start) : store.browse(start, timestamp);
        Map<TObject, Set<Long>> index = Maps.newLinkedHashMap();
        root.entrySet().stream().filter(e -> e.getKey().getType() == Type.LINK).forEach(entry -> {
            Link link = (Link) Convert.thriftToJava(entry.getKey());
            Set<Long> nodes = entry.getValue();
            for (long node : nodes) {
                Set<TObject> values = traverseKeyRecordOptionalAtomic($key.toString(), link.longValue(), timestamp, store);
                for (TObject value : values) {
                    index.computeIfAbsent(value, ignore -> Sets.newLinkedHashSet()).add(node);
                }
            }
        });
        return index;
    }
}
Also used : Navigation(com.cinchapi.concourse.util.Navigation) Page(com.cinchapi.concourse.lang.paginate.Page) Numbers(com.cinchapi.concourse.util.Numbers) AtomicStateException(com.cinchapi.concourse.server.storage.AtomicStateException) Constants(com.cinchapi.concourse.Constants) Paging(com.cinchapi.concourse.server.query.paginate.Paging) Calculations(com.cinchapi.concourse.server.calculate.Calculations) KeyRecordCalculation(com.cinchapi.concourse.server.calculate.KeyRecordCalculation) MultimapViews(com.cinchapi.concourse.util.MultimapViews) Convert(com.cinchapi.concourse.util.Convert) Map(java.util.Map) Link(com.cinchapi.concourse.Link) ImmutableSet(com.google.common.collect.ImmutableSet) Collection(java.util.Collection) ResolvableLink(com.cinchapi.concourse.util.Convert.ResolvableLink) Set(java.util.Set) AbstractSyntaxTree(com.cinchapi.ccl.syntax.AbstractSyntaxTree) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) AtomicOperation(com.cinchapi.concourse.server.storage.AtomicOperation) List(java.util.List) KeyCalculation(com.cinchapi.concourse.server.calculate.KeyCalculation) JsonArray(com.google.gson.JsonArray) Entry(java.util.Map.Entry) DeferredWrite(com.cinchapi.concourse.server.ConcourseServer.DeferredWrite) Type(com.cinchapi.concourse.thrift.Type) StringSplitter(com.cinchapi.common.base.StringSplitter) Sortable(com.cinchapi.concourse.data.sort.Sortable) Iterables(com.google.common.collect.Iterables) NoOrder(com.cinchapi.concourse.lang.sort.NoOrder) Sorting(com.cinchapi.concourse.server.query.sort.Sorting) Store(com.cinchapi.concourse.server.storage.Store) Multimap(com.google.common.collect.Multimap) Supplier(java.util.function.Supplier) ConcourseCompiler(com.cinchapi.concourse.lang.ConcourseCompiler) NoPage(com.cinchapi.concourse.lang.paginate.NoPage) LinkedHashMap(java.util.LinkedHashMap) JsonElement(com.google.gson.JsonElement) ParseException(com.cinchapi.concourse.thrift.ParseException) Lists(com.google.common.collect.Lists) TObject(com.cinchapi.concourse.thrift.TObject) GlobalState(com.cinchapi.concourse.server.GlobalState) TMaps(com.cinchapi.concourse.util.TMaps) NoSuchElementException(java.util.NoSuchElementException) Time(com.cinchapi.concourse.time.Time) Order(com.cinchapi.concourse.lang.sort.Order) Maps(com.google.common.collect.Maps) Finder(com.cinchapi.concourse.server.query.Finder) DataServices(com.cinchapi.concourse.util.DataServices) TObject(com.cinchapi.concourse.thrift.TObject) ImmutableSet(com.google.common.collect.ImmutableSet) Set(java.util.Set) Link(com.cinchapi.concourse.Link) ResolvableLink(com.cinchapi.concourse.util.Convert.ResolvableLink)

Example 30 with Store

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

the class ConcourseServer method findCriteria.

@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Set<Long> findCriteria(TCriteria criteria, AccessToken creds, TransactionToken transaction, String environment) throws TException {
    AbstractSyntaxTree ast = compiler.parse(criteria);
    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)

Aggregations

Store (com.cinchapi.concourse.server.storage.Store)67 TObject (com.cinchapi.concourse.thrift.TObject)67 Set (java.util.Set)67 Map (java.util.Map)66 Order (com.cinchapi.concourse.lang.sort.Order)64 Constants (com.cinchapi.concourse.Constants)57 Link (com.cinchapi.concourse.Link)57 Operator (com.cinchapi.concourse.thrift.Operator)57 Reflection (com.cinchapi.common.reflect.Reflection)56 AbstractSyntaxTree (com.cinchapi.ccl.syntax.AbstractSyntaxTree)55 ConcourseCompiler (com.cinchapi.concourse.lang.ConcourseCompiler)55 GlobalState (com.cinchapi.concourse.server.GlobalState)55 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 Timestamp (com.cinchapi.concourse.Timestamp)54 SortableColumn (com.cinchapi.concourse.data.sort.SortableColumn)54 SortableSet (com.cinchapi.concourse.data.sort.SortableSet)54 SortableTable (com.cinchapi.concourse.data.sort.SortableTable)54