Documentation ¶
Index ¶
- Constants
- Variables
- func IngestRepo(ctx context.Context, bs blockstore.Blockstore, r io.Reader) (cid.Cid, error)
- func NextTID() string
- type CborMarshaler
- type Repo
- func (r *Repo) Blockstore() blockstore.Blockstore
- func (r *Repo) Commit(ctx context.Context, ...) (cid.Cid, string, error)
- func (r *Repo) CopyDataTo(ctx context.Context, bs blockstore.Blockstore) error
- func (r *Repo) CreateRecord(ctx context.Context, nsid string, rec CborMarshaler) (cid.Cid, string, error)
- func (r *Repo) DataCid() cid.Cid
- func (r *Repo) DeleteRecord(ctx context.Context, rpath string) error
- func (r *Repo) DiffSince(ctx context.Context, oldrepo cid.Cid) ([]*mst.DiffOp, error)
- func (r *Repo) ForEach(ctx context.Context, prefix string, cb func(k string, v cid.Cid) error) error
- func (r *Repo) GetRecord(ctx context.Context, rpath string) (cid.Cid, cbg.CBORMarshaler, error)
- func (r *Repo) GetRecordBytes(ctx context.Context, rpath string) (cid.Cid, *[]byte, error)
- func (r *Repo) PrevCommit(ctx context.Context) (*cid.Cid, error)
- func (r *Repo) PutRecord(ctx context.Context, rpath string, rec CborMarshaler) (cid.Cid, error)
- func (r *Repo) RepoDid() string
- func (r *Repo) SignedCommit() SignedCommit
- func (r *Repo) Truncate()
- func (r *Repo) UpdateRecord(ctx context.Context, rpath string, rec CborMarshaler) (cid.Cid, error)
- type SignedCommit
- type UnsignedCommit
Constants ¶
View Source
const ATP_REPO_VERSION int64 = 3
current version of repo currently implemented
View Source
const ATP_REPO_VERSION_2 int64 = 2
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)
Types ¶
type CborMarshaler ¶
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
func NewRepo ¶
func NewRepo(ctx context.Context, did string, bs blockstore.Blockstore) *Repo
func OpenRepo ¶
func OpenRepo(ctx context.Context, bs blockstore.Blockstore, root cid.Cid) (*Repo, error)
func (*Repo) Blockstore ¶
func (r *Repo) Blockstore() blockstore.Blockstore
func (*Repo) Commit ¶
func (r *Repo) Commit(ctx context.Context, signer func(context.Context, string, []byte) ([]byte, error)) (cid.Cid, string, error)
creates and writes a new SignedCommit for this repo, with `prev` pointing to old value
func (*Repo) CopyDataTo ¶
func (r *Repo) CopyDataTo(ctx context.Context, bs blockstore.Blockstore) error
func (*Repo) CreateRecord ¶
func (*Repo) GetRecordBytes ¶
func (*Repo) PrevCommit ¶
TODO(bnewbold): this could return just *cid.Cid
func (*Repo) SignedCommit ¶
func (r *Repo) SignedCommit() SignedCommit
func (*Repo) Truncate ¶
func (r *Repo) Truncate()
truncates history while retaining the same data root
func (*Repo) UpdateRecord ¶
type SignedCommit ¶
type SignedCommit struct { Did string `json:"did" cborgen:"did"` Version int64 `json:"version" cborgen:"version"` Prev *cid.Cid `json:"prev" cborgen:"prev"` Data cid.Cid `json:"data" cborgen:"data"` Sig []byte `json:"sig" cborgen:"sig"` Rev string `json:"rev" cborgen:"rev,omitempty"` }
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"` Rev string `cborgen:"rev,omitempty"` }
func (*UnsignedCommit) BytesForSigning ¶
func (uc *UnsignedCommit) BytesForSigning() ([]byte, error)
returns bytes of the DAG-CBOR representation of object. This is what gets signed; the `go-did` library will take the SHA-256 of the bytes and sign that.
func (*UnsignedCommit) MarshalCBOR ¶
func (t *UnsignedCommit) MarshalCBOR(w io.Writer) error
func (*UnsignedCommit) UnmarshalCBOR ¶
func (t *UnsignedCommit) UnmarshalCBOR(r io.Reader) (err error)
Click to show internal directories.
Click to hide internal directories.