]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/utilities/trace/file_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/trace_reader_writer.h"
12 class RandomAccessFileReader
;
13 class WritableFileWriter
;
15 // FileTraceReader allows reading RocksDB traces from a file.
16 class FileTraceReader
: public TraceReader
{
18 explicit FileTraceReader(std::unique_ptr
<RandomAccessFileReader
>&& reader
);
21 virtual Status
Read(std::string
* data
) override
;
22 virtual Status
Close() override
;
25 std::unique_ptr
<RandomAccessFileReader
> file_reader_
;
30 static const unsigned int kBufferSize
;
33 // FileTraceWriter allows writing RocksDB traces to a file.
34 class FileTraceWriter
: public TraceWriter
{
36 explicit FileTraceWriter(std::unique_ptr
<WritableFileWriter
>&& file_writer
)
37 : file_writer_(std::move(file_writer
)) {}
40 virtual Status
Write(const Slice
& data
) override
;
41 virtual Status
Close() override
;
42 virtual uint64_t GetFileSize() override
;
45 std::unique_ptr
<WritableFileWriter
> file_writer_
;
48 } // namespace rocksdb