gotlob

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalExtent

func MarshalExtent(e *Extent) []byte

func ParseExtentKey

func ParseExtentKey(x []byte) ([]byte, uint64, error)

Types

type Builder

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

Builder chunks large objects, stores them, and then writes extents to a gotkv instance.

func (*Builder) CopyExtent

func (b *Builder) CopyExtent(ctx context.Context, ext *Extent, isShort bool) error

func (*Builder) CopyExtents

func (b *Builder) CopyExtents(ctx context.Context, exts []*Extent) error

CopyExtents copies multiple extents to the current object.

func (*Builder) CopyFrom

func (b *Builder) CopyFrom(ctx context.Context, root Root, span Span) error

func (*Builder) Finish

func (b *Builder) Finish(ctx context.Context) (*Root, error)

func (*Builder) GetPrefix

func (b *Builder) GetPrefix(out []byte) []byte

GetPrefix appends the current prefix to out if it exists, or returns nil if it does not

func (*Builder) IsFinished

func (b *Builder) IsFinished() bool

func (*Builder) Put

func (b *Builder) Put(ctx context.Context, key, value []byte) error

Put inserts a literal key, value into key stream.

func (*Builder) SetPrefix

func (b *Builder) SetPrefix(prefix []byte) error

SetPrefix set's the prefix used to generate extent keys. Extents will be added as <prefix> + < 8 byte BigEndian extent >

func (*Builder) Write

func (b *Builder) Write(data []byte) (int, error)

Write writes extents and creates entries for them under prefix, as specified by the last call to SetPrefix

type Extent

type Extent struct {
	Ref    gdat.Ref
	Offset uint32
	Length uint32
}

Extent is a reference to data using the gdat.Ref type.

func ParseExtent

func ParseExtent(x []byte) (*Extent, error)

func (*Extent) MarshalBinary

func (e *Extent) MarshalBinary() ([]byte, error)

func (*Extent) UnmarshalBinary

func (e *Extent) UnmarshalBinary(data []byte) error

type Operator

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

func NewOperator

func NewOperator(gkvop *gotkv.Operator, dop *gdat.Operator, opts ...Option) Operator

func (*Operator) CreateExtents

func (o *Operator) CreateExtents(ctx context.Context, ds cadata.Store, r io.Reader) ([]*Extent, error)

func (*Operator) MaxExtent

func (op *Operator) MaxExtent(ctx context.Context, ms cadata.Store, root Root, span Span) ([]byte, *Extent, error)

maxEntry finds the maximum extent entry in root within span.

func (*Operator) MinExtent

func (op *Operator) MinExtent(ctx context.Context, ms cadata.Store, root Root, span Span) ([]byte, *Extent, error)

func (*Operator) NewBuilder

func (o *Operator) NewBuilder(ctx context.Context, ms, ds cadata.Store) *Builder

func (*Operator) NewReader

func (o *Operator) NewReader(ctx context.Context, ms, ds cadata.Store, root Root, prefix []byte) (*Reader, error)

func (*Operator) SizeOf

func (o *Operator) SizeOf(ctx context.Context, ms cadata.Store, root Root, prefix []byte) (uint64, error)

func (*Operator) Splice

func (o *Operator) Splice(ctx context.Context, ms, ds cadata.Store, segs []Segment) (*Root, error)

type Option

type Option func(o *Operator)

func WithChunking

func WithChunking(flushBetween bool, fn func(onChunk chunking.ChunkHandler) *chunking.ContentDefined) Option

WithChunking sets the chunking strategy used by the Operator

func WithFilter

func WithFilter(fn func([]byte) bool) Option

WithFilter sets a filter function, so that the operator ignores any keys where fn(key) is false.

type Reader

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

func (*Reader) Read

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

func (*Reader) ReadAt

func (r *Reader) ReadAt(buf []byte, offset int64) (int, error)

func (*Reader) Seek

func (r *Reader) Seek(offset int64, whence int) (int64, error)

type Ref

type Ref = gotkv.Ref

type Root

type Root = gotkv.Root

type Segment

type Segment struct {
	Root Root
	Span Span
}

func (Segment) String

func (s Segment) String() string

type Span

type Span = gotkv.Span

type Store

type Store = gotkv.Store

Jump to

Keyboard shortcuts

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