Feathercoin  0.5.0
P2P Digital Currency
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
log_writer.h
Go to the documentation of this file.
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.
4 
5 #ifndef STORAGE_LEVELDB_DB_LOG_WRITER_H_
6 #define STORAGE_LEVELDB_DB_LOG_WRITER_H_
7 
8 #include <stdint.h>
9 #include "db/log_format.h"
10 #include "leveldb/slice.h"
11 #include "leveldb/status.h"
12 
13 namespace leveldb {
14 
15 class WritableFile;
16 
17 namespace log {
18 
19 class Writer {
20  public:
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);
25  ~Writer();
26 
27  Status AddRecord(const Slice& slice);
28 
29  private:
31  int block_offset_; // Current offset in block
32 
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];
37 
38  Status EmitPhysicalRecord(RecordType type, const char* ptr, size_t length);
39 
40  // No copying allowed
41  Writer(const Writer&);
42  void operator=(const Writer&);
43 };
44 
45 } // namespace log
46 } // namespace leveldb
47 
48 #endif // STORAGE_LEVELDB_DB_LOG_WRITER_H_
void operator=(const Writer &)
Writer(WritableFile *dest)
Definition: log_writer.cc:15
Status EmitPhysicalRecord(RecordType type, const char *ptr, size_t length)
Definition: log_writer.cc:75
Status AddRecord(const Slice &slice)
Definition: log_writer.cc:27
uint32_t type_crc_[kMaxRecordType+1]
Definition: log_writer.h:36
unsigned int uint32_t
Definition: stdint.h:21
WritableFile * dest_
Definition: log_writer.h:30