Line | Count | Source |
1 | // Copyright (c) Meta Platforms, Inc. and affiliates. | |
2 | // | |
3 | // This source code is licensed under both the GPLv2 (found in the | |
4 | // COPYING file in the root directory) and Apache 2.0 License | |
5 | // (found in the LICENSE.Apache file in the root directory). | |
6 | ||
7 | #pragma once | |
8 | ||
9 | #include "rocksdb/status.h" | |
10 | ||
11 | namespace ROCKSDB_NAMESPACE { | |
12 | ||
13 | // Custom callback functions to support users to plug in logic while data is | |
14 | // being written to the DB. It's intended for better synchronization between | |
15 | // concurrent writes. Note that these callbacks are in the write's critical path | |
16 | // It's desirable to keep them fast and minimum to not affect the write's | |
17 | // latency. These callbacks may be called in the context of a different thread. | |
18 | class UserWriteCallback { | |
19 | public: | |
20 | 0 | virtual ~UserWriteCallback() {} |
21 | ||
22 | // This function will be called after the write is enqueued. | |
23 | virtual void OnWriteEnqueued() = 0; | |
24 | ||
25 | // This function will be called after wal write finishes if it applies. | |
26 | virtual void OnWalWriteFinish() = 0; | |
27 | }; | |
28 | ||
29 | } // namespace ROCKSDB_NAMESPACE |