writer

package
v0.0.0-...-78347b9 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IntToLetters

func IntToLetters(number int32) (letters string)

IntToLetters is convert number to alpha to chunk sufix. Like aa, ab, ac..

Types

type Option

type Option = func(*Writer)

Option is the type of an option passed to NewWriter.

func Bits

func Bits(n uint) Option

Bits is an option for NewWriter that changes the number of trailing zero bits in the rolling checksum used to identify chunk boundaries. A chunk boundary occurs on average once every 2^n bytes. (But the actual median chunk size is the logarithm, base (2^n-1)/(2^n), of 0.5.) The default value for n is 16, producing a chunk boundary every 65,536 bytes, and a median chunk size of 45,426 bytes.

func Fanout

func Fanout(n uint) Option

Fanout is an option for NewWriter that can change the fanout of the nodes in the tree produced. The value of n must be 1 or higher. The default is 8. In a nutshell, nodes in the hashsplit tree will tend to have around 2n children each, because each chunk's "level" is reduced by dividing it by n. For more information see https://pkg.go.dev/github.com/bobg/hashsplit#TreeBuilder.Add.

func MinBytesOfPart

func MinBytesOfPart(n int) Option

MinBytesOfPart is an option for NewWriter that sets a lower bound on the size of a file part. The default is 1 048 576 byte

func MinSize

func MinSize(n int) Option

MinSize is an option for NewWriter that sets a lower bound on the size of a chunk. No chunk may be smaller than this, except for the final one in the input stream. The value must be 64 or higher. The default is 1024.

func Prefix

func Prefix(s string) Option

Prefix is an option for NewWriter that sets a file name prefeix to io.writer

type Writer

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

Writer is an io.WriteCloser that splits its input with a hashsplit.Splitter, It additionally assembles those chunks into a tree with a hashsplit.TreeBuilder.

func NewWriter

func NewWriter(opts ...Option) *Writer

NewWriter produces a new Writer writing to the file.

func (*Writer) Close

func (w *Writer) Close() error

Close implements io.Closer.

func (*Writer) Write

func (w *Writer) Write(inp []byte) (int, error)

Write implements io.Writer.

Jump to

Keyboard shortcuts

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