1 // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. See the AUTHORS file for names of contributors.
5 #ifndef STORAGE_LEVELDB_DB_LOG_WRITER_H_
6 #define STORAGE_LEVELDB_DB_LOG_WRITER_H_
9 #include "db/log_format.h"
10 #include "leveldb/slice.h"
11 #include "leveldb/status.h"
21 // Create a writer that will append data to "*dest".
22 // "*dest" must be initially empty.
23 // "*dest" must remain live while this Writer is in use.
24 explicit Writer(WritableFile* dest);
27 Status AddRecord(const Slice& slice);
31 int block_offset_; // Current offset in block
33 // crc32c values for all supported record types. These are
34 // pre-computed to reduce the overhead of computing the crc of the
35 // record type stored in the header.
36 uint32_t type_crc_[kMaxRecordType + 1];
38 Status EmitPhysicalRecord(RecordType type, const char* ptr, size_t length);
41 Writer(const Writer&);
42 void operator=(const Writer&);
46 } // namespace leveldb
48 #endif // STORAGE_LEVELDB_DB_LOG_WRITER_H_