Documentation
¶
Overview ¶
Package bufferfile provides a FIFO implementation backed by a temporary file that supports concurrent reads and writes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FIFO ¶
type FIFO struct {
// contains filtered or unexported fields
}
FIFO is an io.ReadWriteCloser implementation that supports concurrent reads and writes to a temporary file. Reads begin from the start of the file and writes always append to the end. The type maintains separate read and write positions internally.
func NewFIFO ¶
NewFIFO creates a new FIFO backed by a temporary file. The caller is responsible for calling Close() to clean up the temporary file.
func NewFIFOInDir ¶
NewFIFOInDir creates a new FIFO backed by a temporary file in the provided directory. If dir is empty, the system temporary directory is used. The caller is responsible for calling Close() to clean up the temporary file.
func (*FIFO) Close ¶
Close closes the FIFO and removes the temporary file. Any blocked Read or Write operations will be interrupted. Close is safe to call multiple times.
func (*FIFO) CloseWrite ¶
func (f *FIFO) CloseWrite()
CloseWrite signals that no more writes will happen. Readers can still read remaining data, and will receive EOF when all data is consumed. Does not clean up resources - use Close() for that.