ipldmulti

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2020 License: AGPL-3.0 Imports: 10 Imported by: 0

README

go-ipld-multiverse

Go Report Card

IPLD codec for Multiverse objects.

Contributing

Found a bug or have a feature request? Open an issue.

Multiverse follows the Contributor Covenant Code of Conduct.

License

GNU Affero General Public License v3.0

Documentation

Index

Constants

View Source
const (
	// CommitCodec is the multicodec id for commits.
	CommitCodec = 0x300001
)

Variables

View Source
var (
	// ErrInvalidCodec is returned when a cid codec is invalid.
	ErrInvalidCodec = errors.New("invalid codec type")
	// ErrNoLink is returned when an invalid path is resolved.
	ErrNoLink = errors.New("no such link")
	// ErrZeroLenPath is returned when a path of len zero is resolved.
	ErrZeroLenPath = errors.New("zero length path")
)

Functions

func DecodeCommitBlock added in v0.0.7

func DecodeCommitBlock(b blocks.Block) (format.Node, error)

DecodeCommitBlock decodes a commit from a block.

Types

type Commit

type Commit struct {
	// Date is the timestamp of when the commit was created.
	Date time.Time `json:"date"`
	// Message is a description of the changes.
	Message string `json:"message"`
	// Parents contains the CIDs of parent commits.
	Parents []cid.Cid `json:"parents"`
	// PeerID is the hash of the author's public key.
	PeerID peer.ID `json:"peer_id"`
	// WorkTree is the current state of the repo files.
	WorkTree cid.Cid `json:"tree"`
	// contains filtered or unexported fields
}

Commit contains info about changes to a repo.

func DecodeCommit

func DecodeCommit(cid cid.Cid, data []byte) (*Commit, error)

DecodeCommit decodes a commit from a cid and data.

func (*Commit) Cid

func (c *Commit) Cid() cid.Cid

Cid returns the cid of the commit.

func (*Commit) Copy

func (c *Commit) Copy() format.Node

Copy will go away. It is here to comply with the Node interface.

func (c *Commit) Links() []*format.Link

Links is a helper function that returns all links within this object

func (*Commit) Loggable

func (c *Commit) Loggable() map[string]interface{}

Loggable returns a go-log loggable item.

func (*Commit) RawData

func (c *Commit) RawData() []byte

RawData returns the block raw contents as a byte slice.

func (*Commit) Resolve

func (c *Commit) Resolve(path []string) (interface{}, []string, error)

Resolve resolves a path through this node, stopping at any link boundary and returning the object found as well as the remaining path to traverse

func (c *Commit) ResolveLink(path []string) (*format.Link, []string, error)

ResolveLink is a helper function that calls resolve and asserts the output is a link

func (*Commit) Size

func (c *Commit) Size() (uint64, error)

Size will go away. It is here to comply with the Node interface.

func (*Commit) Stat

func (c *Commit) Stat() (*format.NodeStat, error)

Stat returns info about the node.

func (*Commit) String

func (c *Commit) String() string

String returns a string representation of the commit.

func (*Commit) Tree

func (c *Commit) Tree(path string, depth int) []string

Tree lists all paths within the object under 'path', and up to the given depth. To list the entire object (similar to `find .`) pass "" and -1

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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