datastores

package
v0.0.0-...-32b09db Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2022 License: EPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BLOCK_BITS = 22 // Indicate that the blocksize is 4M
	BLOCK_SIZE = 1 << BLOCK_BITS
)

Variables

This section is empty.

Functions

func BlockCount

func BlockCount(fsize int64) int

func CalSha1

func CalSha1(b []byte, r io.Reader) ([]byte, error)

func CalcFileGcid

func CalcFileGcid(filename string) (string, error)

func DecodeBlock

func DecodeBlock(ctx context.Context, b blocks.Block) (int64, ipld.Node, error)

func GetEtag

func GetEtag(filename string) (etag string, err error)

Types

type EmptyBlockstore

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

func NewEmptyBlockstore

func NewEmptyBlockstore(fileSize int64, ctx context.Context) *EmptyBlockstore

func (*EmptyBlockstore) AllKeysChan

func (s *EmptyBlockstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error)

AllKeysChan returns a channel from which the CIDs in the Blockstore can be read. It should respect the given context, closing the channel if it becomes Done.

func (*EmptyBlockstore) DeleteBlock

func (s *EmptyBlockstore) DeleteBlock(context.Context, cid.Cid) error

func (*EmptyBlockstore) FileSHA1

func (s *EmptyBlockstore) FileSHA1() []byte

func (*EmptyBlockstore) Get

func (s *EmptyBlockstore) Get(context.Context, cid.Cid) (blocks.Block, error)

func (*EmptyBlockstore) GetBlockCount

func (s *EmptyBlockstore) GetBlockCount() int64

func (*EmptyBlockstore) GetFileSize

func (s *EmptyBlockstore) GetFileSize() int64

func (*EmptyBlockstore) GetSize

func (s *EmptyBlockstore) GetSize(context.Context, cid.Cid) (int, error)

GetSize returns the CIDs mapped BlockSize

func (*EmptyBlockstore) Has

func (s *EmptyBlockstore) Has(context.Context, cid.Cid) (bool, error)

func (*EmptyBlockstore) HashOnRead

func (s *EmptyBlockstore) HashOnRead(enabled bool)

HashOnRead specifies if every read block should be rehashed to make sure it matches its CID.

func (*EmptyBlockstore) HeadSHA1

func (s *EmptyBlockstore) HeadSHA1() []byte

func (*EmptyBlockstore) NodeMap

func (s *EmptyBlockstore) NodeMap() map[string]blocks.Block

func (*EmptyBlockstore) Put

Put puts a given block to the underlying datastore

func (*EmptyBlockstore) PutMany

func (s *EmptyBlockstore) PutMany(ctx context.Context, blocks []blocks.Block) error

PutMany puts a slice of blocks at the same time using batching capabilities of the underlying datastore whenever possible.

func (*EmptyBlockstore) Reslove

func (s *EmptyBlockstore) Reslove(cidString string, intptr *int64, currentBlockIDPtr *int) error

func (*EmptyBlockstore) SumWcsEtag

func (s *EmptyBlockstore) SumWcsEtag() string

func (*EmptyBlockstore) SumXL

func (s *EmptyBlockstore) SumXL() []byte

Jump to

Keyboard shortcuts

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