gotlob

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2026 License: GPL-3.0 Imports: 15 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 points to the blob that contains the Extent data
	Ref gdat.Ref
	// Offset is where the extent starts within a Blob
	Offset uint32
	// Length is the length of the Extent, starting at the offset.
	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 Machine

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

func NewMachine

func NewMachine(gkvop *gotkv.Machine, dop *gdat.Machine, opts ...Option) Machine

func (*Machine) CreateExtents

func (a *Machine) CreateExtents(ctx context.Context, ds stores.RW, r io.Reader) ([]*Extent, error)

func (*Machine) MaxExtent

func (ag *Machine) MaxExtent(ctx context.Context, ms stores.Reading, root Root, span Span) ([]byte, *Extent, error)

maxEntry finds the maximum extent entry in root within span.

func (*Machine) MinExtent

func (ag *Machine) MinExtent(ctx context.Context, ms stores.Reading, root Root, span Span) ([]byte, *Extent, error)

func (*Machine) NewBuilder

func (a *Machine) NewBuilder(ctx context.Context, ms, ds stores.RW) *Builder

func (*Machine) NewReader

func (a *Machine) NewReader(ctx context.Context, ms, ds stores.Reading, root Root, prefix []byte) (*Reader, error)

func (*Machine) SizeOf

func (a *Machine) SizeOf(ctx context.Context, ms stores.Reading, root Root, prefix []byte) (uint64, error)

func (*Machine) Splice

func (a *Machine) Splice(ctx context.Context, ss [2]stores.RW, segs []Segment) (*Root, error)

type Option

type Option func(a *Machine)

func WithChunking

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

WithChunking sets the chunking strategy used by the Machine

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