blob

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 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

Overview

Package blob implements the content-addressed BlobStore (§31). Content is stored by SHA-256 digest under blobs/sha256/<digest>. An optional redactor is applied before digest computation so that secrets never reach the store (§47).

Index

Constants

This section is empty.

Variables

View Source
var ErrDigestMismatch = errors.New("blob: content does not match digest")

ErrDigestMismatch is returned when stored content does not match its digest.

Functions

func Digest

func Digest(content []byte) string

Digest returns the lowercase hex SHA-256 of content.

Types

type Redactor

type Redactor func(content []byte) ([]byte, error)

Redactor transforms content before it is persisted. It is the security choke point for redaction (§48).

type Store

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

Store is a content-addressed blob store rooted at a directory.

func New

func New(root string, redact Redactor) (*Store, error)

New creates a Store rooted at dir (which is created if absent).

func (*Store) Exists

func (s *Store) Exists(digest string) (bool, error)

Exists reports whether a blob with the given digest is present.

func (*Store) Get

func (s *Store) Get(digest string) ([]byte, error)

Get reads and verifies content for a digest.

func (*Store) Put

func (s *Store) Put(content []byte) (string, error)

Put stores content (post-redaction) and returns its digest. Writes are atomic: content is written to a temp file and renamed into place.

func (*Store) WriteTo

func (s *Store) WriteTo(digest string, w io.Writer) (int64, error)

WriteTo streams blob content to w after verification.

Jump to

Keyboard shortcuts

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