MCPcopy Create free account
hub / github.com/apple/foundationdb / flush

Method flush

fdbclient/BackupContainerLocalDirectory.actor.cpp:52–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50 }
51
52 Future<Void> flush(int size) {
53 // Avoid empty write
54 if (size == 0) {
55 return Void();
56 }
57
58 ASSERT(size <= m_buffer.size());
59
60 // Keep a reference to the old buffer
61 Standalone<VectorRef<uint8_t>> old = m_buffer;
62 // Make a new buffer, initialized with the excess bytes over the block size from the old buffer
63 m_buffer = Standalone<VectorRef<uint8_t>>(old.slice(size, old.size()));
64
65 // Write the old buffer to the underlying file and update the write offset
66 Future<Void> r = uncancellable(holdWhile(old, m_file->write(old.begin(), size, m_writeOffset)));
67 m_writeOffset += size;
68
69 return r;
70 }
71
72 ACTOR static Future<Void> finish_impl(Reference<BackupFile> f) {
73 wait(f->flush(f->m_buffer.size()));

Callers 1

finish_implMethod · 0.45

Calls 6

uncancellableFunction · 0.85
sliceMethod · 0.80
VoidClass · 0.50
sizeMethod · 0.45
writeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected