write_callback.h 822 B

123456789101112131415161718192021222324252627
  1. // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
  2. // This source code is licensed under both the GPLv2 (found in the
  3. // COPYING file in the root directory) and Apache 2.0 License
  4. // (found in the LICENSE.Apache file in the root directory).
  5. #pragma once
  6. #include "rocksdb/status.h"
  7. namespace ROCKSDB_NAMESPACE {
  8. class DB;
  9. class WriteCallback {
  10. public:
  11. virtual ~WriteCallback() {}
  12. // Will be called while on the write thread before the write executes. If
  13. // this function returns a non-OK status, the write will be aborted and this
  14. // status will be returned to the caller of DB::Write().
  15. virtual Status Callback(DB* db) = 0;
  16. // return true if writes with this callback can be batched with other writes
  17. virtual bool AllowWriteBatching() = 0;
  18. };
  19. } // namespace ROCKSDB_NAMESPACE