bundlr

package
v0.0.0-...-4fd8dbe Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DataDir                   = "data"
	DefaultDataFileNameFormat = "part-%05d.%s"
	DefaultDataFileExt        = "dat"
	DefaultPartSize           = 1000 * 1000
)
View Source
const (

	// Manifest schema version
	ManifestVersion = "1.0"
)

Variables

View Source
var ErrNilBundle = errors.New("nil bundle")
View Source
var ErrNotImplemented = errors.New("not implemented")
View Source
var ErrWriterClosed = errors.New("writer closed")

Functions

This section is empty.

Types

type Bundle

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

func OpenBundle

func OpenBundle(fs afero.Fs, path string) (*Bundle, error)

func (*Bundle) DataFS

func (b *Bundle) DataFS() afero.Fs

func (*Bundle) Delete

func (b *Bundle) Delete() error

func (*Bundle) FS

func (b *Bundle) FS() afero.Fs

func (*Bundle) Manifest

func (b *Bundle) Manifest() (*Manifest, error)

func (*Bundle) Reader

func (b *Bundle) Reader() (*Reader, error)

func (*Bundle) WithDecoderMaker

func (b *Bundle) WithDecoderMaker(maker DecoderMaker) *Bundle

func (*Bundle) WithEncoderMaker

func (b *Bundle) WithEncoderMaker(maker EncoderMaker) *Bundle

func (*Bundle) WithFileExtension

func (b *Bundle) WithFileExtension(ext string) *Bundle

func (*Bundle) WithFilter

func (b *Bundle) WithFilter(allowList []string, denyList []string) *Bundle

func (*Bundle) WithPartSize

func (b *Bundle) WithPartSize(n uint64) *Bundle

func (*Bundle) WriteManifest

func (b *Bundle) WriteManifest(manifest *Manifest) error

func (*Bundle) Writer

func (b *Bundle) Writer() (*Writer, error)

func (*Bundle) WriterWithPartSize

func (b *Bundle) WriterWithPartSize(n uint64) (*Writer, error)

type Decoder

type Decoder interface {
	Decode(record interface{}) error
	Close() error
}

type DecoderClosure

type DecoderClosure struct {
	DecodeFunc func(record interface{}) error
	CloseFunc  func() error
}

func (*DecoderClosure) Close

func (c *DecoderClosure) Close() error

func (*DecoderClosure) Decode

func (c *DecoderClosure) Decode(record interface{}) error

type DecoderMaker

type DecoderMaker interface {
	Make(File) (Decoder, error)
}

type DecoderMakerFunc

type DecoderMakerFunc func(f File) (Decoder, error)

func (DecoderMakerFunc) Make

func (m DecoderMakerFunc) Make(f File) (Decoder, error)

type Encoder

type Encoder interface {
	Encode(record interface{}) error
	Close() error
}

type EncoderClosure

type EncoderClosure struct {
	EncodeFunc func(record interface{}) error
	CloseFunc  func() error
}

func (*EncoderClosure) Close

func (c *EncoderClosure) Close() error

func (*EncoderClosure) Encode

func (c *EncoderClosure) Encode(record interface{}) error

type EncoderMaker

type EncoderMaker interface {
	Make(File) (Encoder, error)
}

type EncoderMakerFunc

type EncoderMakerFunc func(f File) (Encoder, error)

func (EncoderMakerFunc) Make

func (m EncoderMakerFunc) Make(f File) (Encoder, error)

type File

type File interface {
	afero.File
}

type Manifest

type Manifest struct {
	Version  string   `json:"version"`
	UserData UserData `json:"userdata"`
}

Manifest stores bundle metadata It is written as a json file at the root level of the bundle

type Reader

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

func NewReader

func NewReader(b *Bundle) (*Reader, error)

func (*Reader) Close

func (r *Reader) Close() error

func (*Reader) Read

func (r *Reader) Read(dst interface{}) error

type SourceFilter

type SourceFilter interface {
	Filter([]os.FileInfo) []os.FileInfo
}

func NewFilter

func NewFilter(allowList []string, denyList []string) SourceFilter

type UserData

type UserData map[string]interface{}

UserData allows to store any KV information

type Writer

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

func NewWriter

func NewWriter(b *Bundle, n uint64) (*Writer, error)

func (*Writer) Close

func (w *Writer) Close() error

func (*Writer) Write

func (w *Writer) Write(record interface{}) error

Jump to

Keyboard shortcuts

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