blob

package
v0.0.0-...-2c4dd60 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KB          = 1024
	WINDOW_SIZE = 2 * KB
	MIN         = 128 * KB
	AVG         = 256 * KB
	MAX         = 512 * KB
)
View Source
const (
	DefaultMaxFetchConns uint64 = 4
)

Variables

View Source
var (
	ErrWrongHash = errors.New("wrong hash")
)

Functions

func NewBadgerStore

func NewBadgerStore(badgerOpts badger.Options) *badgerStore

Types

type Chunker

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

func NewChunker

func NewChunker(reader io.ReadCloser) *Chunker

func (*Chunker) Close

func (c *Chunker) Close() error

func (*Chunker) Done

func (c *Chunker) Done() bool

func (*Chunker) Next

func (c *Chunker) Next() ([]byte, ManifestChunk, error)

func (*Chunker) Summary

func (c *Chunker) Summary() (_ Manifest, sha1, sha3 types.Hash)

type ID

type ID = pb.ID

type Manifest

type Manifest = pb.Manifest

type ManifestChunk

type ManifestChunk = pb.ManifestChunk

type Reader

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

func NewReader

func NewReader(db *state.DBTree, manifest Manifest, rng *types.Range) *Reader

func (*Reader) Close

func (r *Reader) Close() error

func (*Reader) Read

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

type Store

type Store interface {
	Start() error
	Close()

	MaxFetchConns() (uint64, error)
	SetMaxFetchConns(maxFetchConns uint64) error

	BlobReader(blobID ID, rng *types.Range) (io.ReadCloser, int64, error)
	HaveBlob(id ID) (bool, error)
	StoreBlob(reader io.ReadCloser) (sha1Hash types.Hash, sha3Hash types.Hash, err error)
	VerifyBlobOrPrune(blobID ID) error

	Manifest(id ID) (Manifest, error)
	HaveManifest(blobID ID) (bool, error)
	StoreManifest(blobID ID, manifest Manifest) error

	Chunk(sha3 types.Hash) ([]byte, error)
	HaveChunk(sha3 types.Hash) (bool, error)
	StoreChunkIfHashMatches(expectedSHA3 types.Hash, chunkBytes []byte) error

	// BlobIDs() *IDIterator
	BlobIDs() (sha1s, sha3s []ID, _ error)

	BlobsNeeded() ([]ID, error)
	MarkBlobsAsNeeded(refs []ID) error
	OnBlobsNeeded(fn func(refs []ID))
	OnBlobsSaved(fn func())

	Contents() (map[types.Hash]map[types.Hash]bool, error)
	DebugPrint()
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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