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 
6 #pragma once
7 
8 #include "rocksdb/status.h"
9 
10 namespace ROCKSDB_NAMESPACE {
11 
12 class DB;
13 
14 class WriteCallback {
15  public:
~WriteCallback()16   virtual ~WriteCallback() {}
17 
18   // Will be called while on the write thread before the write executes.  If
19   // this function returns a non-OK status, the write will be aborted and this
20   // status will be returned to the caller of DB::Write().
21   virtual Status Callback(DB* db) = 0;
22 
23   // return true if writes with this callback can be batched with other writes
24   virtual bool AllowWriteBatching() = 0;
25 };
26 
27 }  // namespace ROCKSDB_NAMESPACE
28