bsst

package
v0.0.0-...-9f67d33 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: Apache-2.0, MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BucketSize = 4096

	EntriesPerBucket = 128
	EntrySize        = BucketSize / EntriesPerBucket

	EntKeyBytes = 24 // with 24 bytes hash (192 bits, plenty enough to not get collisions), 8 for user offset

	BucketHeaderEntries = 1
	BucketUserEntries   = EntriesPerBucket - BucketHeaderEntries

	BucketBloomFilterSize    = EntrySize
	BucketBloomFilterEntries = BucketBloomFilterSize * 8

	MeanEntriesPerBucket = EntriesPerBucket/2 + EntriesPerBucket/4

	LevelFactor = 16384 // could be 24576, but we want to avoid deeper level misses
)

parameters dedicated by hardware / math

View Source
const BsstMagic = "BSST\x00\x00\x01\x00"

Variables

View Source
var BsstCIDSampleSize = 1024

Functions

This section is empty.

Types

type BSST

type BSST struct {
	CreateSample []multihash.Multihash
	// contains filtered or unexported fields
}

func Create

func Create(path string, entries int64, source Source) (bsst *BSST, err error)

func Open

func Open(path string) (*BSST, error)

func (*BSST) Close

func (h *BSST) Close() error

func (*BSST) Get

func (h *BSST) Get(c []multihash.Multihash) ([]int64, error)

Get returns offsets to data, -1 if not found

func (*BSST) Has

func (h *BSST) Has(c []multihash.Multihash) ([]bool, error)

type BSSTHeader

type BSSTHeader struct {
	L0Buckets  int64
	BucketSize int64
	Entries    int64
	Salt       [32]byte

	Levels      int64
	LevelFactor int64
	Finalized   bool
}

func (*BSSTHeader) MarshalCBOR

func (t *BSSTHeader) MarshalCBOR(w io.Writer) error

func (*BSSTHeader) UnmarshalCBOR

func (t *BSSTHeader) UnmarshalCBOR(r io.Reader) (err error)

type Source

type Source interface {
	// List calls the callback with multihashes in sorted order.
	// todo require source to be MHH sorted
	List(func(c multihash.Multihash, offs []int64) error) error
}

Jump to

Keyboard shortcuts

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