multi_get

读取多条数据

  1. ///
  2. /// \brief multi_get
  3. /// get multiple value by key from the cluster.
  4. /// \param hashkey
  5. /// used to decide which partition to get this k-v
  6. /// \param sortkeys
  7. /// all the k-v under hashkey will be sorted by sortkey.
  8. /// if empty, means fetch all sortkeys under the hashkey.
  9. /// \param values
  10. /// the returned <sortkey,value> pairs will be put into it.
  11. /// if data is not found for some <hashkey,sortkey>, then it will not appear in the map.
  12. /// \param max_fetch_count
  13. /// max count of k-v pairs to be fetched. max_fetch_count <= 0 means no limit.
  14. /// \param max_fetch_size
  15. /// max size of k-v pairs to be fetched. max_fetch_size <= 0 means no limit.
  16. /// \param timeout_milliseconds
  17. /// if wait longer than this value, will return time out error
  18. /// \return
  19. /// int, the error indicates whether or not the operation is succeeded.
  20. /// this error can be converted to a string using get_error_string().
  21. /// returns PERR_OK if fetch done, even no data is returned.
  22. /// returns PERR_INCOMPLETE is only partial data is fetched.
  23. ///
  24. virtual int multi_get(const std::string &hashkey,
  25. const std::set<std::string> &sortkeys,
  26. std::map<std::string, std::string> &values,
  27. int max_fetch_count = 100,
  28. int max_fetch_size = 1000000,
  29. int timeout_milliseconds = 5000,
  30. internal_info *info = NULL) = 0;

注:max_fetch_count 和 max_fetch_size 分别从kv-pair的条数 和 总的大小来限制multi_get的返回值