kudu::client::KuduScanTokenBuilder Class Reference

Builds scan tokens for a table. More...

#include <client.h>

List of all members.

Public Member Functions

 KuduScanTokenBuilder (KuduTable *table)
Status SetProjectedColumnNames (const std::vector< std::string > &col_names) WARN_UNUSED_RESULT
Status SetProjectedColumnIndexes (const std::vector< int > &col_indexes) WARN_UNUSED_RESULT
Status AddConjunctPredicate (KuduPredicate *pred) WARN_UNUSED_RESULT
Status AddLowerBound (const KuduPartialRow &key) WARN_UNUSED_RESULT
Status AddUpperBound (const KuduPartialRow &key) WARN_UNUSED_RESULT
Status SetCacheBlocks (bool cache_blocks) WARN_UNUSED_RESULT
Status SetBatchSizeBytes (uint32_t batch_size) WARN_UNUSED_RESULT
Status SetSelection (KuduClient::ReplicaSelection selection) WARN_UNUSED_RESULT
Status SetReadMode (KuduScanner::ReadMode read_mode) WARN_UNUSED_RESULT
Status SetFaultTolerant () WARN_UNUSED_RESULT
Status SetSnapshotMicros (uint64_t snapshot_timestamp_micros) WARN_UNUSED_RESULT
Status SetSnapshotRaw (uint64_t snapshot_timestamp) WARN_UNUSED_RESULT
Status SetTimeoutMillis (int millis) WARN_UNUSED_RESULT
Status Build (std::vector< KuduScanToken * > *tokens) WARN_UNUSED_RESULT
std::string ToString () const

Detailed Description

Builds scan tokens for a table.

Note:
This class is not thread-safe.

Constructor & Destructor Documentation

kudu::client::KuduScanTokenBuilder::KuduScanTokenBuilder ( KuduTable table  )  [explicit]

Construct an instance of the class.

Parameters:
[in] table The table the tokens should scan. The given object must remain valid for the lifetime of the builder, and the tokens which it builds.

Member Function Documentation

Status kudu::client::KuduScanTokenBuilder::AddConjunctPredicate ( KuduPredicate pred  ) 

Add a predicate for the scan.

Parameters:
[in] pred Predicate to set. The KuduScanTokenBuilder instance takes ownership of the parameter even if a bad Status is returned. Multiple calls of this method make the specified set of predicates work in conjunction, i.e. all predicates must be true for a row to be returned.
Returns:
Operation result status.

Status kudu::client::KuduScanTokenBuilder::AddLowerBound ( const KuduPartialRow key  ) 

Add a lower bound (inclusive) primary key for the scan.If any bound is already added, this bound is intersected with that one.

Parameters:
[in] key Lower bound primary key to add. The KuduScanTokenBuilder instance does not take ownership of the parameter.
Returns:
Operation result status.

Status kudu::client::KuduScanTokenBuilder::AddUpperBound ( const KuduPartialRow key  ) 

Add an upper bound (exclusive) primary key.

If any bound is already added, this bound is intersected with that one.

Parameters:
[in] key Upper bound primary key to add. The KuduScanTokenBuilder instance does not take ownership of the parameter.
Returns:
Operation result status.
Status kudu::client::KuduScanTokenBuilder::Build ( std::vector< KuduScanToken * > *  tokens  ) 

Build the set of scan tokens.

The builder may be reused after this call.

Parameters:
[out] tokens Result set of tokens. The caller takes ownership of the container elements.
Returns:
Operation result status.
Status kudu::client::KuduScanTokenBuilder::SetBatchSizeBytes ( uint32_t  batch_size  ) 

Set the hint for the size of the next batch in bytes.

Parameters:
[in] batch_size Batch size to set (in bytes). If set to 0, the first call to the tablet server won't return data.
Returns:
Operation result status.
Status kudu::client::KuduScanTokenBuilder::SetCacheBlocks ( bool  cache_blocks  ) 

Set the block caching policy.

Parameters:
[in] cache_blocks If true, scanned data blocks will be cached in memory and made available for future scans. Default is true.
Returns:
Operation result status.

Status kudu::client::KuduScanTokenBuilder::SetFaultTolerant (  ) 

Make scans resumable at another tablet server if current server fails.Scans are by default non fault-tolerant, and scans will fail if scanning an individual tablet fails (for example, if a tablet server crashes in the middle of a tablet scan). If this method is called, scans will be resumed at another tablet server in the case of failure.Fault-tolerant scans typically have lower throughput than non fault-tolerant scans. Fault tolerant scans use READ_AT_SNAPSHOT mode: if no snapshot timestamp is provided, the server will pick one.

Returns:
Operation result status.

Status kudu::client::KuduScanTokenBuilder::SetProjectedColumnIndexes ( const std::vector< int > &  col_indexes  ) 

Set the column projection by passing the column indexes to read.Set the column projection used for this scanner by passing the column indices to read. A call to this method overrides any previous call to SetProjectedColumnNames() or SetProjectedColumnIndexes().

Parameters:
[in] col_indexes Column indices for the projection.
Returns:
Operation result status.

Status kudu::client::KuduScanTokenBuilder::SetProjectedColumnNames ( const std::vector< std::string > &  col_names  ) 

Set the column projection by passing the column names to read.

Set the column projection used for this scanner by passing the column names to read. A call of this method overrides any previous call to SetProjectedColumnNames() or SetProjectedColumnIndexes().

Parameters:
[in] col_names Column names for the projection.
Returns:
Operation result status.
Status kudu::client::KuduScanTokenBuilder::SetReadMode ( KuduScanner::ReadMode  read_mode  ) 

Set the ReadMode. Default is READ_LATEST.

Parameters:
[in] read_mode Read mode to set.
Returns:
Operation result status.

Status kudu::client::KuduScanTokenBuilder::SetSelection ( KuduClient::ReplicaSelection  selection  ) 

Set the replica selection policy while scanning.

Parameters:
[in] selection Selection policy to set.
Returns:
Operation result status.
Todo:
Kill this in favor of a consistency-level-based API.
Status kudu::client::KuduScanTokenBuilder::SetSnapshotMicros ( uint64_t  snapshot_timestamp_micros  ) 

Set snapshot timestamp for scans in READ_AT_SNAPSHOT mode.

Parameters:
[in] snapshot_timestamp_micros Timestamp to set in in microseconds since the Epoch.
Returns:
Operation result status.

Status kudu::client::KuduScanTokenBuilder::SetSnapshotRaw ( uint64_t  snapshot_timestamp  ) 

Set snapshot timestamp for scans in READ_AT_SNAPSHOT mode (raw).See KuduClient::GetLatestObservedTimestamp() for details on how to use this method to achieve Read-Your-Writes behavior.

Note:
This method is experimental and will either disappear or change in a future release.
Parameters:
[in] snapshot_timestamp Timestamp to set in raw encoded form (i.e. as returned by a previous call to a server).
Returns:
Operation result status.

Status kudu::client::KuduScanTokenBuilder::SetTimeoutMillis ( int  millis  ) 

Set the maximum time that Open() and NextBatch() are allowed to take.

Parameters:
[in] millis Timeout to set (in milliseconds). Must be greater than 0.
Returns:
Operation result status.

std::string kudu::client::KuduScanTokenBuilder::ToString (  )  const
Returns:
String representation of this scan.

The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines