github.com/mutagen-io/mutagen@v0.18.0-rc1/pkg/stream/interfaces.go (about) 1 package stream 2 3 import ( 4 "io" 5 ) 6 7 // DualModeReader represents a reader that can perform both regular and 8 // single-byte reads efficiently. 9 type DualModeReader interface { 10 io.ByteReader 11 io.Reader 12 } 13 14 // CloseWriter represents a stream with half-closure functionality. 15 type CloseWriter interface { 16 io.Writer 17 // CloseWrite closes the stream for writes and signals io.EOF to the 18 // receiving end of the stream. It must unblock any pending calls to Write. 19 CloseWrite() error 20 } 21 22 // Flusher represents a stream that performs internal buffering that may need to 23 // be flushed to ensure transmission. 24 type Flusher interface { 25 // Flush forces transmission of any buffered stream data. 26 Flush() error 27 } 28 29 // WriteFlushCloser represents a stream with writing, flushing, and closing 30 // functionality. 31 type WriteFlushCloser interface { 32 io.Writer 33 Flusher 34 io.Closer 35 }