bowl

package
v0.0.0-...-189a019 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: MIT Imports: 15 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUninitializedWriter = fmt.Errorf("tried to write to source before Resume() was called")

Functions

This section is empty.

Types

type Bowl

type Bowl interface {
	// phase 1: patching
	Resume(checkpoint *BowlCheckpoint) error
	Save() (*BowlCheckpoint, error)
	GetWriter(index int64) (EntryWriter, error)
	Transpose(transposition Transposition) error

	// phase 2: committing
	Commit() error

	// cleanups
	Close() error
}

func NewDryBowl

func NewDryBowl(params *DryBowlParams) (Bowl, error)

NewDryBowl returns a bowl that throws away all writes

func NewFreshBowl

func NewFreshBowl(params FreshBowlParams) (Bowl, error)

NewFreshBowl returns a bowl that applies all writes to a given (initially empty) directory.

func NewOverlayBowl

func NewOverlayBowl(params OverlayBowlParams) (Bowl, error)

func NewPoolBowl

func NewPoolBowl(params PoolBowlParams) (Bowl, error)

NewPoolBowl returns a bowl that applies all writes to a writable pool

type BowlCheckpoint

type BowlCheckpoint struct {
	Data interface{}
}

type DryBowlParams

type DryBowlParams struct {
	SourceContainer *tlc.Container
	TargetContainer *tlc.Container
}

type EntryWriter

type EntryWriter interface {
	Resume(checkpoint *WriterCheckpoint) (int64, error)
	Save() (*WriterCheckpoint, error)
	Tell() int64
	Finalize() error
	io.WriteCloser
}

type FreshBowlParams

type FreshBowlParams struct {
	TargetContainer *tlc.Container
	SourceContainer *tlc.Container

	TargetPool   lake.Pool
	OutputFolder string
}

type Ghost

type Ghost struct {
	Kind GhostKind
	Path string
}

A Ghost is a file, directory, or symlink, that has disappeared from one container (target) to the next (source)

type GhostKind

type GhostKind int

GhostKind determines what went missing: a file, a directory, or a symlink

const (
	// GhostKindDir indicates that a directory has disappeared between two containers
	GhostKindDir GhostKind = iota + 0xfaf0
	// GhostKindFile indicates that a file has disappeared between two containers
	GhostKindFile
	// GhostKindSymlink indicates that a symbolic link has disappeared between two containers
	GhostKindSymlink
)

type OverlayBowlCheckpoint

type OverlayBowlCheckpoint struct {
	Transpositions []Transposition
	OverlayFiles   []int64
	MoveFiles      []int64
}

type OverlayBowlParams

type OverlayBowlParams struct {
	TargetContainer *tlc.Container
	SourceContainer *tlc.Container

	OutputFolder string
	StageFolder  string

	Consumer *state.Consumer
}

type OverlayEntryWriterCheckpoint

type OverlayEntryWriterCheckpoint struct {
	// This offset is how many bytes we've written into the
	// overlay, not how many bytes into the new file we are.
	OverlayOffset int64

	// This offset is how many bytes we've read from the target (old) file
	ReadOffset int64
}

type PoolBowlParams

type PoolBowlParams struct {
	TargetContainer *tlc.Container
	SourceContainer *tlc.Container

	TargetPool lake.Pool
	OutputPool lake.WritablePool
}

type Transposition

type Transposition struct {
	TargetIndex int64
	SourceIndex int64
}

type WriterCheckpoint

type WriterCheckpoint struct {
	Offset int64
	Data   interface{}
}

Jump to

Keyboard shortcuts

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