@Override @RetryOnFailure(verbose = false, delay = Tv.FIVE, unit = TimeUnit.SECONDS) public Frame where(final String name, final Condition condition) { return new ReFrame(this.origin.where(name, condition)); }
@Override @RetryOnFailure(verbose = false, delay = Tv.FIVE, unit = TimeUnit.SECONDS) public Frame where(final String name, final Condition condition) { return new ReFrame(this.origin.where(name, condition)); }
@Override @RetryOnFailure(verbose = false, delay = Tv.FIVE, unit = TimeUnit.SECONDS) public Frame where(final Map<String, Condition> conditions) { return new ReFrame(this.origin.where(conditions)); }
@Override @RetryOnFailure(verbose = false, delay = Tv.FIVE, unit = TimeUnit.SECONDS) public Frame where(final String name, final String value) { return new ReFrame(this.origin.where(name, value)); }
@Override @RetryOnFailure(verbose = false, delay = Tv.FIVE, unit = TimeUnit.SECONDS) public Frame where(final String name, final String value) { return new ReFrame(this.origin.where(name, value)); }
@Override @RetryOnFailure(verbose = false, delay = Tv.FIVE, unit = TimeUnit.SECONDS) public Frame where(final Map<String, Condition> conditions) { return new ReFrame(this.origin.where(conditions)); }
@Override public String label(final String name) throws IOException { final Iterator<Item> items = this.table.frame() .through(new QueryValve()) .where(DyLocks.HASH, this.owner.toString()) .where(DyLocks.RANGE, name) .iterator(); String msg = ""; if (items.hasNext()) { msg = items.next().get(DyLocks.ATTR_LABEL).getS(); } return msg; } }
@Override @Cacheable.FlushBefore public boolean remove(@NotNull final Domain domain) { final Iterator<Item> items = this.region.table(this.table).frame() .where(DefaultDynamo.NAME, domain.name()) .through(new ScanValve().withLimit(Tv.MILLION)) .iterator(); boolean removed = false; while (items.hasNext()) { items.next(); items.remove(); removed = true; } return removed; }
@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 @Cacheable(lifetime = 1, unit = TimeUnit.HOURS) public Iterable<String> names() { return Iterables.transform( this.table.frame() .through(new QueryValve()) .where(DyCounters.HASH, Conditions.equalTo(this.owner)), new Function<Item, String>() { @Override public String apply(final Item item) { try { return item.get(DyCounters.RANGE).getS(); } catch (final IOException ex) { throw new IllegalStateException(ex); } } } ); } }
@Override @Cacheable(forever = true) public boolean exists() { return this.region.table(DefaultUser.TOKENS) .frame().through(new QueryValve()) .where(DefaultUser.HASH, Conditions.equalTo(this.name)) .iterator().hasNext(); }
@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(); }
@Override @Cacheable(lifetime = 1, unit = TimeUnit.HOURS) public String token() throws IOException { final Iterator<Item> items = this.region.table(DefaultUser.TOKENS) .frame().through(new QueryValve()) .where(DefaultUser.HASH, Conditions.equalTo(this.name)) .iterator(); final String token; if (items.hasNext()) { token = items.next().get(DefaultUser.ATTR_TOKEN).getS(); } else { this.refresh(); token = this.token(); } return token; }
/** * 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") ) ); }
}, this.table.frame() .where( "elements", new Condition()
}, this.table.frame() .where("version", new Version().value()) .through( new QueryValve()
.up(), this.table.frame() .where("version", new Version().value()) .through( new QueryValve()