object

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package object contains object definitions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAuthor

func AddAuthor(ctx context.Context, ds ipld.NodeAdder, author *Author) (cid.Cid, error)

AddAuthor adds a author to the given dag.

func AddCommit

func AddCommit(ctx context.Context, ds ipld.NodeAdder, commit *Commit) (cid.Cid, error)

AddCommit adds a commit to the given dag.

func AddRepository

func AddRepository(ctx context.Context, ds ipld.NodeAdder, repo *Repository) (cid.Cid, error)

AddRepository adds a repo to the given dag.

func GetCommitTree

func GetCommitTree(ctx context.Context, ds ipld.NodeGetter, id cid.Cid) (ipld.Node, error)

GetCommitTree returns the tree of the commit with the given CID.

Types

type Author

type Author struct {
	// Repositories is a map of repositories.
	Repositories map[string]cid.Cid `json:"repositories"`
	// Following is a list of peer IDs to follow.
	Following []peer.ID `json:"following"`
	// Metadata contains additional data.
	Metadata map[string]string `json:"metadata"`
}

Author contains info about a user.

func AuthorFromCBOR

func AuthorFromCBOR(data []byte) (*Author, error)

AuthorFromCBOR decodes a author from an ipld node.

func AuthorFromJSON

func AuthorFromJSON(data []byte) (*Author, error)

AuthorFromJSON decodes a author from json.

func GetAuthor

func GetAuthor(ctx context.Context, ds ipld.NodeGetter, id cid.Cid) (*Author, error)

GetAuthor returns the author with the given CID.

func NewAuthor

func NewAuthor() *Author

NewAuthor returns a new author.

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 is a list of the parent commit CIDs.
	Parents []cid.Cid `json:"parents"`
	// Tree is the root CID of the repo file tree.
	Tree cid.Cid `json:"tree"`
	// Metadata contains additional data.
	Metadata map[string]string `json:"metadata"`
}

Commit contains info about changes to a repo.

func CommitFromCBOR

func CommitFromCBOR(data []byte) (*Commit, error)

CommitFromCBOR decodes a commit from an ipld node.

func CommitFromJSON

func CommitFromJSON(data []byte) (*Commit, error)

CommitFromJSON decodes a commit from json.

func GetCommit

func GetCommit(ctx context.Context, ds ipld.NodeGetter, id cid.Cid) (*Commit, error)

GetCommit returns the commit with the given CID.

func NewCommit

func NewCommit() *Commit

NewCommit returns a new commit with default values.

func (c *Commit) ParentLinks() []*ipld.Link

ParentLinks returns parent ipld links.

type Repository

type Repository struct {
	// DefaultBranch is the base branch of the repo.
	DefaultBranch string `json:"default_branch"`
	// Branches is a map of names to commit CIDs.
	Branches map[string]cid.Cid `json:"branches"`
	// Tags is a map of names to commit CIDs.
	Tags map[string]cid.Cid `json:"tags"`
	// Metadata contains additional data.
	Metadata map[string]string `json:"metadata"`
}

Repository contains all versions of a project.

func GetRepository

func GetRepository(ctx context.Context, ds ipld.NodeGetter, id cid.Cid) (*Repository, error)

GetRepository returns the repo with the given CID.

func NewRepository

func NewRepository() *Repository

NewRepository returns a new repo.

func RepositoryFromCBOR

func RepositoryFromCBOR(data []byte) (*Repository, error)

RepositoryFromCBOR decodes a repo from an ipld node.

func RepositoryFromJSON

func RepositoryFromJSON(data []byte) (*Repository, error)

RepositoryFromJSON decodes a repo from json.

func (*Repository) Heads

func (r *Repository) Heads() *cid.Set

Heads returns a set of all branch heads.

Jump to

Keyboard shortcuts

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