/** * With given limit. * @param lmt Limit to use * @return New query valve */ public ScanValve withLimit(final int lmt) { return new ScanValve(lmt, Arrays.asList(this.attributes)); }
@Override @NotNull @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") @Cacheable(lifetime = Tv.FIVE, unit = TimeUnit.MINUTES) public ConcurrentMap<URN, Domains> load() throws IOException { final ConcurrentMap<URN, Domains> domains = new ConcurrentHashMap<URN, Domains>(0); final Iterable<Item> items = this.region .table(this.table) .frame() .through( new ScanValve().withAttributeToGet( DefaultDynamo.USER, DefaultDynamo.NAME, DefaultDynamo.KEY, DefaultDynamo.SECRET, DefaultDynamo.BUCKET, DefaultDynamo.REGION, DefaultDynamo.SYSLOG ).withLimit(Tv.MILLION) ); for (final Item item : items) { final URN user = URN.create(item.get(DefaultDynamo.USER).getS()); domains.putIfAbsent(user, new Domains()); domains.get(user).add(DefaultDynamo.domain(item)); } return domains; }
@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; }
new ScanValve() .withLimit(1000) .withAttributeToGet( "artifact", "classes", "defects", "version", "rank", "score", "elements"
/** * With given limit. * @param lmt Limit to use * @return New query valve */ public ScanValve withLimit(final int lmt) { return new ScanValve(lmt, Arrays.asList(this.attributes)); }
/** * With this extra attribute to pre-fetch. * @param name Name of attribute to pre-load * @return New query valve */ public ScanValve withAttributeToGet(final String name) { return new ScanValve( this.limit, Iterables.concat( Arrays.asList(this.attributes), Collections.singletonList(name) ) ); }
/** * With this extra attribute to pre-fetch. * @param name Name of attribute to pre-load * @return New query valve */ public ScanValve withAttributeToGet(final String name) { return new ScanValve( this.limit, Iterables.concat( Arrays.asList(this.attributes), Collections.singletonList(name) ) ); }
/** * With these extra attributes to pre-fetch. * @param names Name of attributes to pre-load * @return New query valve */ public ScanValve withAttributeToGet(final String... names) { return new ScanValve( this.limit, Iterables.concat( Arrays.asList(this.attributes), Arrays.asList(names) ) ); }
/** * With these extra attributes to pre-fetch. * @param names Name of attributes to pre-load * @return New query valve */ public ScanValve withAttributeToGet(final String... names) { return new ScanValve( this.limit, Iterables.concat( Arrays.asList(this.attributes), Arrays.asList(names) ) ); }
/** * Public ctor. * @param creds Credentials * @param table Table * @param label Table name */ AwsFrame(final Credentials creds, final AwsTable table, final String label) { this(creds, table, label, new Conditions(), new ScanValve()); }
/** * Public ctor. * @param creds Credentials * @param table Table * @param label Table name */ AwsFrame(final Credentials creds, final AwsTable table, final String label) { this(creds, table, label, new Conditions(), new ScanValve()); }