Kudu C++ client API
client.h
1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing,
12 // software distributed under the License is distributed on an
13 // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 // KIND, either express or implied. See the License for the
15 // specific language governing permissions and limitations
16 // under the License.
17 
24 
25 #ifndef KUDU_CLIENT_CLIENT_H
26 #define KUDU_CLIENT_CLIENT_H
27 
28 #include <stdint.h>
29 
30 #include <cstddef>
31 #include <string>
32 #include <vector>
33 
34 #include "kudu/client/row_result.h"
35 #include "kudu/client/scan_predicate.h"
36 #include "kudu/client/schema.h"
37 #include "kudu/client/shared_ptr.h" // IWYU pragma: keep
38 #ifdef KUDU_HEADERS_NO_STUBS
39 #include <gtest/gtest_prod.h>
40 
41 #include "kudu/gutil/macros.h"
42 #include "kudu/gutil/port.h"
43 #else
44 #include "kudu/client/stubs.h"
45 #endif
46 #include "kudu/util/kudu_export.h"
47 #include "kudu/util/slice.h"
48 #include "kudu/util/status.h"
49 
50 namespace kudu {
51 
52 class ClientStressTest_TestUniqueClientIds_Test;
53 class KuduPartialRow;
54 class MonoDelta;
55 class PartitionSchema;
56 class SecurityUnknownTskTest;
57 
58 namespace client {
59 class KuduClient;
60 class KuduTableAlterer;
61 }
62 
63 namespace tools {
64 class LeaderMasterProxy;
65 std::string GetMasterAddresses(const client::KuduClient&);
66 } // namespace tools
67 
68 namespace client {
69 
70 class KuduDelete;
71 class KuduInsert;
72 class KuduLoggingCallback;
73 class KuduPartitioner;
74 class KuduScanBatch;
75 class KuduSession;
76 class KuduStatusCallback;
77 class KuduTable;
78 class KuduTableCreator;
79 class KuduTablet;
80 class KuduTabletServer;
81 class KuduUpdate;
82 class KuduUpsert;
83 class KuduValue;
84 class KuduWriteOperation;
85 class ResourceMetrics;
86 
87 namespace internal {
88 class Batcher;
89 class ErrorCollector;
90 class GetTableSchemaRpc;
91 class LookupRpc;
92 class MetaCache;
93 class RemoteTablet;
94 class RemoteTabletServer;
95 class ReplicaController;
96 class WriteRpc;
97 } // namespace internal
98 
111 void KUDU_EXPORT InstallLoggingCallback(KuduLoggingCallback* cb);
112 
119 void KUDU_EXPORT UninstallLoggingCallback();
120 
136 void KUDU_EXPORT SetVerboseLogLevel(int level);
137 
147 Status KUDU_EXPORT SetInternalSignalNumber(int signum);
148 
160 Status KUDU_EXPORT DisableSaslInitialization();
161 
162 
185 Status KUDU_EXPORT DisableOpenSSLInitialization();
186 
189 std::string KUDU_EXPORT GetShortVersionString();
190 
193 std::string KUDU_EXPORT GetAllVersionInfo();
194 
199 class KUDU_EXPORT KuduClientBuilder {
200  public:
203 
207  KuduClientBuilder& clear_master_server_addrs();
208 
214  KuduClientBuilder& master_server_addrs(const std::vector<std::string>& addrs);
215 
223  KuduClientBuilder& add_master_server_addr(const std::string& addr);
224 
234  KuduClientBuilder& default_admin_operation_timeout(const MonoDelta& timeout);
235 
243  KuduClientBuilder& default_rpc_timeout(const MonoDelta& timeout);
244 
252  KuduClientBuilder& import_authentication_credentials(std::string authn_creds);
253 
263  KuduClientBuilder& num_reactors(int num_reactors);
264 
275  Status Build(sp::shared_ptr<KuduClient>* client);
276 
277  private:
278  class KUDU_NO_EXPORT Data;
279 
280  friend class internal::ReplicaController;
281 
282  // Owned.
283  Data* data_;
284 
285  DISALLOW_COPY_AND_ASSIGN(KuduClientBuilder);
286 };
287 
314 class KUDU_EXPORT KuduClient : public sp::enable_shared_from_this<KuduClient> {
315  public:
316  ~KuduClient();
317 
322  KuduTableCreator* NewTableCreator();
323 
332  Status IsCreateTableInProgress(const std::string& table_name,
333  bool* create_in_progress);
334 
340  Status DeleteTable(const std::string& table_name);
341 
350  Status DeleteTableInCatalogs(const std::string& table_name,
351  bool modify_external_catalogs) KUDU_NO_EXPORT;
352 
359  KuduTableAlterer* NewTableAlterer(const std::string& table_name);
360 
369  Status IsAlterTableInProgress(const std::string& table_name,
370  bool* alter_in_progress);
378  Status GetTableSchema(const std::string& table_name,
379  KuduSchema* schema);
380 
387  Status ListTabletServers(std::vector<KuduTabletServer*>* tablet_servers);
388 
396  Status ListTables(std::vector<std::string>* tables,
397  const std::string& filter = "");
398 
406  Status TableExists(const std::string& table_name, bool* exists);
407 
424  Status OpenTable(const std::string& table_name,
425  sp::shared_ptr<KuduTable>* table);
426 
432  sp::shared_ptr<KuduSession> NewSession();
433 
435 
448  Status GetTablet(const std::string& tablet_id,
449  KuduTablet** tablet) KUDU_NO_EXPORT;
450 
452 
456 
457  CLOSEST_REPLICA,
458 
460  FIRST_REPLICA
461  };
462 
465  bool IsMultiMaster() const;
466 
468  const MonoDelta& default_admin_operation_timeout() const;
469 
471  const MonoDelta& default_rpc_timeout() const;
472 
475  static const uint64_t kNoTimestamp;
476 
516  uint64_t GetLatestObservedTimestamp() const;
517 
532  void SetLatestObservedTimestamp(uint64_t ht_timestamp);
533 
545  Status ExportAuthenticationCredentials(std::string* authn_creds) const;
546 
547  // @return the configured Hive Metastore URIs on the most recently connected to
548  // leader master, or an empty string if the Hive Metastore integration is not
549  // enabled.
550  std::string GetHiveMetastoreUris() const KUDU_NO_EXPORT;
551 
552  // @return the configured Hive Metastore SASL (Kerberos) configuration on the most
553  // recently connected to leader master, or an arbitrary value if the Hive
554  // Metastore integration is not enabled.
555  bool GetHiveMetastoreSaslEnabled() const KUDU_NO_EXPORT;
556 
557  // @return a unique ID which identifies the Hive Metastore instance, if the
558  // cluster is configured with the Hive Metastore integration, or an
559  // arbitrary value if the Hive Metastore integration is not enabled.
560  //
561  // @note this is provided on a best-effort basis, as not all Hive Metastore
562  // versions which Kudu is compatible with include the necessary APIs. See
563  // HIVE-16452 for more info.
564  std::string GetHiveMetastoreUuid() const KUDU_NO_EXPORT;
565 
566  private:
567  class KUDU_NO_EXPORT Data;
568 
569  friend class ClientTest;
570  friend class ConnectToClusterBaseTest;
571  friend class KuduClientBuilder;
572  friend class KuduPartitionerBuilder;
573  friend class KuduScanToken;
574  friend class KuduScanTokenBuilder;
575  friend class KuduScanner;
576  friend class KuduSession;
577  friend class KuduTable;
578  friend class KuduTableAlterer;
579  friend class KuduTableCreator;
580  friend class internal::Batcher;
581  friend class internal::GetTableSchemaRpc;
582  friend class internal::LookupRpc;
583  friend class internal::MetaCache;
584  friend class internal::RemoteTablet;
585  friend class internal::RemoteTabletServer;
586  friend class internal::WriteRpc;
587  friend class kudu::SecurityUnknownTskTest;
588  friend class tools::LeaderMasterProxy;
589  friend std::string tools::GetMasterAddresses(const client::KuduClient&);
590 
591  FRIEND_TEST(kudu::ClientStressTest, TestUniqueClientIds);
592  FRIEND_TEST(ClientTest, TestGetSecurityInfoFromMaster);
593  FRIEND_TEST(ClientTest, TestGetTabletServerBlacklist);
594  FRIEND_TEST(ClientTest, TestMasterDown);
595  FRIEND_TEST(ClientTest, TestMasterLookupPermits);
596  FRIEND_TEST(ClientTest, TestMetaCacheExpiry);
597  FRIEND_TEST(ClientTest, TestNonCoveringRangePartitions);
598  FRIEND_TEST(ClientTest, TestReplicatedTabletWritesWithLeaderElection);
599  FRIEND_TEST(ClientTest, TestScanFaultTolerance);
600  FRIEND_TEST(ClientTest, TestScanTimeout);
601  FRIEND_TEST(ClientTest, TestWriteWithDeadMaster);
602  FRIEND_TEST(MasterFailoverTest, TestPauseAfterCreateTableIssued);
603 
604  KuduClient();
605 
606  // Owned.
607  Data* data_;
608 
609  DISALLOW_COPY_AND_ASSIGN(KuduClient);
610 };
611 
613 class KUDU_EXPORT KuduTabletServer {
614  public:
615  ~KuduTabletServer();
616 
619  const std::string& uuid() const;
620 
623  const std::string& hostname() const;
624 
627  uint16_t port() const;
628 
629  private:
630  class KUDU_NO_EXPORT Data;
631 
632  friend class KuduClient;
633  friend class KuduScanner;
634  friend class KuduScanTokenBuilder;
635 
636  KuduTabletServer();
637 
638  // Owned.
639  Data* data_;
640 
641  DISALLOW_COPY_AND_ASSIGN(KuduTabletServer);
642 };
643 
645 class KUDU_EXPORT KuduReplica {
646  public:
647  ~KuduReplica();
648 
653  bool is_leader() const;
654 
656  const KuduTabletServer& ts() const;
657 
658  private:
659  friend class KuduClient;
660  friend class KuduScanTokenBuilder;
661  friend class internal::ReplicaController;
662 
663  class KUDU_NO_EXPORT Data;
664 
665  KuduReplica();
666 
667  // Owned.
668  Data* data_;
669 
670  DISALLOW_COPY_AND_ASSIGN(KuduReplica);
671 };
672 
674 class KUDU_EXPORT KuduTablet {
675  public:
676  ~KuduTablet();
677 
680  const std::string& id() const;
681 
687  const std::vector<const KuduReplica*>& replicas() const;
688 
689  private:
690  friend class KuduClient;
691  friend class KuduScanTokenBuilder;
692 
693  class KUDU_NO_EXPORT Data;
694 
695  KuduTablet();
696 
697  // Owned.
698  Data* data_;
699 
700  DISALLOW_COPY_AND_ASSIGN(KuduTablet);
701 };
702 
704 class KUDU_EXPORT KuduTableCreator {
705  public:
706  ~KuduTableCreator();
707 
719  KuduTableCreator& table_name(const std::string& name);
720 
731  KuduTableCreator& schema(const KuduSchema* schema);
732 
749  KuduTableCreator& add_hash_partitions(const std::vector<std::string>& columns,
750  int32_t num_buckets);
751 
767  KuduTableCreator& add_hash_partitions(const std::vector<std::string>& columns,
768  int32_t num_buckets, int32_t seed);
769 
782  KuduTableCreator& set_range_partition_columns(const std::vector<std::string>& columns);
783 
788  };
789 
818  KuduTableCreator& add_range_partition(KuduPartialRow* lower_bound,
819  KuduPartialRow* upper_bound,
820  RangePartitionBound lower_bound_type = INCLUSIVE_BOUND,
821  RangePartitionBound upper_bound_type = EXCLUSIVE_BOUND);
822 
831  KuduTableCreator& add_range_partition_split(KuduPartialRow* split_row);
832 
838  KuduTableCreator& split_rows(const std::vector<const KuduPartialRow*>& split_rows)
839  ATTRIBUTE_DEPRECATED("use add_range_partition_split() instead");
840 
850  KuduTableCreator& num_replicas(int n_replicas);
851 
861  KuduTableCreator& timeout(const MonoDelta& timeout);
862 
870  KuduTableCreator& wait(bool wait);
871 
885  Status Create();
886 
887  private:
888  class KUDU_NO_EXPORT Data;
889 
890  friend class KuduClient;
891 
892  explicit KuduTableCreator(KuduClient* client);
893 
894  // Owned.
895  Data* data_;
896 
897  DISALLOW_COPY_AND_ASSIGN(KuduTableCreator);
898 };
899 
920 class KUDU_EXPORT KuduTable : public sp::enable_shared_from_this<KuduTable> {
921  public:
922  ~KuduTable();
923 
925  const std::string& name() const;
926 
934  const std::string& id() const;
935 
937  const KuduSchema& schema() const;
938 
940  int num_replicas() const;
941 
945  KuduInsert* NewInsert();
946 
950  KuduUpsert* NewUpsert();
951 
955  KuduUpdate* NewUpdate();
956 
960  KuduDelete* NewDelete();
961 
985  KuduPredicate* NewComparisonPredicate(const Slice& col_name,
987  KuduValue* value);
988 
1012  KuduPredicate* NewInListPredicate(const Slice& col_name,
1013  std::vector<KuduValue*>* values);
1014 
1025  KuduPredicate* NewIsNotNullPredicate(const Slice& col_name);
1026 
1037  KuduPredicate* NewIsNullPredicate(const Slice& col_name);
1038 
1041  KuduClient* client() const;
1042 
1044  const PartitionSchema& partition_schema() const;
1045 
1046  private:
1047  class KUDU_NO_EXPORT Data;
1048 
1049  friend class KuduClient;
1050  friend class KuduPartitioner;
1051 
1052  KuduTable(const sp::shared_ptr<KuduClient>& client,
1053  const std::string& name,
1054  const std::string& id,
1055  int num_replicas,
1056  const KuduSchema& schema,
1057  const PartitionSchema& partition_schema);
1058 
1059  // Owned.
1060  Data* data_;
1061 
1062  DISALLOW_COPY_AND_ASSIGN(KuduTable);
1063 };
1064 
1076 class KUDU_EXPORT KuduTableAlterer {
1077  public:
1078  ~KuduTableAlterer();
1079 
1085  KuduTableAlterer* RenameTo(const std::string& new_name);
1086 
1096  KuduColumnSpec* AddColumn(const std::string& name);
1097 
1106  KuduColumnSpec* AlterColumn(const std::string& name);
1107 
1115  KuduTableAlterer* DropColumn(const std::string& name);
1116 
1148  KuduTableAlterer* AddRangePartition(
1149  KuduPartialRow* lower_bound,
1150  KuduPartialRow* upper_bound,
1153 
1181  KuduTableAlterer* DropRangePartition(
1182  KuduPartialRow* lower_bound,
1183  KuduPartialRow* upper_bound,
1186 
1196  KuduTableAlterer* timeout(const MonoDelta& timeout);
1197 
1209  KuduTableAlterer* wait(bool wait);
1210 
1217  KuduTableAlterer* modify_external_catalogs(bool modify_external_catalogs) KUDU_NO_EXPORT;
1218 
1223  Status Alter();
1224 
1225  private:
1226  class KUDU_NO_EXPORT Data;
1227 
1228  friend class KuduClient;
1229 
1230  KuduTableAlterer(KuduClient* client,
1231  const std::string& name);
1232 
1233  // Owned.
1234  Data* data_;
1235 
1236  DISALLOW_COPY_AND_ASSIGN(KuduTableAlterer);
1237 };
1238 
1244 class KUDU_EXPORT KuduError {
1245  public:
1246  ~KuduError();
1247 
1249  const Status& status() const;
1250 
1252  const KuduWriteOperation& failed_op() const;
1253 
1261  KuduWriteOperation* release_failed_op();
1262 
1273  bool was_possibly_successful() const;
1274 
1275  private:
1276  class KUDU_NO_EXPORT Data;
1277 
1278  friend class internal::Batcher;
1279  friend class internal::ErrorCollector;
1280  friend class KuduSession;
1281 
1282  KuduError(KuduWriteOperation* failed_op, const Status& error);
1283 
1284  // Owned.
1285  Data* data_;
1286 
1287  DISALLOW_COPY_AND_ASSIGN(KuduError);
1288 };
1289 
1290 
1349 class KUDU_EXPORT KuduSession : public sp::enable_shared_from_this<KuduSession> {
1350  public:
1351  ~KuduSession();
1352 
1354  enum FlushMode {
1360 
1388 
1401  MANUAL_FLUSH
1402  };
1403 
1412  Status SetFlushMode(FlushMode m) WARN_UNUSED_RESULT;
1413 
1435 
1450  COMMIT_WAIT
1451  };
1452 
1458  Status SetExternalConsistencyMode(ExternalConsistencyMode m)
1459  WARN_UNUSED_RESULT;
1460 
1478  Status SetMutationBufferSpace(size_t size_bytes) WARN_UNUSED_RESULT;
1479 
1503  Status SetMutationBufferFlushWatermark(double watermark_pct)
1504  WARN_UNUSED_RESULT;
1505 
1527  Status SetMutationBufferFlushInterval(unsigned int millis) WARN_UNUSED_RESULT;
1528 
1553  Status SetMutationBufferMaxNum(unsigned int max_num) WARN_UNUSED_RESULT;
1554 
1560  void SetTimeoutMillis(int millis);
1561 
1565 
1589  Status Apply(KuduWriteOperation* write_op) WARN_UNUSED_RESULT;
1590 
1605  Status Flush() WARN_UNUSED_RESULT;
1606 
1647  void FlushAsync(KuduStatusCallback* cb);
1648 
1651  Status Close() WARN_UNUSED_RESULT;
1652 
1661  bool HasPendingOperations() const;
1662 
1684  int CountBufferedOperations() const
1685  ATTRIBUTE_DEPRECATED("this method is experimental and will disappear "
1686  "in a future release");
1687 
1712  Status SetErrorBufferSpace(size_t size_bytes);
1713 
1723  int CountPendingErrors() const;
1724 
1735  void GetPendingErrors(std::vector<KuduError*>* errors, bool* overflowed);
1736 
1738  KuduClient* client() const;
1739 
1740  private:
1741  class KUDU_NO_EXPORT Data;
1742 
1743  friend class KuduClient;
1744  friend class internal::Batcher;
1745  friend class ClientTest;
1746  FRIEND_TEST(ClientTest, TestAutoFlushBackgroundApplyBlocks);
1747  FRIEND_TEST(ClientTest, TestAutoFlushBackgroundAndErrorCollector);
1748 
1749  explicit KuduSession(const sp::shared_ptr<KuduClient>& client);
1750 
1751  // Owned.
1752  Data* data_;
1753 
1754  DISALLOW_COPY_AND_ASSIGN(KuduSession);
1755 };
1756 
1757 
1762 class KUDU_EXPORT KuduScanner {
1763  public:
1765  enum ReadMode {
1774 
1795 
1806  READ_YOUR_WRITES
1807  };
1808 
1812  enum OrderMode {
1819 
1824  ORDERED
1825  };
1826 
1830  enum { kScanTimeoutMillis = 30000 };
1831 
1837  explicit KuduScanner(KuduTable* table);
1838  ~KuduScanner();
1839 
1849  Status SetProjectedColumnNames(const std::vector<std::string>& col_names)
1850  WARN_UNUSED_RESULT;
1851 
1861  Status SetProjectedColumnIndexes(const std::vector<int>& col_indexes)
1862  WARN_UNUSED_RESULT;
1863 
1869  Status SetProjectedColumns(const std::vector<std::string>& col_names)
1870  WARN_UNUSED_RESULT
1871  ATTRIBUTE_DEPRECATED("use SetProjectedColumnNames() instead");
1872 
1881  Status AddConjunctPredicate(KuduPredicate* pred) WARN_UNUSED_RESULT;
1882 
1891  Status AddLowerBound(const KuduPartialRow& key);
1892 
1900  Status AddLowerBoundRaw(const Slice& key)
1901  ATTRIBUTE_DEPRECATED("use AddLowerBound() instead");
1902 
1911  Status AddExclusiveUpperBound(const KuduPartialRow& key);
1912 
1920  Status AddExclusiveUpperBoundRaw(const Slice& key)
1921  ATTRIBUTE_DEPRECATED("use AddExclusiveUpperBound() instead");
1922 
1931  Status AddLowerBoundPartitionKeyRaw(const Slice& partition_key);
1932 
1941  Status AddExclusiveUpperBoundPartitionKeyRaw(const Slice& partition_key);
1942 
1949  Status SetCacheBlocks(bool cache_blocks);
1950 
1952  Status Open();
1953 
1972  Status KeepAlive();
1973 
1982  void Close();
1983 
1992  bool HasMoreRows() const;
1993 
2005  Status NextBatch(std::vector<KuduRowResult>* rows)
2006  ATTRIBUTE_DEPRECATED("use NextBatch(KuduScanBatch*) instead");
2007 
2016  Status NextBatch(KuduScanBatch* batch);
2017 
2026  Status GetCurrentServer(KuduTabletServer** server);
2027 
2029  const ResourceMetrics& GetResourceMetrics() const;
2030 
2037  Status SetBatchSizeBytes(uint32_t batch_size);
2038 
2046  Status SetSelection(KuduClient::ReplicaSelection selection)
2047  WARN_UNUSED_RESULT;
2048 
2054  Status SetReadMode(ReadMode read_mode) WARN_UNUSED_RESULT;
2055 
2061  Status SetOrderMode(OrderMode order_mode) WARN_UNUSED_RESULT
2062  ATTRIBUTE_DEPRECATED("use SetFaultTolerant() instead");
2063 
2076  Status SetFaultTolerant() WARN_UNUSED_RESULT;
2077 
2083  Status SetSnapshotMicros(uint64_t snapshot_timestamp_micros) WARN_UNUSED_RESULT;
2084 
2097  Status SetSnapshotRaw(uint64_t snapshot_timestamp) WARN_UNUSED_RESULT;
2098 
2104  Status SetTimeoutMillis(int millis);
2105 
2107  KuduSchema GetProjectionSchema() const;
2108 
2110  //
2116  static const uint64_t NO_FLAGS = 0;
2124  static const uint64_t PAD_UNIXTIME_MICROS_TO_16_BYTES = 1 << 0;
2148  Status SetRowFormatFlags(uint64_t flags);
2150 
2156  Status SetLimit(int64_t limit) WARN_UNUSED_RESULT;
2157 
2163  std::string ToString() const;
2164 
2165  private:
2166  class KUDU_NO_EXPORT Data;
2167 
2168  friend class KuduScanToken;
2169  FRIEND_TEST(ClientTest, TestScanCloseProxy);
2170  FRIEND_TEST(ClientTest, TestScanFaultTolerance);
2171  FRIEND_TEST(ClientTest, TestScanNoBlockCaching);
2172  FRIEND_TEST(ClientTest, TestScanTimeout);
2173  FRIEND_TEST(ClientTest, TestReadAtSnapshotNoTimestampSet);
2174  FRIEND_TEST(ConsistencyITest, TestSnapshotScanTimestampReuse);
2175  FRIEND_TEST(ScanTokenTest, TestScanTokens);
2176 
2177  // Owned.
2178  Data* data_;
2179 
2180  DISALLOW_COPY_AND_ASSIGN(KuduScanner);
2181 };
2182 
2203 class KUDU_EXPORT KuduScanToken {
2204  public:
2205 
2206  ~KuduScanToken();
2207 
2218  Status IntoKuduScanner(KuduScanner** scanner) const WARN_UNUSED_RESULT;
2219 
2221  const KuduTablet& tablet() const;
2222 
2230  Status Serialize(std::string* buf) const WARN_UNUSED_RESULT;
2231 
2243  static Status DeserializeIntoScanner(KuduClient* client,
2244  const std::string& serialized_token,
2245  KuduScanner** scanner) WARN_UNUSED_RESULT;
2246 
2247  private:
2248  class KUDU_NO_EXPORT Data;
2249 
2250  friend class KuduScanTokenBuilder;
2251 
2252  KuduScanToken();
2253 
2254  // Owned.
2255  Data* data_;
2256 
2257  DISALLOW_COPY_AND_ASSIGN(KuduScanToken);
2258 };
2259 
2263 class KUDU_EXPORT KuduScanTokenBuilder {
2264  public:
2265 
2271  explicit KuduScanTokenBuilder(KuduTable* table);
2273 
2283  Status SetProjectedColumnNames(const std::vector<std::string>& col_names)
2284  WARN_UNUSED_RESULT;
2285 
2287  Status SetProjectedColumnIndexes(const std::vector<int>& col_indexes)
2288  WARN_UNUSED_RESULT;
2289 
2291  Status AddConjunctPredicate(KuduPredicate* pred) WARN_UNUSED_RESULT;
2292 
2294  Status AddLowerBound(const KuduPartialRow& key) WARN_UNUSED_RESULT;
2295 
2304  Status AddUpperBound(const KuduPartialRow& key) WARN_UNUSED_RESULT;
2305 
2307  Status SetCacheBlocks(bool cache_blocks) WARN_UNUSED_RESULT;
2308 
2315  Status SetBatchSizeBytes(uint32_t batch_size) WARN_UNUSED_RESULT;
2316 
2324  Status SetSelection(KuduClient::ReplicaSelection selection)
2325  WARN_UNUSED_RESULT;
2326 
2328  Status SetReadMode(KuduScanner::ReadMode read_mode) WARN_UNUSED_RESULT;
2329 
2331  Status SetFaultTolerant() WARN_UNUSED_RESULT;
2332 
2334  Status SetSnapshotMicros(uint64_t snapshot_timestamp_micros)
2335  WARN_UNUSED_RESULT;
2336 
2338  Status SetSnapshotRaw(uint64_t snapshot_timestamp) WARN_UNUSED_RESULT;
2339 
2341  Status SetTimeoutMillis(int millis) WARN_UNUSED_RESULT;
2342 
2351  Status Build(std::vector<KuduScanToken*>* tokens) WARN_UNUSED_RESULT;
2352 
2353  private:
2354  class KUDU_NO_EXPORT Data;
2355 
2356  // Owned.
2357  Data* data_;
2358 
2359  DISALLOW_COPY_AND_ASSIGN(KuduScanTokenBuilder);
2360 };
2361 
2363 class KUDU_EXPORT KuduPartitionerBuilder {
2364  public:
2369  explicit KuduPartitionerBuilder(sp::shared_ptr<KuduTable> table);
2371 
2373  KuduPartitionerBuilder* SetBuildTimeout(MonoDelta timeout);
2374 
2391  Status Build(KuduPartitioner** partitioner);
2392  private:
2393  class KUDU_NO_EXPORT Data;
2394 
2395  // Owned.
2396  Data* data_;
2397 
2398  DISALLOW_COPY_AND_ASSIGN(KuduPartitionerBuilder);
2399 };
2400 
2411 class KUDU_EXPORT KuduPartitioner {
2412  public:
2413  ~KuduPartitioner();
2414 
2418  int NumPartitions() const;
2419 
2431  Status PartitionRow(const KuduPartialRow& row, int* partition);
2432  private:
2433  class KUDU_NO_EXPORT Data;
2434 
2435  friend class KuduPartitionerBuilder;
2436 
2437  explicit KuduPartitioner(Data* data);
2438  Data* data_; // Owned.
2439 };
2440 
2441 
2442 } // namespace client
2443 } // namespace kudu
2444 #endif
A row which may only contain values for a subset of the columns.
Definition: partial_row.h:64
A single row update to be sent to the cluster.
Definition: write_op.h:193
ComparisonOp
Supported comparison operators.
Definition: scan_predicate.h:37
Definition: client.h:2411
In-memory representation of a remote tablet.
Definition: client.h:674
Definition: callbacks.h:28
A representation of comparison predicate for Kudu queries.
Definition: scan_predicate.h:34
A helper class to create a new table with the desired options.
Definition: client.h:704
An exclusive bound.
Definition: client.h:786
A batch of zero or more rows returned by a scan operation.
Definition: scan_batch.h:83
An inclusive bound.
Definition: client.h:787
static const uint64_t kNoTimestamp
Definition: client.h:475
A constant cell value with a specific type.
Definition: value.h:35
ReadMode
The read modes for scanners.
Definition: client.h:1765
RangePartitionBound
Range partition bound type.
Definition: client.h:785
Alters an existing table based on the provided steps.
Definition: client.h:1076
ReplicaSelection
Policy with which to choose amongst multiple replicas.
Definition: client.h:454
A single row insert to be sent to the cluster.
Definition: write_op.h:141
Smart pointer typedefs for externally-faced code.
A single row upsert to be sent to the cluster.
Definition: write_op.h:166
Builds scan tokens for a table.
Definition: client.h:2263
A representation of a time interval.
Definition: monotime.h:44
FlushMode
Modes of flush operations.
Definition: client.h:1354
Builder API for specifying or altering a column within a table schema.
Definition: schema.h:274
A "factory" for KuduClient objects.
Definition: client.h:199
ExternalConsistencyMode
The possible external consistency modes on which Kudu operates.
Definition: client.h:1415
Select the LEADER replica.
Definition: client.h:455
Builder for Partitioner instances.
Definition: client.h:2363
Definition: client.h:1818
Representation of a Kudu client session.
Definition: client.h:1349
A handle for a connection to a cluster.
Definition: client.h:314
A representation of a table&#39;s schema.
Definition: schema.h:499
A single row delete to be sent to the cluster.
Definition: write_op.h:220
In-memory representation of a remote tablet&#39;s replica.
Definition: client.h:645
A wrapper around externally allocated data.
Definition: slice.h:50
A representation of a table on a particular cluster.
Definition: client.h:920
A representation of an operation&#39;s outcome.
Definition: status.h:145
A scan descriptor limited to a single physical contiguous location.
Definition: client.h:2203
A generic catalog of simple metrics.
Definition: resource_metrics.h:33
A single-row write operation to be sent to a Kudu table.
Definition: write_op.h:65
In-memory representation of a remote tablet server.
Definition: client.h:613
The interface for all status callbacks.
Definition: callbacks.h:161
OrderMode
Definition: client.h:1812
This class represents an error which occurred in a write operation.
Definition: client.h:1244
This class is a representation of a single scan.
Definition: client.h:1762