Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrorNoWriters is returned by a WriteMux created by NewWriteMuxWithErrors, // when there are zero writers in the mux. ErrorNoWriters = errors.New("there are no writer in the mux") )
Functions ¶
This section is empty.
Types ¶
type WriteMux ¶
type WriteMux struct {
// contains filtered or unexported fields
}
WriteMux is a WriteCloser that can have WriteClosers added and removed from the group, so that Write() and Close() calls can be mirrored to all mux members. All operations after proper initialization are goro-safe.
func NewWriteMux ¶
func NewWriteMux() WriteMux
NewWriteMux returns an initialized WriteMux. Writes that generate errors are ignored.
func NewWriteMuxWithErrors ¶
func NewWriteMuxWithErrors() WriteMux
NewWriteMuxWithErrors returns an initialized WriteMux. Writes that generate errors cause the Write to fail, returning a wrapped error with the index of the member causing the error. Subsequent members are not written to.
func (*WriteMux) Add ¶
func (w *WriteMux) Add(wc io.WriteCloser) (index string)
Add will add the WriteCloser to the mux, returning an index that can be used in the future to remove the WriteCloser from the mux. The index should not be intuited as any usable value beyond the future parameter to Remove().