crust

package
v0.0.0-...-542f621 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenSealContext

func GenSealContext(ctx context.Context, root cid.Cid) context.Context

func GetRootFromSealContext

func GetRootFromSealContext(ctx context.Context) (cid.Cid, error)

func GetSize

func GetSize(item *badger.Item) (int, error)

func GetStoreFlag

func GetStoreFlag(root cid.Cid, blockCid cid.Cid) bool

func IsWarpedSealedBlock

func IsWarpedSealedBlock(block interface{}) bool

func SetStoreFlag

func SetStoreFlag(root cid.Cid, blockCid cid.Cid)

func Unseal

func Unseal(path string) ([]byte, error, int)

Types

type SWorker

type SWorker struct {
	// contains filtered or unexported fields
}
var Worker *SWorker = nil

func NewSWorker

func NewSWorker(url string) *SWorker

func (*SWorker) EndSeal

func (sw *SWorker) EndSeal(root cid.Cid) (bool, error)

func (*SWorker) GetUrl

func (sw *SWorker) GetUrl() string

func (*SWorker) Seal

func (sw *SWorker) Seal(root cid.Cid, newBlock bool, value []byte) (bool, string, error)

func (*SWorker) SetUrl

func (sw *SWorker) SetUrl(url string)

func (*SWorker) StartSeal

func (sw *SWorker) StartSeal(root cid.Cid) (bool, error)

type SealedBlock

type SealedBlock struct {
	Path string `json:"p"`
	Size int    `json:"s"`
}

Sealed block info

func TryGetSealedBlock

func TryGetSealedBlock(value []byte) (bool, *SealedBlock)

func (*SealedBlock) ToSealedInfo

func (sb *SealedBlock) ToSealedInfo() *SealedInfo

type SealedInfo

type SealedInfo struct {
	Sbs []SealedBlock `json:"b"`
}

All sealed block info

func MergeSealedInfo

func MergeSealedInfo(a *SealedInfo, b *SealedInfo) *SealedInfo

func TryGetSealedInfo

func TryGetSealedInfo(value []byte) (bool, *SealedInfo)

func (*SealedInfo) AddSealedBlock

func (si *SealedInfo) AddSealedBlock(sb SealedBlock) *SealedInfo

func (*SealedInfo) Bytes

func (si *SealedInfo) Bytes() []byte

type WarpedSealedBlock

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

Warp sealed block for putting, realize block.Block interface

func NewWarpedSealedBlock

func NewWarpedSealedBlock(path string, size int, c cid.Cid) *WarpedSealedBlock

func (*WarpedSealedBlock) Cid

func (b *WarpedSealedBlock) Cid() cid.Cid

func (*WarpedSealedBlock) Loggable

func (b *WarpedSealedBlock) Loggable() map[string]interface{}

func (*WarpedSealedBlock) RawData

func (b *WarpedSealedBlock) RawData() []byte

func (*WarpedSealedBlock) String

func (b *WarpedSealedBlock) String() string

Jump to

Keyboard shortcuts

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