Documentation ¶
Overview ¶
Package blocks contains the lowest level of IPFS data structures. A block is raw data accompanied by a CID. The CID contains the multihash corresponding to the block.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrWrongHash = errors.New("data did not match given hash")
ErrWrongHash is returned when the Cid of a block is not the expected according to the contents. It is currently used only when debugging.
Functions ¶
This section is empty.
Types ¶
type BasicBlock ¶ added in v0.4.3
type BasicBlock struct {
// contains filtered or unexported fields
}
A BasicBlock is a singular block of data in ipfs. It implements the Block interface.
func NewBlock ¶
func NewBlock(data []byte) *BasicBlock
NewBlock creates a Block object from opaque data. It will hash the data.
func NewBlockWithCid ¶ added in v0.4.5
func NewBlockWithCid(data []byte, c *cid.Cid) (*BasicBlock, error)
NewBlockWithCid creates a new block when the hash of the data is already known, this is used to save time in situations where we are able to be confident that the data is correct.
func (*BasicBlock) Cid ¶ added in v0.4.5
func (b *BasicBlock) Cid() *cid.Cid
Cid returns the content identifier of the block.
func (*BasicBlock) Loggable ¶ added in v0.4.3
func (b *BasicBlock) Loggable() map[string]interface{}
Loggable returns a go-log loggable item.
func (*BasicBlock) Multihash ¶ added in v0.4.3
func (b *BasicBlock) Multihash() mh.Multihash
Multihash returns the hash contained in the block CID.
func (*BasicBlock) RawData ¶ added in v0.4.5
func (b *BasicBlock) RawData() []byte
RawData returns the block raw contents as a byte slice.
func (*BasicBlock) String ¶ added in v0.4.3
func (b *BasicBlock) String() string
String provides a human-readable representation of the block CID.
Directories ¶
Path | Synopsis |
---|---|
Package blockstore implements a thin wrapper over a datastore, giving a clean interface for Getting and Putting block objects.
|
Package blockstore implements a thin wrapper over a datastore, giving a clean interface for Getting and Putting block objects. |
util
Package blockstoreutil provides utility functions for Blockstores.
|
Package blockstoreutil provides utility functions for Blockstores. |
Package blocksutil provides utility functions for working with Blocks.
|
Package blocksutil provides utility functions for working with Blocks. |
Package bloom implements a simple bloom filter.
|
Package bloom implements a simple bloom filter. |
Package set defines the BlockSet interface which provides abstraction for sets of Cids.
|
Package set defines the BlockSet interface which provides abstraction for sets of Cids. |