Documentation
¶
Index ¶
- func AtomicWriteFile(filename string, data []byte, perm os.FileMode) errordeprecated
- func NewAtomicFileWriter(filename string, perm os.FileMode) (io.WriteCloser, error)deprecated
- func NewAtomicWriteSet(tmpDir string) (*atomicwriter.WriteSet, error)deprecated
- func NewCancelReadCloser(ctx context.Context, in io.ReadCloser) io.ReadCloser
- func NewReadCloserWrapper(r io.Reader, closer func() error) io.ReadCloser
- func NewWriteCloserWrapper(r io.Writer, closer func() error) io.WriteCloser
- type AtomicWriteSetdeprecated
- type WriteFlusher
- Bugs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AtomicWriteFile
deprecated
added in
v1.12.0
func NewAtomicFileWriter
deprecated
added in
v1.12.0
NewAtomicFileWriter returns WriteCloser so that writing to it writes to a temporary file and closing it atomically changes the temporary file to destination path. Writing and closing concurrently is not allowed. NOTE: umask is not considered for the file's permissions.
Deprecated: use atomicwriter.New instead.
func NewAtomicWriteSet
deprecated
added in
v1.13.0
func NewAtomicWriteSet(tmpDir string) (*atomicwriter.WriteSet, error)
NewAtomicWriteSet creates a new atomic write set to atomically create a set of files. The given directory is used as the base directory for storing files before commit. If no temporary directory is given the system default is used.
Deprecated: use atomicwriter.NewWriteSet instead.
func NewCancelReadCloser ¶ added in v1.10.0
func NewCancelReadCloser(ctx context.Context, in io.ReadCloser) io.ReadCloser
NewCancelReadCloser creates a wrapper that closes the ReadCloser when the context is cancelled. The returned io.ReadCloser must be closed when it is no longer needed.
func NewReadCloserWrapper ¶
func NewReadCloserWrapper(r io.Reader, closer func() error) io.ReadCloser
NewReadCloserWrapper wraps an io.Reader, and implements an io.ReadCloser. It calls the given callback function when closed.
func NewWriteCloserWrapper ¶
func NewWriteCloserWrapper(r io.Writer, closer func() error) io.WriteCloser
NewWriteCloserWrapper returns a new io.WriteCloser.
Types ¶
type AtomicWriteSet
deprecated
added in
v1.13.0
type AtomicWriteSet = atomicwriter.WriteSet
AtomicWriteSet is used to atomically write a set of files and ensure they are visible at the same time. Must be committed to a new directory.
Deprecated: use atomicwriter.WriteSet instead.
type WriteFlusher ¶ added in v1.7.0
type WriteFlusher struct {
// contains filtered or unexported fields
}
WriteFlusher wraps the Write and Flush operation ensuring that every write is a flush. In addition, the Close method can be called to intercept Read/Write calls if the targets lifecycle has already ended.
func NewWriteFlusher ¶ added in v1.7.0
func NewWriteFlusher(w io.Writer) *WriteFlusher
NewWriteFlusher returns a new WriteFlusher.
func (*WriteFlusher) Close ¶ added in v1.9.1
func (wf *WriteFlusher) Close() error
Close closes the write flusher, disallowing any further writes to the target. After the flusher is closed, all calls to write or flush will result in an error.
func (*WriteFlusher) Flush ¶ added in v1.7.0
func (wf *WriteFlusher) Flush()
Flush the stream immediately.
func (*WriteFlusher) Flushed ¶ added in v1.7.0
func (wf *WriteFlusher) Flushed() bool
Flushed returns the state of flushed. If it's flushed, return true, or else it return false.
Notes ¶
Bugs ¶
Remove this method. Its use is inherently racy. Seems to be used to detect whether or a response code has been issued or not. Another hook should be used instead.