MCPcopy Create free account
hub / github.com/ElementsProject/elements / Flush

Method Flush

src/flatfile.cpp:81–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79}
80
81bool FlatFileSeq::Flush(const FlatFilePos& pos, bool finalize)
82{
83 FILE* file = Open(FlatFilePos(pos.nFile, 0)); // Avoid fseek to nPos
84 if (!file) {
85 return error("%s: failed to open file %d", __func__, pos.nFile);
86 }
87 if (finalize && !TruncateFile(file, pos.nPos)) {
88 fclose(file);
89 return error("%s: failed to truncate file %d", __func__, pos.nFile);
90 }
91 if (!FileCommit(file)) {
92 fclose(file);
93 return error("%s: failed to commit file %d", __func__, pos.nFile);
94 }
95 DirectoryCommit(m_dir);
96
97 fclose(file);
98 return true;
99}

Callers

nothing calls this directly

Calls 5

errorFunction · 0.85
TruncateFileFunction · 0.85
FileCommitFunction · 0.85
DirectoryCommitFunction · 0.85
FlatFilePosClass · 0.70

Tested by

no test coverage detected