]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/include/rocksdb/trace_reader_writer.h
31226487b8516271823c576a28dfb1c526ae8fa2
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).
8 #include "rocksdb/env.h"
12 // Allow custom implementations of TraceWriter and TraceReader.
13 // By default, RocksDB provides a way to capture the traces to a file using the
14 // factory NewFileTraceWriter(). But users could also choose to export traces to
15 // any other system by providing custom implementations of TraceWriter and
18 // TraceWriter allows exporting RocksDB traces to any system, one operation at
23 virtual ~TraceWriter() {}
25 virtual Status
Write(const Slice
& data
) = 0;
26 virtual Status
Close() = 0;
29 // TraceReader allows reading RocksDB traces from any system, one operation at
30 // a time. A RocksDB Replayer could depend on this to replay opertions.
34 virtual ~TraceReader() {}
36 virtual Status
Read(std::string
* data
) = 0;
37 virtual Status
Close() = 0;
40 // Factory methods to read/write traces from/to a file.
41 Status
NewFileTraceWriter(Env
* env
, const EnvOptions
& env_options
,
42 const std::string
& trace_filename
,
43 std::unique_ptr
<TraceWriter
>* trace_writer
);
44 Status
NewFileTraceReader(Env
* env
, const EnvOptions
& env_options
,
45 const std::string
& trace_filename
,
46 std::unique_ptr
<TraceReader
>* trace_reader
);
47 } // namespace rocksdb