Kudu C++ client API
|
Builds scan tokens for a table. More...
#include <client.h>
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 |
Builds scan tokens for a table.
|
explicit |
Construct an instance of the class.
[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. |
Status kudu::client::KuduScanTokenBuilder::AddConjunctPredicate | ( | KuduPredicate * | pred | ) |
Add a predicate for the scan.
[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. |
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.
[in] | key | Lower bound primary key to add. The KuduScanTokenBuilder instance does not take ownership of the parameter. |
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.
[in] | key | Upper bound primary key to add. The KuduScanTokenBuilder instance does not take ownership of the parameter. |
Status kudu::client::KuduScanTokenBuilder::Build | ( | std::vector< KuduScanToken * > * | tokens | ) |
Build the set of scan tokens.
The builder may be reused after this call.
[out] | tokens | Result set of tokens. The caller takes ownership of the container elements. |
Status kudu::client::KuduScanTokenBuilder::SetBatchSizeBytes | ( | uint32_t | batch_size | ) |
Set the hint for the size of the next batch in bytes.
[in] | batch_size | Batch size to set (in bytes). If set to 0, the first call to the tablet server won't return data. |
Status kudu::client::KuduScanTokenBuilder::SetCacheBlocks | ( | bool | cache_blocks | ) |
Set the block caching policy.
[in] | cache_blocks | If true , scanned data blocks will be cached in memory and made available for future scans. Default is true . |
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.
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().
[in] | col_indexes | Column indices for the projection. |
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().
[in] | col_names | Column names for the projection. |
Status kudu::client::KuduScanTokenBuilder::SetReadMode | ( | KuduScanner::ReadMode | read_mode | ) |
Set the ReadMode. Default is READ_LATEST
.
[in] | read_mode | Read mode to set. |
Status kudu::client::KuduScanTokenBuilder::SetSelection | ( | KuduClient::ReplicaSelection | selection | ) |
Set the replica selection policy while scanning.
[in] | selection | Selection policy to set. |
Status kudu::client::KuduScanTokenBuilder::SetSnapshotMicros | ( | uint64_t | snapshot_timestamp_micros | ) |
Set snapshot timestamp for scans in READ_AT_SNAPSHOT
mode.
[in] | snapshot_timestamp_micros | Timestamp to set in in microseconds since the Epoch. |
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.
[in] | snapshot_timestamp | Timestamp to set in raw encoded form (i.e. as returned by a previous call to a server). |
Status kudu::client::KuduScanTokenBuilder::SetTimeoutMillis | ( | int | millis | ) |
Set the maximum time that Open() and NextBatch() are allowed to take.
[in] | millis | Timeout to set (in milliseconds). Must be greater than 0. |