gdat

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: GPL-3.0 Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	Base64Alphabet = blobcache.Base64Alphabet
	RefSize        = blobcache.CIDSize + DEKSize
)
View Source
const DEKSize = 32

Variables

This section is empty.

Functions

func AppendRef

func AppendRef(out []byte, x Ref) []byte

func Copy

func Copy(ctx context.Context, src stores.RO, dst stores.WO, ref Ref) error

Copy copies the data at ref from src to dst.

func DeriveKey

func DeriveKey(out []byte, secret *[32]byte, additional []byte)

DeriveKey uses the blake2b XOF to fill out. The input to the XOF is additional and secret is used to key the XOF.

func DeriveStream

func DeriveStream(secret *[32]byte, additional []byte) io.Reader

DeriveStream returns a cryptographically secure psuedorandom stream derived from a high entropy secret, and arbitrary additional bytes.

func Equal

func Equal(a, b Ref) bool

Types

type DEK

type DEK [DEKSize]byte

func (DEK) MarshalText

func (dek DEK) MarshalText() ([]byte, error)

func (*DEK) String

func (*DEK) String() string

func (*DEK) UnmarshalText

func (dek *DEK) UnmarshalText(data []byte) error

type Machine

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

func NewMachine

func NewMachine(p Params) *Machine

func (*Machine) GetF

func (m *Machine) GetF(ctx context.Context, s stores.RO, ref Ref, fn func(data []byte) error) error

func (*Machine) Post

func (m *Machine) Post(ctx context.Context, s stores.WO, data []byte) (Ref, error)

func (*Machine) Read

func (m *Machine) Read(ctx context.Context, s stores.RO, ref Ref, buf []byte) (int, error)

type Params added in v0.4.0

type Params struct {
	Salt          [32]byte
	CacheSize     *int
	KeyedHashFunc blobcache.KeyedHashFunc
}

func (Params) GetCacheSize added in v0.5.0

func (p Params) GetCacheSize() int

func (Params) GetKeyedHashFunc added in v0.5.0

func (p Params) GetKeyedHashFunc() blobcache.KeyedHashFunc

type Ref

type Ref struct {
	CID blobcache.CID
	DEK DEK
}

func ParseRef

func ParseRef(x []byte) (ret Ref, _ error)

func (*Ref) Equals added in v0.3.0

func (r *Ref) Equals(other *Ref) bool

func (Ref) IsZero

func (r Ref) IsZero() bool

func (*Ref) Marshal

func (r *Ref) Marshal() []byte

func (Ref) MarshalBinary

func (r Ref) MarshalBinary() ([]byte, error)

func (Ref) MarshalText

func (r Ref) MarshalText() ([]byte, error)

func (Ref) String

func (r Ref) String() string

func (*Ref) Unmarshal

func (r *Ref) Unmarshal(data []byte) error

func (*Ref) UnmarshalBinary

func (ref *Ref) UnmarshalBinary(x []byte) error

func (*Ref) UnmarshalText

func (r *Ref) UnmarshalText(data []byte) error

Jump to

Keyboard shortcuts

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