Class ScanOptions

java.lang.Object
com.couchbase.client.java.CommonOptions<ScanOptions>
com.couchbase.client.java.kv.ScanOptions

@Volatile public class ScanOptions extends CommonOptions<ScanOptions>
Allows to customize the various range and sampling scan options.
  • Method Details

    • scanOptions

      public static ScanOptions scanOptions()
    • idsOnly

      public ScanOptions idsOnly(boolean idsOnly)
      If set to true, the content of the document is not included in the results.
      Parameters:
      idsOnly - True means document content and metadata are excluded from result; default is false.
      Returns:
      the ScanOptions to allow method chaining.
    • transcoder

      public ScanOptions transcoder(Transcoder transcoder)
      Allows to specify a custom transcoder that is used to decode the content of the result.
      Parameters:
      transcoder - the custom transcoder that should be used for decoding.
      Returns:
      the ScanOptions to allow method chaining.
    • consistentWith

      public ScanOptions consistentWith(MutationState mutationState)
    • batchByteLimit

      public ScanOptions batchByteLimit(int batchByteLimit)
      Allows to limit the maximum amount of bytes that are sent from the server to the client on each partition batch.

      This option:

      • will be applied to each partition stream individually, not to the operation as a whole.
      • only acts as a target the server aims to satisfy, not a hard limit.
      The SDK will maintain one stream for each partition and aggregate the results for the user. The limit set here will affect each individual partition and allows to optimize performance with larger batches. Keep in mind that a larger value is not always better since sockets will be occupied for a longer time and might have a negative latency impact on other operations that are waiting.

      Also, the server will always send the document body, even if the configured byte limit is smaller. So as an example if a batchByteLimit of 1MB (1_000_000) is set and the document body size is 5MB it will still be sent to the client as a whole and not cut off in between.

      If both this option and batchItemLimit(int) are set, both will be sent to the server and the smaller one will trigger first.

      Parameters:
      batchByteLimit - the byte limit to set per stream, defaults to 15000 (15k).
      Returns:
      the ScanOptions to allow method chaining.
    • batchItemLimit

      public ScanOptions batchItemLimit(int batchItemLimit)
      Allows to limit the maximum amount of documents that are sent from the server to the client on each partition batch.

      This option:

      • will be applied to each partition stream individually, not to the operation as a whole.
      The SDK will maintain one stream for each partition and aggregate the results for the user. The limit set here will affect each individual partition and allows to optimize performance with larger batches. Keep in mind that a larger value is not always better since sockets will be occupied for a longer time and might have a negative latency impact on other operations that are waiting.

      If both this option and batchByteLimit(int) are set, both will be sent to the server and the smaller one will trigger first.

      Parameters:
      batchItemLimit - the item limit to set per stream, defaults to 50.
      Returns:
      the ScanOptions to allow method chaining.
    • build

      @Internal public ScanOptions.Built build()