Documentation ¶
Overview ¶
Package object contains object definitions.
Index ¶
- func AddAuthor(ctx context.Context, ds ipld.NodeAdder, author *Author) (cid.Cid, error)
- func AddCommit(ctx context.Context, ds ipld.NodeAdder, commit *Commit) (cid.Cid, error)
- func AddRepository(ctx context.Context, ds ipld.NodeAdder, repo *Repository) (cid.Cid, error)
- func GetCommitTree(ctx context.Context, ds ipld.NodeGetter, id cid.Cid) (ipld.Node, error)
- type Author
- type Commit
- type Repository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddRepository ¶
AddRepository adds a repo to the given dag.
func GetCommitTree ¶
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 ¶
AuthorFromCBOR decodes a author from an ipld node.
func AuthorFromJSON ¶
AuthorFromJSON decodes a author from json.
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 ¶
CommitFromCBOR decodes a commit from an ipld node.
func CommitFromJSON ¶
CommitFromJSON decodes a commit from json.
func (*Commit) ParentLinks ¶
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 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.