]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/include/rocksdb/trace_reader_writer.h
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"
10 namespace ROCKSDB_NAMESPACE
{
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;
27 virtual uint64_t GetFileSize() = 0;
30 // TraceReader allows reading RocksDB traces from any system, one operation at
31 // a time. A RocksDB Replayer could depend on this to replay opertions.
35 virtual ~TraceReader() {}
37 virtual Status
Read(std::string
* data
) = 0;
38 virtual Status
Close() = 0;
41 // Factory methods to read/write traces from/to a file.
42 Status
NewFileTraceWriter(Env
* env
, const EnvOptions
& env_options
,
43 const std::string
& trace_filename
,
44 std::unique_ptr
<TraceWriter
>* trace_writer
);
45 Status
NewFileTraceReader(Env
* env
, const EnvOptions
& env_options
,
46 const std::string
& trace_filename
,
47 std::unique_ptr
<TraceReader
>* trace_reader
);
48 } // namespace ROCKSDB_NAMESPACE