repo

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const ATP_REPO_VERSION int64 = 2

current version of repo currently implemented

Variables

View Source
var ErrDoneIterating = fmt.Errorf("done iterating")

Functions

func IngestRepo

func IngestRepo(ctx context.Context, bs blockstore.Blockstore, r io.Reader) (cid.Cid, int, error)

Types

type Repo

type Repo struct {
	Blocks int
	// contains filtered or unexported fields
}

func OpenRepo

func OpenRepo(ctx context.Context, bs blockstore.Blockstore, root cid.Cid, size int) (*Repo, error)

func ReadRepoFromCar

func ReadRepoFromCar(ctx context.Context, r io.Reader) (*Repo, error)

func (*Repo) BlockStore added in v0.2.0

func (r *Repo) BlockStore() blockstore.Blockstore

func (*Repo) ForEach

func (r *Repo) ForEach(ctx context.Context, prefix string, cb func(k string, v cid.Cid) error) error

func (*Repo) GetCommitsPath added in v0.2.0

func (r *Repo) GetCommitsPath(len int) ([]cid.Cid, error)

func (*Repo) GetRecord

func (r *Repo) GetRecord(ctx context.Context, rpath string) (cid.Cid, map[string]interface{}, error)

func (*Repo) Head

func (r *Repo) Head() cid.Cid

func (*Repo) MST added in v0.2.0

func (r *Repo) MST() *mst.MerkleSearchTree

func (*Repo) MerkleSearchTree added in v0.2.0

func (r *Repo) MerkleSearchTree() *mst.MerkleSearchTree

func (*Repo) SignedCommit added in v0.2.0

func (r *Repo) SignedCommit() SignedCommit

type RepoItem

type RepoItem struct {
	Cid  cid.Cid
	Path string
	Body interface{}
}

type RepoSnapshot

type RepoSnapshot struct {
	Root  cid.Cid
	File  string
	Size  int
	Items []RepoItem
	Repo  Repo
}

func (*RepoSnapshot) GetCollectionStats added in v0.2.0

func (ss *RepoSnapshot) GetCollectionStats(root string) (map[string]int, error)

func (*RepoSnapshot) LoadItems added in v0.2.0

func (ss *RepoSnapshot) LoadItems(root string) error

type SignedCommit

type SignedCommit struct {
	Did     string   `cborgen:"did"`
	Version int64    `cborgen:"version"`
	Prev    *cid.Cid `cborgen:"prev"`
	Data    cid.Cid  `cborgen:"data"`
	Sig     []byte   `cborgen:"sig"`
}

func (*SignedCommit) MarshalCBOR

func (t *SignedCommit) MarshalCBOR(w io.Writer) error

func (*SignedCommit) UnmarshalCBOR

func (t *SignedCommit) UnmarshalCBOR(r io.Reader) (err error)

func (*SignedCommit) Unsigned

func (sc *SignedCommit) Unsigned() *UnsignedCommit

Returns a copy of commit without the Sig field. Helpful when verifying signature.

type UnsignedCommit

type UnsignedCommit struct {
	Did     string   `cborgen:"did"`
	Version int64    `cborgen:"version"`
	Prev    *cid.Cid `cborgen:"prev"`
	Data    cid.Cid  `cborgen:"data"`
}

func (*UnsignedCommit) MarshalCBOR

func (t *UnsignedCommit) MarshalCBOR(w io.Writer) error

func (*UnsignedCommit) UnmarshalCBOR

func (t *UnsignedCommit) UnmarshalCBOR(r io.Reader) (err error)

Jump to

Keyboard shortcuts

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