@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(); } }
public static Set<TObject> traverseKeyRecordOptionalAtomic(String key, long record, long timestamp, Store store) { String[] toks = key.split("\\."); Set<TObject> values = Sets.newLinkedHashSet(); Set<Long> nodes = ImmutableSet.of(record); for (int i = 0; i < toks.length; ++i) { key = toks[i]; Set<Long> descendents = Sets.newLinkedHashSet(); for (long node : nodes) { Set<TObject> $values = timestamp == Time.NONE ? store.select(key, node) : store.select(key, node, timestamp); if(i == toks.length - 1) { values.addAll($values); } else { for (TObject $value : $values) { if($value.getType() == Type.LINK) { descendents .add(((Link) Convert.thriftToJava($value)) .longValue()); } } } } nodes = descendents; } return values; }
Operations { public static Set<TObject> traverseKeyRecordOptionalAtomic(String key, long record, long timestamp, Store store) { String[] toks = key.split("\\."); Set<TObject> values = Sets.newLinkedHashSet(); Set<Long> nodes = ImmutableSet.of(record); for (int i = 0; i < toks.length; ++i) { key = toks[i]; Set<Long> descendents = Sets.newLinkedHashSet(); for (long node : nodes) { Set<TObject> $values = timestamp == Time.NONE ? store.select(key, node) : store.select(key, node, timestamp); if(i == toks.length - 1) { values.addAll($values); } else { for (TObject $value : $values) { if($value.getType() == Type.LINK) { descendents .add(((Link) Convert.thriftToJava($value)) .longValue()); } } } } nodes = descendents; } return values; } }
Operations { public static Set<TObject> traverseKeyRecordOptionalAtomic(String key, long record, long timestamp, Store store) { String[] toks = key.split("\\."); Set<TObject> values = Sets.newLinkedHashSet(); Set<Long> nodes = ImmutableSet.of(record); for (int i = 0; i < toks.length; ++i) { key = toks[i]; Set<Long> descendents = Sets.newLinkedHashSet(); for (long node : nodes) { Set<TObject> $values = timestamp == Time.NONE ? store.select(key, node) : store.select(key, node, timestamp); if(i == toks.length - 1) { values.addAll($values); } else { for (TObject $value : $values) { if($value.getType() == Type.LINK) { descendents .add(((Link) Convert.thriftToJava($value)) .longValue()); } } } } nodes = descendents; } return values; } private  Operations(); }
Operations { public static Set<TObject> traverseKeyRecordOptionalAtomic(String key, long record, long timestamp, Store store) { String[] toks = key.split("\\."); Set<TObject> values = Sets.newLinkedHashSet(); Set<Long> nodes = ImmutableSet.of(record); for (int i = 0; i < toks.length; ++i) { key = toks[i]; Set<Long> descendents = Sets.newLinkedHashSet(); for (long node : nodes) { Set<TObject> $values = timestamp == Time.NONE ? store.select(key, node) : store.select(key, node, timestamp); if(i == toks.length - 1) { values.addAll($values); } else { for (TObject $value : $values) { if($value.getType() == Type.LINK) { descendents .add(((Link) Convert.thriftToJava($value)) .longValue()); } } } } nodes = descendents; } return values; } private  Operations(); static void addIfEmptyAtomic(String key, TObject value, long record,
            AtomicOperation atomic); static Number avgKeyAtomic(String key, long timestamp, Store store); static Number avgKeyRecordAtomic(String key, long record,
            long timestamp, Store store); static Number avgKeyRecordsAtomic(String key,
            Collection<Long> records, long timestamp, Store store); static Map<TObject, Set<Long>> browseNavigationKeyOptionalAtomic(
            String key, long timestamp, Store store); static void clearKeyRecordAtomic(String key, long record,
            AtomicOperation atomic); static void clearRecordAtomic(long record, AtomicOperation atomic); static long countKeyAtomic(String key, long timestamp, Store store); static long countKeyRecordAtomic(String key, long record,
            long timestamp, Store store); static long countKeyRecordsAtomic(String key,
            Collection<Long> records, long timestamp, Store store); static void findOrInsertAtomic(Set<Long> records,
            List<Multimap<String, Object>> objects, AbstractSyntaxTree ast,
            AtomicOperation atomic); static void getAstAtomic(
            AbstractSyntaxTree ast, long timestamp, M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, AtomicOperation atomic); static void getKeyAstAtomic(
            String key, AbstractSyntaxTree ast, long timestamp, M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, AtomicOperation atomic); static void getKeyRecordsAtomic(
            String key, Collection<Long> records, M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, AtomicOperation atomic); static void getKeyRecordsOptionalAtomic(
            String key, Collection<Long> records, long timestamp, M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, Store store); static void getKeysAstAtomic(
            Collection<String> keys, AbstractSyntaxTree ast, long timestamp,
            M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, AtomicOperation atomic); static void getKeysRecordsAtomic(
            Collection<String> keys, Collection<Long> records, M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, AtomicOperation atomic); static void getKeysRecordsOptionalAtomic(
            Collection<String> keys, Collection<Long> records, long timestamp,
            M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, Store store); static void getRecordsAtomic(
            Set<Long> records, M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, AtomicOperation atomic); static void getRecordsOptionalAtomic(
            Set<Long> records, long timestamp, M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, Store store); static boolean insertAtomic(Multimap<String, Object> data,
            long record, AtomicOperation atomic, List<DeferredWrite> deferred); static boolean insertDeferredAtomic(List<DeferredWrite> deferred,
            AtomicOperation atomic); static String jsonify(List<Long> records, long timestamp,
            boolean includeId, Store store); static Number maxKeyRecordAtomic(String key, long record,
            long timestamp, Store store); static Number maxKeyRecordsAtomic(String key,
            Collection<Long> records, long timestamp, Store store); static Number minKeyRecordAtomic(String key, long record,
            long timestamp, Store store); static Number minKeyRecordsAtomic(String key,
            Collection<Long> records, long timestamp, Store store); @Deprecated static Map<Long, Set<TObject>> navigateKeyRecordAtomic(String key,
            long record, long timestamp, AtomicOperation atomic); @Deprecated static Map<Long, Set<TObject>> navigateKeyRecordsAtomic(String key,
            Set<Long> records, long timestamp, AtomicOperation atomic); @Deprecated static Map<Long, Map<String, Set<TObject>>> navigateKeysRecordAtomic(
            List<String> keys, long record, long timestamp,
            AtomicOperation atomic); @Deprecated static Map<Long, Map<String, Set<TObject>>> navigateKeysRecordsAtomic(
            List<String> keys, Set<Long> records, long timestamp,
            AtomicOperation atomic); static boolean ping(long record, Store store); static void revertAtomic(String key, long record, long timestamp,
            AtomicOperation atomic); static void selectAstAtomic(
            AbstractSyntaxTree ast, long timestamp, M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, AtomicOperation atomic); static void selectKeyAstAtomic(
            String key, AbstractSyntaxTree ast, long timestamp, M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, AtomicOperation atomic); static void selectKeyRecordsAtomic(
            String key, Collection<Long> records, M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, AtomicOperation atomic); static void selectKeyRecordsOptionalAtomic(
            String key, Collection<Long> records, long timestamp, M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, Store store); static void selectKeysAstAtomic(
            Collection<String> keys, AbstractSyntaxTree ast, long timestamp,
            M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, AtomicOperation atomic); static void selectKeysRecordsAtomic(
            Collection<String> keys, Collection<Long> records, M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, AtomicOperation atomic); static void selectKeysRecordsOptionalAtomic(
            Collection<String> keys, Collection<Long> records, long timestamp,
            M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, Store store); static void selectRecordsAtomic(
            Collection<Long> records, M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, AtomicOperation atomic); static void selectRecordsOptionalAtomic(
            Collection<Long> records, long timestamp, M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, Store store); static Number sumKeyAtomic(String key, long timestamp, Store store); static Number sumKeyRecordAtomic(String key, long record,
            long timestamp, Store store); static Number sumKeyRecordsAtomic(String key,
            Collection<Long> records, long timestamp, Store store); static Map<String, Set<Long>> traceRecordAtomic(long record,
            long timestamp, AtomicOperation atomic); static Map<Long, Map<String, Set<Long>>> traceRecordsAtomic(
            Collection<Long> records, long timestamp, AtomicOperation atomic); static Set<TObject> traverseKeyRecordOptionalAtomic(String key,
            long record, long timestamp, Store store); static Map<Long, Set<TObject>> traverseKeyRecordsOptionalAtomic(
            String key, Collection<Long> records, long timestamp, Store store); static Map<String, Set<TObject>> traverseKeysRecordOptionalAtomic(
            Collection<String> keys, long record, long timestamp, Store store); static Map<Long, Map<String, Set<TObject>>> traverseKeysRecordsAtomic(
            Collection<String> keys, Collection<Long> records, long timestamp,
            Store store); }
Operations { public static Set<TObject> traverseKeyRecordOptionalAtomic(String key, long record, long timestamp, Store store) { String[] toks = key.split("\\."); Set<TObject> values = Sets.newLinkedHashSet(); Set<Long> nodes = ImmutableSet.of(record); for (int i = 0; i < toks.length; ++i) { key = toks[i]; Set<Long> descendents = Sets.newLinkedHashSet(); for (long node : nodes) { Set<TObject> $values = timestamp == Time.NONE ? store.select(key, node) : store.select(key, node, timestamp); if(i == toks.length - 1) { values.addAll($values); } else { for (TObject $value : $values) { if($value.getType() == Type.LINK) { descendents .add(((Link) Convert.thriftToJava($value)) .longValue()); } } } } nodes = descendents; } return values; } private  Operations(); static void addIfEmptyAtomic(String key, TObject value, long record,
            AtomicOperation atomic); static Number avgKeyAtomic(String key, long timestamp, Store store); static Number avgKeyRecordAtomic(String key, long record,
            long timestamp, Store store); static Number avgKeyRecordsAtomic(String key,
            Collection<Long> records, long timestamp, Store store); static Map<TObject, Set<Long>> browseNavigationKeyOptionalAtomic(
            String key, long timestamp, Store store); static void clearKeyRecordAtomic(String key, long record,
            AtomicOperation atomic); static void clearRecordAtomic(long record, AtomicOperation atomic); static long countKeyAtomic(String key, long timestamp, Store store); static long countKeyRecordAtomic(String key, long record,
            long timestamp, Store store); static long countKeyRecordsAtomic(String key,
            Collection<Long> records, long timestamp, Store store); static void findOrInsertAtomic(Set<Long> records,
            List<Multimap<String, Object>> objects, AbstractSyntaxTree ast,
            AtomicOperation atomic); static void getAstAtomic(
            AbstractSyntaxTree ast, long timestamp, M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, AtomicOperation atomic); static void getKeyAstAtomic(
            String key, AbstractSyntaxTree ast, long timestamp, M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, AtomicOperation atomic); static void getKeyRecordsAtomic(
            String key, Collection<Long> records, M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, AtomicOperation atomic); static void getKeyRecordsOptionalAtomic(
            String key, Collection<Long> records, long timestamp, M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, Store store); static void getKeysAstAtomic(
            Collection<String> keys, AbstractSyntaxTree ast, long timestamp,
            M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, AtomicOperation atomic); static void getKeysRecordsAtomic(
            Collection<String> keys, Collection<Long> records, M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, AtomicOperation atomic); static void getKeysRecordsOptionalAtomic(
            Collection<String> keys, Collection<Long> records, long timestamp,
            M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, Store store); static void getRecordsAtomic(
            Set<Long> records, M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, AtomicOperation atomic); static void getRecordsOptionalAtomic(
            Set<Long> records, long timestamp, M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, Store store); static boolean insertAtomic(Multimap<String, Object> data,
            long record, AtomicOperation atomic, List<DeferredWrite> deferred); static boolean insertDeferredAtomic(List<DeferredWrite> deferred,
            AtomicOperation atomic); static String jsonify(List<Long> records, long timestamp,
            boolean includeId, Store store); static Number maxKeyRecordAtomic(String key, long record,
            long timestamp, Store store); static Number maxKeyRecordsAtomic(String key,
            Collection<Long> records, long timestamp, Store store); static Number minKeyRecordAtomic(String key, long record,
            long timestamp, Store store); static Number minKeyRecordsAtomic(String key,
            Collection<Long> records, long timestamp, Store store); @Deprecated static Map<Long, Set<TObject>> navigateKeyRecordAtomic(String key,
            long record, long timestamp, AtomicOperation atomic); @Deprecated static Map<Long, Set<TObject>> navigateKeyRecordsAtomic(String key,
            Set<Long> records, long timestamp, AtomicOperation atomic); @Deprecated static Map<Long, Map<String, Set<TObject>>> navigateKeysRecordAtomic(
            List<String> keys, long record, long timestamp,
            AtomicOperation atomic); @Deprecated static Map<Long, Map<String, Set<TObject>>> navigateKeysRecordsAtomic(
            List<String> keys, Set<Long> records, long timestamp,
            AtomicOperation atomic); static boolean ping(long record, Store store); static void revertAtomic(String key, long record, long timestamp,
            AtomicOperation atomic); static void selectAstAtomic(
            AbstractSyntaxTree ast, long timestamp, M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, AtomicOperation atomic); static void selectKeyAstAtomic(
            String key, AbstractSyntaxTree ast, long timestamp, M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, AtomicOperation atomic); static void selectKeyRecordsAtomic(
            String key, Collection<Long> records, M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, AtomicOperation atomic); static void selectKeyRecordsOptionalAtomic(
            String key, Collection<Long> records, long timestamp, M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, Store store); static void selectKeysAstAtomic(
            Collection<String> keys, AbstractSyntaxTree ast, long timestamp,
            M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, AtomicOperation atomic); static void selectKeysRecordsAtomic(
            Collection<String> keys, Collection<Long> records, M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, AtomicOperation atomic); static void selectKeysRecordsOptionalAtomic(
            Collection<String> keys, Collection<Long> records, long timestamp,
            M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, Store store); static void selectRecordsAtomic(
            Collection<Long> records, M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, AtomicOperation atomic); static void selectRecordsOptionalAtomic(
            Collection<Long> records, long timestamp, M result,
            @Nullable Function<Iterable<Long>, Iterable<Long>> streamer,
            @Nullable Consumer<M> consumer, Store store); static Number sumKeyAtomic(String key, long timestamp, Store store); static Number sumKeyRecordAtomic(String key, long record,
            long timestamp, Store store); static Number sumKeyRecordsAtomic(String key,
            Collection<Long> records, long timestamp, Store store); static Map<String, Set<Long>> traceRecordAtomic(long record,
            long timestamp, AtomicOperation atomic); static Map<Long, Map<String, Set<Long>>> traceRecordsAtomic(
            Collection<Long> records, long timestamp, AtomicOperation atomic); static Set<TObject> traverseKeyRecordOptionalAtomic(String key,
            long record, long timestamp, Store store); static Map<Long, Set<TObject>> traverseKeyRecordsOptionalAtomic(
            String key, Collection<Long> records, long timestamp, Store store); static Map<String, Set<TObject>> traverseKeysRecordOptionalAtomic(
            Collection<String> keys, long record, long timestamp, Store store); static Map<Long, Map<String, Set<TObject>>> traverseKeysRecordsAtomic(
            Collection<String> keys, Collection<Long> records, long timestamp,
            Store store);  }