repo

package
v0.0.0-...-45ae864 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

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, error)

func NextTID

func NextTID() string

Types

type CborMarshaler

type CborMarshaler interface {
	MarshalCBOR(w io.Writer) error
}

type Commit

type Commit struct {
	AuthToken *string  `cborgen:"auth_token"`
	Data      cid.Cid  `cborgen:"data"`
	Meta      cid.Cid  `cborgen:"meta"`
	Prev      *cid.Cid `cborgen:"prev,omitempty"`
}

func (*Commit) MarshalCBOR

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

func (*Commit) UnmarshalCBOR

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

type Meta

type Meta struct {
	Datastore string `cborgen:"datastore"`
	Did       string `cborgen:"did"`
	Version   int64  `cborgen:"version"`
}

func (*Meta) MarshalCBOR

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

func (*Meta) UnmarshalCBOR

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

type Repo

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

func NewRepo

func NewRepo(ctx context.Context, bs blockstore.Blockstore) *Repo

func OpenRepo

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

func ReadRepoFromCar

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

func (*Repo) Blockstore

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

func (*Repo) Commit

func (r *Repo) Commit(ctx context.Context) (cid.Cid, error)

func (*Repo) CreateRecord

func (r *Repo) CreateRecord(ctx context.Context, nsid string, rec CborMarshaler) (cid.Cid, string, error)

func (*Repo) DeleteRecord

func (r *Repo) DeleteRecord(ctx context.Context, rpath string) error

func (*Repo) DiffSince

func (r *Repo) DiffSince(ctx context.Context, oldrepo cid.Cid) ([]*mst.DiffOp, error)

func (*Repo) ForEach

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

func (*Repo) GetRecord

func (r *Repo) GetRecord(ctx context.Context, rpath string) (cid.Cid, cbg.CBORMarshaler, error)

func (*Repo) PrevCommit

func (r *Repo) PrevCommit(ctx context.Context) (*cid.Cid, error)

func (*Repo) PutRecord

func (r *Repo) PutRecord(ctx context.Context, rpath string, rec CborMarshaler) (cid.Cid, error)

type SignedRoot

type SignedRoot struct {
	Root cid.Cid `cborgen:"root"`
	Sig  []byte  `cborgen:"sig"`
}

func (*SignedRoot) MarshalCBOR

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

func (*SignedRoot) UnmarshalCBOR

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

Jump to

Keyboard shortcuts

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