Documentation
¶
Overview ¶
Package repo implements AT Protocol repository operations.
A repository is a collection of records organized in a Merkle Search Tree, wrapped in signed commits, and stored as CAR files.
Index ¶
- func LoadBlocksFromCAR(r io.Reader) (*mst.MemBlockStore, cbor.CID, error)
- func LoadFromCAR(r io.Reader) (*Repo, *Commit, error)
- type Commit
- type Repo
- func (r *Repo) Commit(key crypto.PrivateKey) (*Commit, error)
- func (r *Repo) Create(collection, rkey string, record any) error
- func (r *Repo) Delete(collection, rkey string) error
- func (r *Repo) ExportCAR(w io.Writer, key crypto.PrivateKey) error
- func (r *Repo) Get(collection, rkey string) (cbor.CID, []byte, error)
- func (r *Repo) Update(collection, rkey string, record any) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadBlocksFromCAR ¶
LoadBlocksFromCAR reads a CAR file and returns all blocks in a MemBlockStore along with the root CID.
Types ¶
type Commit ¶
type Commit struct {
DID string // "did"
Version int64 // "version"
Prev *cbor.CID // "prev" — always serialized, even as null
Data cbor.CID // "data" — MST root CID
Rev string // "rev" — TID revision
Sig []byte // "sig" — signature bytes
}
Commit is a signed ATProto repository commit.
func (*Commit) Sign ¶
func (c *Commit) Sign(key crypto.PrivateKey) error
Sign signs the commit with the given private key.
func (*Commit) UnsignedBytes ¶
UnsignedBytes returns the DAG-CBOR encoding of the commit without the sig field.
type Repo ¶
Repo is an in-memory ATProto repository.
func (*Repo) Commit ¶
func (r *Repo) Commit(key crypto.PrivateKey) (*Commit, error)
Commit creates a signed commit for the current state.
func (*Repo) ExportCAR ¶
ExportCAR exports the repository as a CAR v1 file. Creates a new signed commit using the given private key.