Documentation ¶
Index ¶
- func BenchmarkOverlayPerformance(bt *testing.B)
- func FixedSizeWriter(w io.Writer, maxCapacity int) io.Writer
- func NopWriteCloser(w io.Writer) io.WriteCloser
- type FileMetadata
- type Marshaller
- type MultiWriteCloser
- func (mw *MultiWriteCloser) AddWriteCloser(w io.WriteCloser) *MultiWriteCloser
- func (mw *MultiWriteCloser) AddWriter(w io.Writer) *MultiWriteCloser
- func (mw *MultiWriteCloser) Close() error
- func (mw *MultiWriteCloser) SetOnClose(onClose func()) *MultiWriteCloser
- func (mw *MultiWriteCloser) Write(b []byte) (int, error)
- type Overlay
- type OverlayMetadata
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FixedSizeWriter ¶
FixedSizeWriter creates writer that forwards at most maxCapacity byte to the underlying writer.
func NopWriteCloser ¶
func NopWriteCloser(w io.Writer) io.WriteCloser
Types ¶
type FileMetadata ¶
type Marshaller ¶
type Marshaller[T any] struct { Marshal func(*T) ([]byte, error) Unmarshal func([]byte) (*T, error) }
Marshaller contains reader and writer for a given format. Used when you need to write same data into different file types (e.g. json, binary, text...)
func NewJsonMarshal ¶
func NewJsonMarshal[T any]() *Marshaller[T]
NewJsonMarshal creates a reader/writer for Json file type
type MultiWriteCloser ¶
type MultiWriteCloser struct { io.WriteCloser // contains filtered or unexported fields }
MultiWriteCloser is similar to the io.MultiWriter, but with the Close() method.
func NewMultiWriteCloser ¶
func NewMultiWriteCloser() *MultiWriteCloser
NewMultiWriteCloser creates default MultiWriteCloser with empty writers and no onClose function.
func (*MultiWriteCloser) AddWriteCloser ¶
func (mw *MultiWriteCloser) AddWriteCloser(w io.WriteCloser) *MultiWriteCloser
AddWriterCloser adds another writerCloser that will accept data written to the MultiWriteCloser. Its Close() method invoked when parent onCall is invoked.
func (*MultiWriteCloser) AddWriter ¶
func (mw *MultiWriteCloser) AddWriter(w io.Writer) *MultiWriteCloser
AddWriter adds another writer that will accept data written to the MultiWriteCloser.
func (*MultiWriteCloser) Close ¶
func (mw *MultiWriteCloser) Close() error
Close invokes "Close" for all underlying WriteClosers, returns an error if any of them fails.
func (*MultiWriteCloser) SetOnClose ¶
func (mw *MultiWriteCloser) SetOnClose(onClose func()) *MultiWriteCloser
SetOnClose configures a function that is called after all child WriteClosers successfuly closed.
type Overlay ¶
type Overlay interface { OpenRead(name string) (io.ReadCloser, error) OpenWrite(name string) (io.WriteCloser, error) GetMetadata(names []string) []*FileMetadata }
Overlay is an extra layer between the filesystem (io) and the user code.
func NewLocalOverlay ¶
func NewLocalOverlay(root string, marshaller *Marshaller[OverlayMetadata]) (Overlay, error)
type OverlayMetadata ¶
type OverlayMetadata struct {
FileMetadata map[string]*FileMetadata `json:"fileMetadata"`
}
OverlayMetadata contains a system information for the overlay (e.g. file list)