Documentation ¶
Index ¶
- Constants
- func SubFileSetStr(subFileSet int64) string
- type CompactSpec
- type FileMergeReader
- type FileReader
- func (fr *FileReader) Get(w io.Writer) error
- func (fr *FileReader) Header() (*tar.Header, error)
- func (fr *FileReader) Index() *index.Index
- func (fr *FileReader) Iterate(f func(*chunk.DataReader) error, tagUpperBound ...string) error
- func (fr *FileReader) NextTagReader() *chunk.TagReader
- func (fr *FileReader) PeekTag() (*chunk.Tag, error)
- type FileSet
- type MergeReader
- type Option
- type Reader
- type ShardFunc
- type Storage
- func (s *Storage) Compact(ctx context.Context, outputFileSet string, inputFileSets []string, ...) error
- func (s *Storage) CompactSpec(ctx context.Context, fileSet string, compactedFileSet ...string) (*CompactSpec, error)
- func (s *Storage) Delete(ctx context.Context, fileSet string) error
- func (s *Storage) New(ctx context.Context, fileSet, tag string, opts ...Option) *FileSet
- func (s *Storage) NewMergeReader(ctx context.Context, fileSets []string, opts ...index.Option) (*MergeReader, error)
- func (s *Storage) Shard(ctx context.Context, fileSets []string, shardFunc ShardFunc) error
- type StorageOption
- type TagMergeReader
- type TagSetMergeReader
- type Writer
Constants ¶
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 // DefaultLevelZeroSize is the default size for level zero in the compacted // representation of a file set. DefaultLevelZeroSize = 1 * chunk.MB // DefaultLevelSizeBase is the default base of the exponential growth function // for level sizes in the compacted representation of a file set. DefaultLevelSizeBase = 10 // Diff is the suffix of a path that points to the diff of the prefix. Diff = "diff" // Compacted is the suffix of a path that points to the compaction of the prefix. Compacted = "compacted" )
Variables ¶
This section is empty.
Functions ¶
func SubFileSetStr ¶
SubFileSetStr returns the string representation of a subfileset.
Types ¶
type CompactSpec ¶
CompactSpec specifies the input and output for a compaction operation.
type FileMergeReader ¶
type FileMergeReader struct {
// contains filtered or unexported fields
}
FileMergeReader is an abstraction for reading a merged file.
func (*FileMergeReader) Get ¶
func (fmr *FileMergeReader) Get(w io.Writer) error
Get writes the merged file. (bryce) it might be cleaner to check if w is of type *Writer then use WriteTo rather than Get.
func (*FileMergeReader) Header ¶
func (fmr *FileMergeReader) Header() (*tar.Header, error)
Header returns the tar header for the merged file.
func (*FileMergeReader) Index ¶
func (fmr *FileMergeReader) Index() *index.Index
Index returns the index for the merged file.
func (*FileMergeReader) TagSetMergeReader ¶
func (fmr *FileMergeReader) TagSetMergeReader() (*TagSetMergeReader, error)
TagSetMergeReader returns the tagset merge reader for the file. This is how you would get just the data in the file (excludes the tar header and padding).
func (*FileMergeReader) WriteTo ¶
func (fmr *FileMergeReader) WriteTo(w *Writer) error
WriteTo writes the merged file to the passed in fileset writer.
type FileReader ¶
type FileReader struct {
// contains filtered or unexported fields
}
FileReader is an abstraction for reading a file.
func (*FileReader) Header ¶
func (fr *FileReader) Header() (*tar.Header, error)
Header returns the tar header for the file.
func (*FileReader) Index ¶
func (fr *FileReader) Index() *index.Index
Index returns the index for the file.
func (*FileReader) Iterate ¶
func (fr *FileReader) Iterate(f func(*chunk.DataReader) error, tagUpperBound ...string) error
Iterate iterates over the data readers for the data in the file. tagUpperBound is an optional parameter for specifiying the upper bound (exclusive) of the iteration.
func (*FileReader) NextTagReader ¶
func (fr *FileReader) NextTagReader() *chunk.TagReader
NextTagReader returns a tag reader for the next tagged data in the file.
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).
type MergeReader ¶
type MergeReader struct {
// contains filtered or unexported fields
}
MergeReader merges a file's content that shows up across multiple fileset streams. A file's content is ordered based on the lexicographical order of the tagged content, so the output file content is produced by performing a merge of the tagged content.
func (*MergeReader) Get ¶
func (mr *MergeReader) Get(w io.Writer) error
Get writes the merged fileset.
func (*MergeReader) Iterate ¶
func (mr *MergeReader) Iterate(f func(*FileMergeReader) error) error
Iterate iterates over the file merge readers in the merged fileset.
func (*MergeReader) WriteTo ¶
func (mr *MergeReader) WriteTo(w *Writer) error
WriteTo writes the merged fileset to the passed in fileset writer.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader reads the serialized format of a fileset.
func (*Reader) Iterate ¶
func (r *Reader) Iterate(f func(*FileReader) error, pathBound ...string) error
Iterate iterates over the file readers in the fileset. pathBound is an optional parameter for specifiying the upper bound (exclusive) of the iteration.
func (*Reader) Next ¶
func (r *Reader) Next() (*FileReader, error)
Next returns the next file reader and progresses the reader.
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage is the abstraction that manages fileset storage.
func NewStorage ¶
NewStorage creates a new Storage.
func (*Storage) Compact ¶
func (s *Storage) Compact(ctx context.Context, outputFileSet string, inputFileSets []string, opts ...index.Option) error
Compact compacts a set of filesets into an output fileset.
func (*Storage) CompactSpec ¶
func (s *Storage) CompactSpec(ctx context.Context, fileSet string, compactedFileSet ...string) (*CompactSpec, error)
CompactSpec returns a compaction specification that determines the input filesets (the diff file set and potentially compacted filesets) and output fileset.
func (*Storage) NewMergeReader ¶
func (s *Storage) NewMergeReader(ctx context.Context, fileSets []string, opts ...index.Option) (*MergeReader, error)
NewMergeReader returns a merge reader for a set for filesets.
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 WithLevelSizeBase ¶
func WithLevelSizeBase(base int) StorageOption
WithLevelSizeBase sets the base of the exponential growth function for level sizes in the compacted representation of a file set.
func WithLevelZeroSize ¶
func WithLevelZeroSize(size int64) StorageOption
WithLevelZeroSize sets the size for level zero in the compacted representation of a file set.
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 TagMergeReader ¶
type TagMergeReader struct {
// contains filtered or unexported fields
}
TagMergeReader is an abstraction for reading a merged tag. This abstraction is necessary because a tag in a file can appear across multiple filesets.
func (*TagMergeReader) Get ¶
func (tmr *TagMergeReader) Get(w io.Writer) error
Get writes the merged tagged data.
func (*TagMergeReader) Iterate ¶
func (tmr *TagMergeReader) Iterate(f func(*chunk.DataReader) error) error
Iterate iterates over the data readers for the tagged data being merged.
func (*TagMergeReader) WriteTo ¶
func (tmr *TagMergeReader) WriteTo(w *Writer) error
WriteTo writes the merged tagged data to the passed in fileset writer.
type TagSetMergeReader ¶
type TagSetMergeReader struct {
// contains filtered or unexported fields
}
TagSetMergeReader is an abstraction for reading the merged tagged data in a merged file.
func (*TagSetMergeReader) Get ¶
func (tsmr *TagSetMergeReader) Get(w io.Writer) error
Get writes the merged tagset.
func (*TagSetMergeReader) Iterate ¶
func (tsmr *TagSetMergeReader) Iterate(f func(*TagMergeReader) error) error
Iterate iterates over the tag merge readers in the merged tagset.
func (*TagSetMergeReader) WriteTo ¶
func (tsmr *TagSetMergeReader) WriteTo(w *Writer) error
WriteTo writes the merged tagset to the passed in fileset writer.
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.
func (*Writer) CopyFile ¶
func (w *Writer) CopyFile(fr *FileReader) error
CopyFile copies a file (header and tags included).
func (*Writer) CopyTags ¶ added in v1.9.5
func (w *Writer) CopyTags(dr *chunk.DataReader) error
CopyTags copies the tagged data from the passed in data reader.
func (*Writer) Tag ¶
Tag starts a tag for the next set of bytes (used for the reverse index, mapping file output to datums).