|
|
Namespaces | |
| namespace | detail |
Enumerations | |
| enum class | WriteMode { Plain , Atomic , AtomicDurable } |
| How writeDataToFile() should get the bytes onto disk. More... | |
Functions | |
| bool | canCreateFiles (const std::filesystem::path &dir) |
| Check if we can create files in this directory. | |
| bool | directoryExists (const std::filesystem::path &p) |
| void | ensureDirectoryExists (const std::filesystem::path &p, bool createIfNotExistent=false) |
| void | ensureFileExists (const std::filesystem::path &p, bool createIfNotExistent=false) |
| bool | fileExists (const std::filesystem::path &p) |
| std::vector< std::filesystem::path > | getAllDirectories (const std::filesystem::path &p) |
| std::vector< std::filesystem::path > | getAllFiles (const std::filesystem::path &p) |
| std::vector< unsigned char > | gzipCompress (const std::vector< unsigned char > &data, int level=1) |
| Compress data into a gzip container (i.e. | |
| std::vector< unsigned char > | gzipDecompress (const std::vector< unsigned char > &data) |
| Inverse of gzipCompress. Throws if the data is not a valid gzip stream. | |
| bool | hasWritePermission (const std::filesystem::path &p) |
| Check if directory has write permission. | |
| bool | isGzip (const std::vector< unsigned char > &data) |
| Gzip magic bytes (0x1f 0x8b) — used to detect compressed content defensively. | |
| std::vector< unsigned char > | readDataFromFile (const std::filesystem::path &p) |
| std::filesystem::path | toPath (const std::filesystem::path &base, const armem::MemoryID &id) |
| void | writeDataToFile (const std::filesystem::path &p, const std::vector< unsigned char > &data, WriteMode mode=WriteMode::AtomicDurable) |
|
strong |
How writeDataToFile() should get the bytes onto disk.
Atomicity and durability are separate concerns and were previously bundled into one flag, which left the batch writer choosing between per-file fsyncs it could not afford and files that a crash could truncate.
Definition at line 48 of file filesystem.h.
| bool canCreateFiles | ( | const std::filesystem::path & | dir | ) |
Check if we can create files in this directory.
Here is the caller graph for this function:| bool directoryExists | ( | const std::filesystem::path & | p | ) |
Here is the caller graph for this function:| void ensureDirectoryExists | ( | const std::filesystem::path & | p, |
| bool | createIfNotExistent = false ) |
| void ensureFileExists | ( | const std::filesystem::path & | p, |
| bool | createIfNotExistent = false ) |
| bool fileExists | ( | const std::filesystem::path & | p | ) |
| std::vector< std::filesystem::path > getAllDirectories | ( | const std::filesystem::path & | p | ) |
Here is the caller graph for this function:| std::vector< std::filesystem::path > getAllFiles | ( | const std::filesystem::path & | p | ) |
| std::vector< unsigned char > gzipCompress | ( | const std::vector< unsigned char > & | data, |
| int | level = 1 ) |
Compress data into a gzip container (i.e.
what gunzip and Python's gzip module read).
| level | zlib compression level, 1 (fastest) to 9 (smallest). Level 1 is a good default for the LTM write path: it already gets within ~10% of level 6 on Aron JSON while costing a fraction of the CPU per snapshot. |
Here is the caller graph for this function:| std::vector< unsigned char > gzipDecompress | ( | const std::vector< unsigned char > & | data | ) |
Inverse of gzipCompress. Throws if the data is not a valid gzip stream.
| bool hasWritePermission | ( | const std::filesystem::path & | p | ) |
Check if directory has write permission.
Here is the caller graph for this function:| bool isGzip | ( | const std::vector< unsigned char > & | data | ) |
Gzip magic bytes (0x1f 0x8b) — used to detect compressed content defensively.
| std::vector< unsigned char > readDataFromFile | ( | const std::filesystem::path & | p | ) |
| std::filesystem::path toPath | ( | const std::filesystem::path & | base, |
| const armem::MemoryID & | id ) |
| void writeDataToFile | ( | const std::filesystem::path & | p, |
| const std::vector< unsigned char > & | data, | ||
| WriteMode | mode = WriteMode::AtomicDurable ) |