|
bool | Open (const std::string &path, Mode mode) override |
|
bool | Open (const std::string &path, Mode mode, int capacity) |
| user defines capacity More...
|
|
void | Close () override |
|
bool | Write (const std::string &key, const std::string &value) override |
| override; override; More...
|
|
void | Flush () override |
|
std::string | path () |
| return path to binary file
|
|
virtual | ~Writer () |
| In case that users forget to call Close() to release resources, e.g., memory, you can release them here. More...
|
|
BinFile stores training/validation/test tuples.
Each tuple is encoded as [magic_word, key_len, key, val_len, val]:
- magic_word has 4 bytes; the first two are "s" and "g", the third one indicates whether key is null, the last one is reserved for future use.
- key_len and val_len are of type uint32, which indicate the bytes of key and value respectively;
- key_len and key are optional.) When BinFile is created, it will remove the last tuple if the value size and key size do not match because the last write crashed.