Joedb 9.1.4
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
Async_Writer.h
Go to the documentation of this file.
1#ifndef joedb_Async_Writer_declared
2#define joedb_Async_Writer_declared
3
5
6namespace joedb
7{
8 /// @ingroup journal
10 {
11 private:
12 Abstract_File &file;
13 int64_t current;
14
15 public:
16 //////////////////////////////////////////////////////////////////////////
17 Async_Writer(Abstract_File &file, int64_t start):
18 //////////////////////////////////////////////////////////////////////////
19 file(file),
20 current(start)
21 {
22 }
23
24 //////////////////////////////////////////////////////////////////////////
25 void write(const char *buffer, size_t size)
26 //////////////////////////////////////////////////////////////////////////
27 {
28 file.pwrite(buffer, size, current);
29 current += size;
30 }
31
32 //////////////////////////////////////////////////////////////////////////
33 int64_t get_position() const
34 //////////////////////////////////////////////////////////////////////////
35 {
36 return current;
37 }
38 };
39}
40
41#endif
virtual void pwrite(const char *data, size_t size, int64_t offset)
int64_t get_position() const
Async_Writer(Abstract_File &file, int64_t start)
void write(const char *buffer, size_t size)
Definition Blob.h:7