MongoDB  2.7.0
logfile.h
1 // @file logfile.h simple file log writing / journaling
2 
31 #pragma once
32 
33 #include "mongo/client/export_macros.h"
34 
35 namespace mongo {
36 
37  class MONGO_CLIENT_API LogFile {
38  public:
42  LogFile(const std::string& name, bool readwrite = false);
43 
45  ~LogFile();
46 
51  void synchronousAppend(const void *buf, size_t len);
52 
54  void writeAt(unsigned long long offset, const void *_bug, size_t _len);
55 
56  void readAt(unsigned long long offset, void *_buf, size_t _len);
57 
58  const string _name;
59 
60  void truncate(); // Removes extra data after current position
61 
62  private:
63 #if defined(_WIN32)
64  typedef HANDLE fd_type;
65 #else
66  typedef int fd_type;
67 #endif
68  fd_type _fd;
69  bool _direct; // are we using direct I/O
70  };
71 
72 }
Definition: logfile.h:37