select.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // MinIO C++ Library for Amazon S3 Compatible Cloud Storage
  2. // Copyright 2022 MinIO, Inc.
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. #ifndef _MINIO_S3_SELECT_H
  16. #define _MINIO_S3_SELECT_H
  17. #include "http.h"
  18. #include "types.h"
  19. #include <pugixml.hpp>
  20. namespace minio {
  21. namespace s3 {
  22. class SelectHandler {
  23. private:
  24. SelectResultFunction result_func_ = NULL;
  25. bool done_ = false;
  26. std::string response_;
  27. std::string prelude_;
  28. bool prelude_read_ = false;
  29. std::string prelude_crc_;
  30. bool prelude_crc_read_ = false;
  31. unsigned int total_length_ = 0;
  32. std::string data_;
  33. bool data_read_ = false;
  34. std::string message_crc_;
  35. bool message_crc_read_ = false;
  36. void Reset();
  37. bool ReadPrelude();
  38. bool ReadPreludeCrc();
  39. bool ReadData();
  40. bool ReadMessageCrc();
  41. error::Error DecodeHeader(std::map<std::string, std::string>& headers,
  42. std::string data);
  43. bool process(http::DataFunctionArgs args, bool& cont);
  44. public:
  45. SelectHandler(SelectResultFunction result_func) {
  46. this->result_func_ = result_func;
  47. }
  48. bool DataFunction(http::DataFunctionArgs args);
  49. }; // struct SelectHandler
  50. } // namespace s3
  51. } // namespace minio
  52. #endif // #ifndef _MINIO_S3_SELECT_H