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: 0

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