package ioutils
import "github.com/dotcloud/docker/pkg/ioutils"
Index ¶
- func AtomicWriteFile(filename string, data []byte, perm os.FileMode) error
- func NewAtomicFileWriter(filename string, perm os.FileMode) (io.WriteCloser, error)
- func NewAtomicWriteSet(tmpDir string) (*atomicwriter.WriteSet, error)
- 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 AtomicWriteSet
- type WriteFlusher
- func NewWriteFlusher(w io.Writer) *WriteFlusher
- func (wf *WriteFlusher) Close() error
- func (wf *WriteFlusher) Flush()
- func (wf *WriteFlusher) Flushed() bool
- func (wf *WriteFlusher) Write(b []byte) (n int, err error)
- Bugs
Functions ¶
func AtomicWriteFile ¶
AtomicWriteFile atomically writes data to a file named by filename and with the specified permission bits. NOTE: umask is not considered for the file's permissions.
Deprecated: use atomicwriter.WriteFile instead.
func NewAtomicFileWriter ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
func NewWriteFlusher(w io.Writer) *WriteFlusher
NewWriteFlusher returns a new WriteFlusher.
func (*WriteFlusher) Close ¶
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 ¶
func (wf *WriteFlusher) Flush()
Flush the stream immediately.
func (*WriteFlusher) Flushed ¶
func (wf *WriteFlusher) Flushed() bool
Flushed returns the state of flushed. If it's flushed, return true, or else it return false.
func (*WriteFlusher) Write ¶
func (wf *WriteFlusher) Write(b []byte) (n int, err error)
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.
Source Files ¶
fswriters_deprecated.go readers.go writeflusher.go writers.go
- Version
- v28.0.1+incompatible
- Published
- Feb 26, 2025
- Platform
- js/wasm
- Imports
- 8 packages
- Last checked
- 11 minutes ago –
Tools for package owners.