blob

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

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

Go to latest
Published: Nov 13, 2017 License: LGPL-3.0 Imports: 4 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package blob defines content-addressable type to contain arbitrary data.

Index

Constants

View Source
const DataLenHardLimit = 64 * 1024
View Source
const KeyLength = crypto.HashLength - 1

KeyLength length of blob key. It's shorter then crypto hash length for extension purpose.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blob

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

Blob data type stored in solidb

func New

func New(data []byte) *Blob

New construct a blob

func (*Blob) Data

func (blob *Blob) Data() []byte

Data get blob data

func (*Blob) Key

func (blob *Blob) Key() Key

Key compute key of blob data the computed key is cached

type Key

type Key [KeyLength]byte

Key key of blob, derrived from blob data

var EmptyKey Key

EmptyKey a key with all zero bytes

func KeyOfData

func KeyOfData(data []byte) Key

KeyOfData compute key of data

func ParseHexKey

func ParseHexKey(str string) (*Key, error)

ParseHexKey parse hex string to blob key

func (Key) MarshalJSON

func (k Key) MarshalJSON() ([]byte, error)

MarshalJSON Marshal JSON

func (Key) ToHex

func (k Key) ToHex() string

ToHex convert key into hex string (without '0x' prefix)

func (*Key) UnmarshalJSON

func (k *Key) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshal JSON

Jump to

Keyboard shortcuts

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