multiwriter

package
v0.0.0-...-f6ab670 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2024 License: Apache-2.0 Imports: 3 Imported by: 4

Documentation

Overview

Package multiwriter implements a multi-writer

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultDocumentIOMultiWriter

type DefaultDocumentIOMultiWriter struct {
	// contains filtered or unexported fields
}

DefaultDocumentIOMultiWriter is the default implementation of multi-writer.

func NewDocumentIOMultiWriter

func NewDocumentIOMultiWriter() (b *DefaultDocumentIOMultiWriter)

NewDocumentIOMultiWriter creates a new document multi-writer

func (*DefaultDocumentIOMultiWriter) AddWriter

func (b *DefaultDocumentIOMultiWriter) AddWriter(writer *io.PipeWriter)

AddWriter adds a new writer to an existing multi-writer

func (*DefaultDocumentIOMultiWriter) Close

func (b *DefaultDocumentIOMultiWriter) Close() (err error)

Close waits for all the writers to be closed.

func (*DefaultDocumentIOMultiWriter) GetWaitGroup

func (b *DefaultDocumentIOMultiWriter) GetWaitGroup() *sync.WaitGroup

GetStreamClosedChannel adds a new writer to an existing multi-writer

func (*DefaultDocumentIOMultiWriter) Write

func (b *DefaultDocumentIOMultiWriter) Write(p []byte) (n int, err error)

Write is responsible for writing a byte to all the attached pipes.

func (*DefaultDocumentIOMultiWriter) WriteString

func (b *DefaultDocumentIOMultiWriter) WriteString(message string) (n int, err error)

WriteString is responsible for writing a string to all the attached pipes.

type DocumentIOMultiWriter

type DocumentIOMultiWriter interface {
	AddWriter(*io.PipeWriter)
	GetWaitGroup() *sync.WaitGroup
	Write([]byte) (int, error)
	WriteString(string) (int, error)
	Close() error
}

DocumentIOMultiWriter is a multi-writer with support for close channel. This is responsible for creating a fan-out multi-writer which allows you to duplicate the writes to all the provided writers.

Directories

Path Synopsis
Package multiwritermock creates the mock mulitwriter
Package multiwritermock creates the mock mulitwriter

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL