package ioutil
import "github.com/containerd/containerd/pkg/ioutil"
Index ¶
- func NewNopWriteCloser(w io.Writer) io.WriteCloser
- func NewSerialWriteCloser(wc io.WriteCloser) io.WriteCloser
- func NewWrapReadCloser(r io.Reader) io.ReadCloser
- func NewWriteCloseInformer(wc io.WriteCloser) (io.WriteCloser, <-chan struct{})
- type WriterGroup
Functions ¶
func NewNopWriteCloser ¶
func NewNopWriteCloser(w io.Writer) io.WriteCloser
NewNopWriteCloser creates the nopWriteCloser from a writer.
func NewSerialWriteCloser ¶
func NewSerialWriteCloser(wc io.WriteCloser) io.WriteCloser
NewSerialWriteCloser creates a SerialWriteCloser from a write closer.
func NewWrapReadCloser ¶
func NewWrapReadCloser(r io.Reader) io.ReadCloser
NewWrapReadCloser creates a wrapReadCloser from a reader. NOTE(random-liu): To avoid goroutine leakage, the reader passed in must be eventually closed by the caller.
func NewWriteCloseInformer ¶
func NewWriteCloseInformer(wc io.WriteCloser) (io.WriteCloser, <-chan struct{})
NewWriteCloseInformer creates the writeCloseInformer from a write closer.
Types ¶
type WriterGroup ¶
type WriterGroup struct {
// contains filtered or unexported fields
}
WriterGroup is a group of writers. Writer could be dynamically added and removed.
func NewWriterGroup ¶
func NewWriterGroup() *WriterGroup
NewWriterGroup creates an empty writer group.
func (*WriterGroup) Add ¶
func (g *WriterGroup) Add(key string, w io.WriteCloser)
Add adds a writer into the group. The writer will be closed if the writer group is closed.
func (*WriterGroup) Close ¶
func (g *WriterGroup) Close()
Close closes the writer group. Write will return error after closed.
func (*WriterGroup) Get ¶
func (g *WriterGroup) Get(key string) io.WriteCloser
Get gets a writer from the group, returns nil if the writer doesn't exist.
func (*WriterGroup) Remove ¶
func (g *WriterGroup) Remove(key string)
Remove removes a writer from the group.
func (*WriterGroup) Write ¶
func (g *WriterGroup) Write(p []byte) (int, error)
Write writes data into each writer. If a writer returns error, it will be closed and removed from the writer group. It returns error if writer group is empty.
Source Files ¶
read_closer.go write_closer.go writer_group.go
- Version
- v1.6.0-beta.2
- Published
- Nov 11, 2021
- Platform
- linux/amd64
- Imports
- 3 packages
- Last checked
- 32 minutes ago –
Tools for package owners.