write_buffer.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Tencent is pleased to support the open source community by making wwsearch
  3. * available.
  4. *
  5. * Copyright (C) 2018-present Tencent. All Rights Reserved.
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  8. * use this file except in compliance with the License. You may obtain a copy of
  9. * the License at
  10. *
  11. * https://opensource.org/licenses/Apache-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  15. * WARRANTIES OF ANY KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations under the License.
  17. */
  18. #pragma once
  19. #include "search_status.h"
  20. #include "storage_type.h"
  21. namespace wwsearch {
  22. class WriteBuffer {
  23. public:
  24. virtual ~WriteBuffer();
  25. // Put
  26. virtual SearchStatus Put(StorageColumnType column, const std::string& key,
  27. const std::string& value) = 0;
  28. // Delete
  29. virtual SearchStatus Delete(StorageColumnType column,
  30. const std::string& key) = 0;
  31. // DeleteRange ["begin_key", "end_key")
  32. virtual SearchStatus DeleteRange(StorageColumnType column,
  33. const std::string& begin_key,
  34. const std::string& end_key) = 0;
  35. // Merge
  36. virtual SearchStatus Merge(StorageColumnType column, const std::string& key,
  37. const std::string& value) = 0;
  38. virtual SearchStatus Append(WriteBuffer* prepare_append_write_buffer) = 0;
  39. virtual std::string Data() = 0;
  40. virtual uint64_t DataSize() const = 0;
  41. virtual uint64_t KvCount() const = 0;
  42. private:
  43. };
  44. } // namespace wwsearch