format

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const Default = text.Name

Default holds the name of the default format.

Variables

This section is empty.

Functions

func DoFormat added in v1.4.0

func DoFormat(cfg Config, log logr.Logger) (result error)

DoFormat applies a format to a given input.

Types

type Config added in v1.4.0

type Config interface {
	Input() (io.Reader, error)
	InputInfo() input.Input
	Formats() ([]Format, error)
}

Config define the configuration input required for creating an output format.

type Factory

type Factory struct {
	io.Closer
	// contains filtered or unexported fields
}

Factory creates output writers for the different part of a Shamir split part.

func NewFactory

func NewFactory(c []Format, encrypt bool, log logr.Logger) *Factory

NewFactory creates a new instance of Factory.

func (*Factory) Close

func (f *Factory) Close() error

Close closes all the open file handles. This is done in reverse order like it would happen by using defer.

func (*Factory) Create

func (f *Factory) Create(x byte) (io.Writer, error)

Create is a factory method to be passed to the Shamir splitter.

type Format

type Format interface {
	// OutputFileName returns the file name for the given x.
	OutputFileName(x byte) string

	// Writer creates a new format writer for the part identified by x
	Writer(x byte) (io.Writer, []io.Closer, error)

	// Reader creates a new format reader using the given reader as input.
	Reader(r io.Reader) (io.Reader, error)

	// Name returns the formats name.
	Name() string
}

Format describes the interface for the various input/output formats.

func New

func New(format string, input input.Input) (Format, error)

New creates a new format object.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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