use of com.yahoo.documentapi.ProgressToken in project vespa by vespa-engine.
the class ContinuationHitTest method createMultiBucketProgress.
/**
* Returns a ProgressToken whose base 64 representation will be _more_ than 76 bytes (MIME line limit)
*/
private ProgressToken createMultiBucketProgress() {
ProgressToken token = new ProgressToken(16);
Set<BucketId> buckets = new TreeSet<>();
buckets.add(new BucketId(58, 0x123456789abcfeffL));
buckets.add(new BucketId(58, 0x123456789abcfefaL));
buckets.add(new BucketId(58, 0x123456789abcfefbL));
// "Prime" the token.
VisitorIterator.createFromExplicitBucketSet(buckets, 16, token);
return token;
}
use of com.yahoo.documentapi.ProgressToken in project vespa by vespa-engine.
the class ContinuationHitTest method createSingleBucketProgress.
/**
* Returns a ProgressToken whose base 64 representation will be _less_ than 76 bytes (MIME line limit)
*/
private ProgressToken createSingleBucketProgress() {
ProgressToken token = new ProgressToken(16);
// Use explicit bucket set so we can better control the binary representation
// of the buckets, and thus the values written as base 64.
Set<BucketId> buckets = new TreeSet<>();
// This particular bucket ID will contain +/ chars when output as non-URL safe base 64.
buckets.add(new BucketId(58, 0x123456789abcfeffL));
// "Prime" the token.
VisitorIterator.createFromExplicitBucketSet(buckets, 16, token);
return token;
}
use of com.yahoo.documentapi.ProgressToken in project vespa by vespa-engine.
the class ContinuationHitTest method decodingAcceptsUrlSafeTokens.
@Test
public void decodingAcceptsUrlSafeTokens() throws Exception {
final ProgressToken token = ContinuationHit.getToken(SINGLE_BUCKET_URL_SAFE_BASE64);
// Roundtrip should yield identical results.
assertEquals(SINGLE_BUCKET_URL_SAFE_BASE64, new ContinuationHit(token).getValue());
}
use of com.yahoo.documentapi.ProgressToken in project vespa by vespa-engine.
the class VisitorIteratorTestCase method testExplicitDistributionImportNoTruncation.
public void testExplicitDistributionImportNoTruncation() throws ParseException {
BucketIdFactory idFactory = new BucketIdFactory();
ProgressToken p = new ProgressToken();
VisitorIterator iter = VisitorIterator.createFromDocumentSelection("id.user == 1234 or id.user == 6789 or id.user == 8009", idFactory, 20, p);
assertEquals(20, iter.getDistributionBitCount());
assertEquals(20, p.getDistributionBitCount());
assertEquals(20, iter.getBucketSource().getDistributionBitCount());
iter.update(iter.getNext().getSuperbucket(), ProgressToken.FINISHED_BUCKET);
// Make sure no truncation is done on import
String serialized = p.toString();
ProgressToken p2 = new ProgressToken(serialized);
BucketIdFactory idFactory2 = new BucketIdFactory();
VisitorIterator iter2 = VisitorIterator.createFromDocumentSelection("id.user == 1234 or id.user == 6789 or id.user == 8009", idFactory2, 1, p2);
assertEquals(20, iter2.getDistributionBitCount());
assertEquals(20, p2.getDistributionBitCount());
assertEquals(20, iter2.getBucketSource().getDistributionBitCount());
assertEquals(2, p2.getPendingBucketCount());
assertEquals(1, p2.getFinishedBucketCount());
assertEquals(3, p2.getTotalBucketCount());
}
use of com.yahoo.documentapi.ProgressToken in project vespa by vespa-engine.
the class VisitorIteratorTestCase method testExplicitDistributionBitIncrease.
public void testExplicitDistributionBitIncrease() throws ParseException {
int distBits = 12;
BucketIdFactory idFactory = new BucketIdFactory();
ProgressToken p = new ProgressToken();
VisitorIterator iter = VisitorIterator.createFromDocumentSelection("id.user == 1234 or id.user == 6789 or id.user == 8009", idFactory, distBits, p);
assertEquals(iter.getDistributionBitCount(), distBits);
assertEquals(p.getDistributionBitCount(), distBits);
assertEquals(iter.getBucketSource().getDistributionBitCount(), distBits);
iter.update(iter.getNext().getSuperbucket(), ProgressToken.FINISHED_BUCKET);
iter.setDistributionBitCount(16);
assertEquals(iter.getDistributionBitCount(), 16);
assertEquals(p.getDistributionBitCount(), 16);
assertEquals(iter.getBucketSource().getDistributionBitCount(), 16);
// Changing dist bits for explicit source should change nothing
assertEquals(p.getPendingBucketCount(), 2);
assertEquals(p.getFinishedBucketCount(), 1);
assertEquals(p.getTotalBucketCount(), 3);
}
Aggregations