Documentation ¶
Index ¶
- func AsyncWriterPipe() (*PipeReaderAt, *PipeWriterAt, error)
- func AsyncWriterPipeInDir(dirPath string) (*PipeReaderAt, *PipeWriterAt, error)
- func Pipe() (*PipeReaderAt, *PipeWriterAt, error)
- func PipeInDir(dirPath string) (*PipeReaderAt, *PipeWriterAt, error)
- type PipeReaderAt
- type PipeWriterAt
- func (w *PipeWriterAt) Close() error
- func (w *PipeWriterAt) CloseWithError(err error) error
- func (w *PipeWriterAt) GetWrittenBytes() int64
- func (w *PipeWriterAt) WaitForReader() error
- func (w *PipeWriterAt) Write(p []byte) (int, error)
- func (w *PipeWriterAt) WriteAt(p []byte, off int64) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsyncWriterPipe ¶
func AsyncWriterPipe() (*PipeReaderAt, *PipeWriterAt, error)
AsyncWriterPipe is just like Pipe but the writer is allowed to close before the reader is finished. Whereas in Pipe the writer blocks until the reader is done.
func AsyncWriterPipeInDir ¶
func AsyncWriterPipeInDir(dirPath string) (*PipeReaderAt, *PipeWriterAt, error)
AsyncWriterPipeInDir is just like AsyncWriterPipe but the temporary file is created inside the specified directory
func Pipe ¶
func Pipe() (*PipeReaderAt, *PipeWriterAt, error)
Pipe creates an asynchronous file based pipe. It can be used to connect code expecting an io.ReaderAt with code expecting an io.WriterAt. Writes all go to an unlinked temporary file, reads start up as the file gets written up to their area. It is safe to call multiple ReadAt and WriteAt in parallel with each other.
func PipeInDir ¶
func PipeInDir(dirPath string) (*PipeReaderAt, *PipeWriterAt, error)
PipeInDir just like Pipe but the temporary file is created inside the specified directory
Types ¶
type PipeReaderAt ¶
type PipeReaderAt struct {
// contains filtered or unexported fields
}
PipeReaderAt is the io.ReaderAt side of pipe.
func (*PipeReaderAt) Close ¶
func (r *PipeReaderAt) Close() error
Close will Close the temp file and subsequent writes or reads will return an ErrClosePipe error.
func (*PipeReaderAt) CloseWithError ¶
func (r *PipeReaderAt) CloseWithError(err error) error
CloseWithError sets error and otherwise behaves like Close.
func (*PipeReaderAt) GetReadedBytes ¶
func (r *PipeReaderAt) GetReadedBytes() int64
GetReadedBytes returns the bytes readed
type PipeWriterAt ¶
type PipeWriterAt struct {
// contains filtered or unexported fields
}
PipeWriterAt is the io.WriterAt side of pipe.
func (*PipeWriterAt) Close ¶
func (w *PipeWriterAt) Close() error
Close on the writer will let the reader know that writing is complete. Once the reader catches up it will continue to return 0 bytes and an EOF error.
func (*PipeWriterAt) CloseWithError ¶
func (w *PipeWriterAt) CloseWithError(err error) error
CloseWithError sets the error and otherwise behaves like Close.
func (*PipeWriterAt) GetWrittenBytes ¶
func (w *PipeWriterAt) GetWrittenBytes() int64
GetWrittenBytes returns the bytes written
func (*PipeWriterAt) WaitForReader ¶
func (w *PipeWriterAt) WaitForReader() error
WaitForReader will block until the reader is closed. Returns the error set when the reader closed.