fileset

package
v1.9.10-e6932adad8179d... Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DefaultMemoryThreshold is the default for the memory threshold that must
	// be met before a file set part is serialized (excluding close).
	DefaultMemoryThreshold = 1024 * chunk.MB
	// DefaultShardThreshold is the default for the size threshold that must
	// be met before a shard is created by the shard function.
	DefaultShardThreshold = 1024 * chunk.MB
	// Compacted is the suffix of a path that points to the compaction of the prefix.
	Compacted = "compacted"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FileSet added in v1.9.6

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

FileSet is a set of files. This may be a full filesystem or a subfilesystem (e.g. datum / datum set / shard).

func (*FileSet) Close added in v1.9.6

func (f *FileSet) Close() error

Close closes the file set.

func (*FileSet) Delete added in v1.9.6

func (f *FileSet) Delete(name string)

Delete deletes a file from the file set. (bryce) might need to delete ancestor directories in certain cases.

func (*FileSet) StartTag added in v1.9.6

func (f *FileSet) StartTag(tag string)

StartTag starts a tag for the next set of files.

func (*FileSet) Write added in v1.9.6

func (f *FileSet) Write(data []byte) (int, error)

Write writes to the current file in the tar stream.

func (*FileSet) WriteHeader added in v1.9.6

func (f *FileSet) WriteHeader(hdr *tar.Header) error

WriteHeader writes a tar header and prepares to accept the file's contents. (bryce) should we prevent directories from being written here?

type Option added in v1.9.6

type Option func(f *FileSet)

Option configures a file set.

func WithRoot added in v1.9.6

func WithRoot(root string) Option

WithRoot sets the root path of the file set.

type Reader

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

Reader reads the serialized format of a fileset.

func (*Reader) Close

func (r *Reader) Close() error

Close closes the reader.

func (*Reader) Next

func (r *Reader) Next() (*index.Header, error)

Next returns the next header, and prepares the file's content for reading.

func (*Reader) Peek

func (r *Reader) Peek() (*index.Header, error)

Peek returns the next header without progressing the reader.

func (*Reader) PeekTag

func (r *Reader) PeekTag() (*index.Tag, error)

PeekTag returns the next tag without progressing the reader.

func (*Reader) Read

func (r *Reader) Read(data []byte) (int, error)

Read reads from the current file in the tar stream.

type ShardFunc added in v1.9.8

type ShardFunc func(*index.PathRange) error

ShardFunc is a callback that returns a PathRange for each shard.

type Storage

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

Storage is the abstraction that manages fileset storage.

func NewStorage

func NewStorage(objC obj.Client, chunks *chunk.Storage, opts ...StorageOption) *Storage

NewStorage creates a new Storage.

func (*Storage) Merge added in v1.9.8

func (s *Storage) Merge(ctx context.Context, outputFileSet string, inputFileSets []string, opts ...index.Option) error

Merge merges the file sets with the passed in prefix.

func (*Storage) New added in v1.9.6

func (s *Storage) New(ctx context.Context, fileSet string, opts ...Option) *FileSet

New creates a new in-memory fileset.

func (*Storage) NewReader

func (s *Storage) NewReader(ctx context.Context, fileSet string, opts ...index.Option) *Reader

NewReader creates a new Reader for a file set. (bryce) expose some notion of read ahead (read a certain number of chunks in parallel). this will be necessary to speed up reading large files.

func (*Storage) NewWriter

func (s *Storage) NewWriter(ctx context.Context, fileSet string) *Writer

NewWriter creates a new Writer.

func (*Storage) Shard added in v1.9.8

func (s *Storage) Shard(ctx context.Context, fileSets []string, shardFunc ShardFunc) error

Shard shards the merge of the file sets with the passed in prefix into file ranges. (bryce) this should be extended to be more configurable (different criteria for creating shards).

type StorageOption added in v1.9.8

type StorageOption func(s *Storage)

StorageOption configures a storage.

func ServiceEnvToOptions added in v1.9.8

func ServiceEnvToOptions(env *serviceenv.ServiceEnv) []StorageOption

ServiceEnvToOptions converts a service environment configuration (specifically the storage configuration) to a set of storage options.

func WithMemoryThreshold added in v1.9.8

func WithMemoryThreshold(threshold int64) StorageOption

WithMemoryThreshold sets the memory threshold that must be met before a file set part is serialized (excluding close).

func WithShardThreshold added in v1.9.8

func WithShardThreshold(threshold int64) StorageOption

WithShardThreshold sets the size threshold that must be met before a shard is created by the shard function.

type Writer

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

Writer writes the serialized format of a fileset. The serialized format of a fileset consists of indexes and content which are both realized as compressed tar stream chunks.

func (*Writer) Close

func (w *Writer) Close() error

Close closes the writer. (bryce) is not closing the tar writer the right choice here? We cannot include it in the last file's range because it will effect the hash. Our indexing is what will exit the reading of the tar stream, not the end of tar entry (two empty 512 bytes).

func (*Writer) CopyFiles added in v1.9.5

func (w *Writer) CopyFiles(r *Reader, pathBound ...string) error

CopyFiles does a cheap copy of files from a reader to a writer. (bryce) need to handle delete operations.

func (*Writer) CopyTags added in v1.9.5

func (w *Writer) CopyTags(r *Reader, tagBound ...string) error

CopyTags does a cheap copy of tagged file data from a reader to a writer.

func (*Writer) StartTag

func (w *Writer) StartTag(id string)

StartTag starts a tag for the next set of bytes (used for the reverse index, mapping file output to datums).

func (*Writer) Write

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

Write writes to the current file in the tar stream.

func (*Writer) WriteHeader

func (w *Writer) WriteHeader(hdr *index.Header) error

WriteHeader writes a tar header and prepares to accept the file's contents.

Directories

Path Synopsis
Package tar implements access to tar archives.
Package tar implements access to tar archives.

Jump to

Keyboard shortcuts

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