-
Notifications
You must be signed in to change notification settings - Fork 300
Description
What does "flush" mean? None of the WASI proposals currently define what it means to "flush" one of their output-streams.
wasi-io's documentation on flush says:
This tells the output-stream that the caller intends any buffered output to be flushed.
(Aside from the recursive definition 😜),
which buffers, to what extent, and with what goal?
Does this include OS buffers? I.e.
- for filesystems, does this mean just performing a
write? Orwrite+fsync? (Or does it require the use ofO_DIRECTto bypass Linux' internal caching entirely 🤭?) - for sockets, does this mean just performing a
send? OrsendwithTCP_NODELAYenabled? If a write has not been flushed, does that mean we actually should've sent it withMSG_MOREin the first place?
Or put differently, why should a consumer of a random output-stream of which it doesn't know its origin, call flush (or one of its cousins)? What guarantee do they have after their data has been flushed? Is it now persistently stored on disk? Has it been sent out on the wire? Has the peer successfully received it?
As far as I can see in wasmtime, none of wasi-filesystem, wasi-sockets & wasi-http use flush for anything other than waiting for a previous write to finish.
Apologies for the many question marks :)