cachedigest

package
v0.26.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidEncoding = errors.Errorf("invalid encoding")
View Source
var ErrNotFound = errors.Errorf("not found")

Functions

func FromBytes

func FromBytes(dt []byte, t Type) (digest.Digest, error)

func SetDefaultDB

func SetDefaultDB(db *DB)

Types

type DB

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

func GetDefaultDB

func GetDefaultDB() *DB

func NewDB

func NewDB(path string) (*DB, error)

func (*DB) All

func (d *DB) All(ctx context.Context, cb func(key string, typ Type, frames []Frame) error) error

func (*DB) Close

func (d *DB) Close() error

func (*DB) FromBytes

func (d *DB) FromBytes(dt []byte, typ Type) (digest.Digest, error)

func (*DB) Get

func (d *DB) Get(ctx context.Context, dgst string) (Type, []Frame, error)

func (*DB) NewHash

func (d *DB) NewHash(typ Type) *Hash

func (*DB) Wait

func (d *DB) Wait()

type Frame

type Frame struct {
	ID   FrameID `json:"type"`
	Data []byte  `json:"data,omitempty"`
}

type FrameID

type FrameID uint32
const (
	FrameIDType FrameID = 1
	FrameIDData FrameID = 2
	FrameIDSkip FrameID = 3
)

func (FrameID) String

func (f FrameID) String() string

type Hash

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

func NewHash

func NewHash(typ Type) *Hash

func (*Hash) BlockSize

func (h *Hash) BlockSize() int

func (*Hash) Reset

func (h *Hash) Reset()

func (*Hash) Size

func (h *Hash) Size() int

func (*Hash) Sum

func (h *Hash) Sum() digest.Digest

func (*Hash) Write

func (h *Hash) Write(p []byte) (n int, err error)

func (*Hash) WriteNoDebug

func (h *Hash) WriteNoDebug(p []byte) (n int, err error)

type Record

type Record struct {
	Digest     digest.Digest `json:"digest"`
	Type       Type          `json:"type"`
	Data       []Frame       `json:"data,omitempty"`
	SubRecords []*Record     `json:"subRecords,omitempty"`
}

func (*Record) LoadSubRecords

func (r *Record) LoadSubRecords(loader func(d digest.Digest) (Type, []Frame, error)) error

type Type

type Type string
const (
	TypeJSON       Type = "json"
	TypeString     Type = "string"
	TypeStringList Type = "string-list"
	TypeDigestList Type = "digest-list"
	TypeFileList   Type = "file-list"
	TypeFile       Type = "file"
)

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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