outputpathpersistency

package
v0.0.0-...-8401896 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReadCloser

type ReadCloser interface {
	Reader
	io.Closer
}

ReadCloser is identical to the Reader type, except that it has a Close() function that must be called exactly once to release any associated resources. Calling this function invalidates both the current ReadCloser and any Readers that were obtained recursively.

type Reader

type Reader interface {
	// ReadDirectory() reads a child directory from an output path
	// state file. In addition to the contents of the child
	// directory, a Reader is returned that may be used to access
	// grandchildren.
	ReadDirectory(fileRegion *outputpathpersistency.FileRegion) (Reader, *outputpathpersistency.Directory, error)
}

Reader of output path state files.

func NewFileReader

func NewFileReader(rawReader io.ReaderAt, maximumStateFileSizeBytes int64) (Reader, *outputpathpersistency.RootDirectory, error)

NewFileReader reads the header and the root directory from an output path state file. In addition to the contents of the root directory, a Reader is returned that may be used to access child directories.

type Store

type Store interface {
	// Read the persisted contents of an output path.
	Read(outputBaseID path.Component) (ReadCloser, *outputpathpersistency.RootDirectory, error)
	// Write the contents of an output path to a persistent state file.
	Write(outputBaseID path.Component) (WriteCloser, error)
	// Remove any state associated with given output path.
	Clean(outputBaseID path.Component) error
}

Store for contents of an output path. The contents of output paths are preserved as a tree of Protobuf directory messages, referring to child directories.

func NewDirectoryBackedStore

func NewDirectoryBackedStore(directory filesystem.Directory, maximumStateFileSizeBytes int64) Store

NewDirectoryBackedStore creates a store for persisting the contents of output paths that is backed by a directory.

func NewMaximumAgeStore

func NewMaximumAgeStore(base Store, clock clock.Clock, maximumStateFileAge time.Duration) Store

NewMaximumAgeStore creates a decorator for Store that rejects loading output path state files that exceed a certain age. This can be used to ensure that output paths don't accumulate data indefinitely.

type WriteCloser

type WriteCloser interface {
	Writer
	io.Closer
}

WriteCloser is identical to the Writer type, except that it has a Close() function that may be called to abandon a partially written state file.

Either the Finalize() or Close() function must be called exactly once to release any associated resources.

type Writer

type Writer interface {
	WriteDirectory(directory *outputpathpersistency.Directory) (*outputpathpersistency.FileRegion, error)
	Finalize(rootDirectory *outputpathpersistency.RootDirectory) error
}

Writer for output path state files. These files contain a header, followed a sequence of Directory messages and a trailing RootDirectory message.

func NewFileWriter

func NewFileWriter(rawWriter io.WriterAt) Writer

NewFileWriter creates a writer for output path state files. Against this handle zero or more WriteDirectory() calls should be performed, followed by one call to Finalize().

Jump to

Keyboard shortcuts

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