Package com.couchbase.client.java.kv
Class ScanType
- java.lang.Object
-
- com.couchbase.client.java.kv.ScanType
-
- Direct Known Subclasses:
RangeScan
,SamplingScan
@Volatile public abstract class ScanType extends Object
Specifies which documents to include in a KV scan.Create an instance using one of the static factory methods:
rangeScan()
- All documents.rangeScan(ScanTerm, ScanTerm)
- All documents whose IDs are in a certain range.prefixScan(String)
- All documents whose IDs have a certain prefix.samplingScan(long)
- A random sample of documents.
-
-
Constructor Summary
Constructors Constructor Description ScanType()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract CoreScanType
build()
static RangeScan
prefixScan(String documentIdPrefix)
Specifies a range scan that includes all documents whose IDs start with the given prefix.static RangeScan
rangeScan()
Specifies a range scan that includes all documents in the collection.static RangeScan
rangeScan(ScanTerm from, ScanTerm to)
Specifies a range scan that includes all documents whose IDs are between twoScanTerms
.static SamplingScan
samplingScan(long limit)
Creates a new KV sampling scan, which randomly selects documents up until the configured limit, with a random seed.static SamplingScan
samplingScan(long limit, long seed)
Creates a new KV sampling scan, which randomly selects documents up until the configured limit, with the specified seed.
-
-
-
Method Detail
-
rangeScan
public static RangeScan rangeScan()
Specifies a range scan that includes all documents in the collection.- Returns:
- a newly created
RangeScan
to be passed into the Collection API.
-
rangeScan
public static RangeScan rangeScan(ScanTerm from, ScanTerm to)
Specifies a range scan that includes all documents whose IDs are between twoScanTerms
.- Parameters:
from
- the start of the rangeto
- the end of the range- Returns:
- a newly created
RangeScan
to be passed into the Collection API.
-
prefixScan
public static RangeScan prefixScan(String documentIdPrefix)
Specifies a range scan that includes all documents whose IDs start with the given prefix.- Returns:
- a newly created
RangeScan
to be passed into the Collection API.
-
samplingScan
public static SamplingScan samplingScan(long limit)
Creates a new KV sampling scan, which randomly selects documents up until the configured limit, with a random seed.- Parameters:
limit
- the number of documents to limit sampling to.- Returns:
- a newly created
RangeScan
to be passed into the Collection API.
-
samplingScan
public static SamplingScan samplingScan(long limit, long seed)
Creates a new KV sampling scan, which randomly selects documents up until the configured limit, with the specified seed.- Parameters:
limit
- the number of documents to limit sampling to.seed
- seed for the random number generator that selects the documents. CAVEAT: Specifying the same seed does not guarantee the same documents are selected.- Returns:
- a newly created
RangeScan
to be passed into the Collection API.
-
build
public abstract CoreScanType build()
-
-