UNPKG

1.74 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.PrefixScan = exports.SamplingScan = exports.RangeScan = exports.ScanTerm = void 0;
4/**
5 * Represents a search term for a RangeScan.
6 *
7 * @see {@link RangeScan}
8 * @category Key-Value
9 */
10class ScanTerm {
11 /**
12 * @internal
13 */
14 constructor(term, exclusive) {
15 this.term = term;
16 this.exclusive = exclusive;
17 }
18}
19exports.ScanTerm = ScanTerm;
20/**
21 * A RangeScan performs a scan on a range of keys with the range specified through
22 * a start and end ScanTerm.
23 *
24 * @category Key-Value
25 */
26class RangeScan {
27 /**
28 * @internal
29 */
30 constructor(start, end) {
31 this.start = start;
32 this.end = end;
33 }
34 /**
35 * Returns string representation of scan type.
36 */
37 getScanType() {
38 return 'range_scan';
39 }
40}
41exports.RangeScan = RangeScan;
42/**
43 * A SamplingScan performs a scan on a random sampling of keys with the sampling bounded by
44 * a limit.
45 *
46 * @category Key-Value
47 */
48class SamplingScan {
49 /**
50 * @internal
51 */
52 constructor(limit, seed) {
53 this.limit = limit;
54 this.seed = seed;
55 }
56 /**
57 * Returns string representation of scan type.
58 */
59 getScanType() {
60 return 'sampling_scan';
61 }
62}
63exports.SamplingScan = SamplingScan;
64/**
65 * A PrefixScan scan type selects every document whose ID starts with a certain prefix.
66 *
67 * @category key-value
68 */
69class PrefixScan {
70 /**
71 * @internal
72 */
73 constructor(prefix) {
74 this.prefix = prefix;
75 }
76 /**
77 * Returns string representation of scan type.
78 */
79 getScanType() {
80 return 'prefix_scan';
81 }
82}
83exports.PrefixScan = PrefixScan;