common

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidBlobName = errors.New("invalid blob name")
)

Functions

This section is empty.

Types

type BlobName

type BlobName []byte

BlobName is used to identify blobs. Internally it is a single array of bytes that represents both the type of the blob and internal hash used to create that blob. The type of the blob is not stored directly. Instead it is mixed with the hash of the blob to make sure that all bytes in the blob name are randomly distributed.

func BlobNameFromHashAndType

func BlobNameFromHashAndType(hash []byte, t BlobType) (BlobName, error)

BlobNameFromHashAndType generates the name of a blob from some hash (e.g. sha256 of blob's content) and given blob type

func BlobNameFromString

func BlobNameFromString(s string) (BlobName, error)

BlobNameFromString decodes base58-encoded string into blob name

func (BlobName) Hash

func (b BlobName) Hash() []byte

Extracts hash from blob name

func (BlobName) String

func (b BlobName) String() string

Returns base58-encoded blob name

func (BlobName) Type

func (b BlobName) Type() BlobType

Extracts blob type from the name

type BlobType

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

func NewBlobType

func NewBlobType(t byte) BlobType

func (BlobType) IDByte

func (b BlobType) IDByte() byte

Jump to

Keyboard shortcuts

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