Table接口说明

1. 主要数据结构

1. 表格信息

  1. struct TableInfo {
  2. TableDescriptor* table_desc; //表的描述符
  3. std::string status; //表格状态信息
  4. };

2. tablet信息

  1. struct TabletInfo {
  2. std::string table_name; //表名
  3. std::string path; //路径
  4. std::string server_addr; //服务器地址
  5. std::string start_key; //起始key
  6. std::string end_key; //结束key
  7. int64_t data_size; //数据大小
  8. std::string status; //状态
  9. };

2. 主要接口

(1) 获取表名 Table::GetName
  1. const std::string GetName() = 0
(2) 行mutation操作 Table::NewRowMutation
  1. RowMutation* NewRowMutation(const std::string& row_key) = 0
(3) 写数据 Table::Put
  1. 1) void Put(RowMutation* row_mutation) = 0
  2. 2) void Put(const std::vector<RowMutation*>& row_mutations) = 0
  3. 3) bool Put(const std::string& row_key, const std::string& family, const std::string& qualifier, const std::string& value, ErrorCode* err) = 0
  4. 4) bool Put(const std::string& row_key, const std::string& family, const std::string& qualifier, const int64_t value, ErrorCode* err) = 0;
  5. 5) bool PutIfAbsent(const std::string& row_key, const std::string& family, const std::string& qualifier, const std::string& value, ErrorCode* err) = 0;
(4) 检查写数据是否结束 Table::IsPutFinished
  1. bool IsPutFinished() = 0
(5) 添加数据 Table::Add
  1. bool Add(const std::string& row_key, const std::string& family, const std::string& qualifier, int64_t delta, ErrorCode* err) = 0;
(6) 追加数据 Table::Append
  1. bool Append(const std::string& row_key, const std::string& family, const std::string& qualifier, const std::string& value, ErrorCode* err) = 0;
(7) 按行读数据 Table::NewRowReader
  1. RowReader* NewRowReader(const std::string& row_key) = 0
(8) 读数据 Table::Get
  1. 1) void Get(RowReader* row_reader) = 0
  2. 2) void Get(const std::vector<RowReader*>& row_readers) = 0;
  3. 3) bool Get(const std::string& row_key, const std::string& family, const std::string& qualifier, std::string* value, ErrorCode* err) = 0;
  4. 4) bool Get(const std::string& row_key, const std::string& family, const std::string& qualifier, int64_t* value, ErrorCode* err) = 0;
(9) 检查get是否结束 Table::IsGetFinished
  1. bool IsGetFinished() = 0;
(10) 扫描 Table::Scan
  1. ResultStream* Scan(const ScanDescriptor& desc, ErrorCode* err) = 0
(11) 按行事务处理 Table::StartRowTransaction
  1. Transaction* StartRowTransaction(const std::string& row_key) = 0
(12) 提交行事务 Table::CommitRowTransaction
  1. void CommitRowTransaction(Transaction* transaction) = 0
(13) 执行mutation Table::ApplyMutation
  1. void ApplyMutation(RowMutation* row_mu) = 0;
  2. void ApplyMutation(const std::vector<RowMutation*>& row_mu_list) = 0;