/** * With scan index forward flag. * @param fwd Forward flag * @return New query valve * @see QueryRequest#withScanIndexForward(Boolean) * @checkstyle AvoidDuplicateLiterals (5 line) */ public QueryValve withScanIndexForward(final boolean fwd) { return new QueryValve( this.limit, fwd, Arrays.asList(this.attributes), this.index, this.select, this.consistent ); }
/** * Recent artifacts.. * @return List of them */ public Iterable<Iterable<Directive>> recent() { return new Mapped<>( item -> { final String[] parts = item.get("artifact").getS().split(":"); return new Directives() .add("repo") .add("group").set(parts[0]).up() .add("artifact").set(parts[1]).up() .up(); }, this.table.frame() .where("good", "true") .through( new QueryValve() .withScanIndexForward(false) .withIndexName("recent") .withConsistentRead(false) // @checkstyle MagicNumber (1 line) .withLimit(25) .withAttributesToGet("artifact") ) ); }
.where("version", new Version().value()) .through( new QueryValve() .withScanIndexForward(false) .withIndexName("mistakes") .withConsistentRead(false) .withLimit(20) .withSelect(Select.ALL_ATTRIBUTES)
final Iterator<Item> items = this.table.frame() .through( new QueryValve() .withLimit(1) .withSelect(Select.ALL_ATTRIBUTES)
@Override @Cacheable(lifetime = 1, unit = TimeUnit.HOURS) public Counter get(final String name) { return new DyCounter( this.table.frame() .through(new QueryValve().withLimit(1)) .where(DyCounters.HASH, Conditions.equalTo(this.owner)) .where(DyCounters.RANGE, Conditions.equalTo(name)) .iterator() .next() ); }
@Override public Map<String, String> names() { final ImmutableMap.Builder<String, String> map = new ImmutableMap.Builder<String, String>(); Iterables.all( this.table.frame().through( new QueryValve().withAttributesToGet( DyLocks.ATTR_LABEL ) ).where(DyLocks.HASH, Conditions.equalTo(this.owner)), new Predicate<Item>() { @Override public boolean apply(final Item item) { try { map.put( item.get(DyLocks.RANGE).getS(), item.get(DyLocks.ATTR_LABEL).getS() ); } catch (final IOException ex) { throw new IllegalStateException(ex); } return true; } } ); return map.build(); }
.where("version", new Version().value()) .through( new QueryValve() .withScanIndexForward(false) .withIndexName("ranks") .withConsistentRead(false) .withLimit(20) .withAttributesToGet( "artifact", "score", "diff", "defects", "classes", "elements", "rank"
final Iterator<Item> items = this.table.frame() .through( new QueryValve() .withLimit(1) .withSelect(Select.ALL_ATTRIBUTES) new QueryValve() .withLimit(1) .withSelect(Select.ALL_ATTRIBUTES) final Item fin = this.table.frame() .through( new QueryValve() .withLimit(1) .withSelect(Select.ALL_ATTRIBUTES)
@Override @Cacheable.FlushAfter public void delete(final String name) { Iterators.removeIf( this.table.frame() .through(new QueryValve().withLimit(1)) .where(DyCounters.HASH, Conditions.equalTo(this.owner)) .where(DyCounters.RANGE, Conditions.equalTo(name)) .iterator(), Predicates.alwaysTrue() ); }
/** * With scan index forward flag. * @param fwd Forward flag * @return New query valve * @see QueryRequest#withScanIndexForward(Boolean) * @checkstyle AvoidDuplicateLiterals (5 line) */ public QueryValve withScanIndexForward(final boolean fwd) { return new QueryValve( this.limit, fwd, Arrays.asList(this.attributes), this.index, this.select, this.consistent ); }
/** * With given limit. * @param lmt Limit to use * @return New query valve * @see QueryRequest#withLimit(Integer) * @checkstyle AvoidDuplicateLiterals (5 line) */ public QueryValve withLimit(final int lmt) { return new QueryValve( lmt, this.forward, Arrays.asList(this.attributes), this.index, this.select, this.consistent ); }
/** * With index name. * @param idx Index name * @return New query valve * @see QueryRequest#withIndexName(String) * @since 0.10.2 * @checkstyle AvoidDuplicateLiterals (5 line) */ public QueryValve withIndexName(final String idx) { return new QueryValve( this.limit, this.forward, Arrays.asList(this.attributes), idx, this.select, this.consistent ); }
/** * With consistent read. * @param cnst Consistent read * @return New query valve * @see QueryRequest#withConsistentRead(Boolean) * @since 0.12 * @checkstyle AvoidDuplicateLiterals (5 line) */ public QueryValve withConsistentRead(final boolean cnst) { return new QueryValve( this.limit, this.forward, Arrays.asList(this.attributes), this.index, this.select, cnst ); }
/** * With given limit. * @param lmt Limit to use * @return New query valve * @see QueryRequest#withLimit(Integer) * @checkstyle AvoidDuplicateLiterals (5 line) */ public QueryValve withLimit(final int lmt) { return new QueryValve( lmt, this.forward, Arrays.asList(this.attributes), this.index, this.select, this.consistent ); }
/** * With consistent read. * @param cnst Consistent read * @return New query valve * @see QueryRequest#withConsistentRead(Boolean) * @since 0.12 * @checkstyle AvoidDuplicateLiterals (5 line) */ public QueryValve withConsistentRead(final boolean cnst) { return new QueryValve( this.limit, this.forward, Arrays.asList(this.attributes), this.index, this.select, cnst ); }
/** * With index name. * @param idx Index name * @return New query valve * @see QueryRequest#withIndexName(String) * @since 0.10.2 * @checkstyle AvoidDuplicateLiterals (5 line) */ public QueryValve withIndexName(final String idx) { return new QueryValve( this.limit, this.forward, Arrays.asList(this.attributes), idx, this.select, this.consistent ); }
/** * With these extra attributes to pre-fetch. * @param names Name of attributes to pre-load * @return New query valve * @see QueryRequest#withAttributesToGet(Collection) * @checkstyle AvoidDuplicateLiterals (5 line) */ public QueryValve withAttributesToGet(final String... names) { return new QueryValve( this.limit, this.forward, Iterables.concat( Arrays.asList(this.attributes), Arrays.asList(names) ), this.index, this.select, this.consistent ); }
/** * With this extra attribute to pre-fetch. * @param name Name of attribute to pre-load * @return New query valve * @see QueryRequest#withAttributesToGet(Collection) * @checkstyle AvoidDuplicateLiterals (5 line) */ public QueryValve withAttributeToGet(final String name) { return new QueryValve( this.limit, this.forward, Iterables.concat( Arrays.asList(this.attributes), Collections.singleton(name) ), this.index, this.select, this.consistent ); }
/** * With this extra attribute to pre-fetch. * @param name Name of attribute to pre-load * @return New query valve * @see QueryRequest#withAttributesToGet(Collection) * @checkstyle AvoidDuplicateLiterals (5 line) */ public QueryValve withAttributeToGet(final String name) { return new QueryValve( this.limit, this.forward, Iterables.concat( Arrays.asList(this.attributes), Collections.singleton(name) ), this.index, this.select, this.consistent ); }
/** * With these extra attributes to pre-fetch. * @param names Name of attributes to pre-load * @return New query valve * @see QueryRequest#withAttributesToGet(Collection) * @checkstyle AvoidDuplicateLiterals (5 line) */ public QueryValve withAttributesToGet(final String... names) { return new QueryValve( this.limit, this.forward, Iterables.concat( Arrays.asList(this.attributes), Arrays.asList(names) ), this.index, this.select, this.consistent ); }