Documentation
¶
Index ¶
- Variables
- func RunMigration(d *sql.DB) error
- type ActorStore
- func (as *ActorStore) Create(did syntax.DID, signingKey crypto.PrivateKeyExportable) error
- func (as *ActorStore) CreateAsPref(did syntax.DID, key crypto.PrivateKeyExportable) (*PreferenceReader, error)
- func (as *ActorStore) CreateAsRecord(did syntax.DID, key crypto.PrivateKeyExportable) (*RecordReader, error)
- func (as *ActorStore) CreateAsRepo(did syntax.DID, key crypto.PrivateKeyExportable) (*SQLRepoReader, error)
- func (as *ActorStore) Destroy(did syntax.DID) error
- func (as *ActorStore) Pref(did syntax.DID) (r *PreferenceReader, err error)
- func (as *ActorStore) Record(did syntax.DID) (*RecordReader, error)
- func (as *ActorStore) Repo(did syntax.DID, key crypto.PrivateKeyExportable) (*SQLRepoReader, error)
- func (as *ActorStore) Transact(ctx context.Context, did syntax.DID, blobs repo.BlobStore, ...) error
- type ActorStoreTransactor
- type BackgroundQueue
- type Backlink
- type BlobReader
- func (br *BlobReader) BlobCount(ctx context.Context) (int64, error)
- func (ds *BlobReader) Close() error
- func (br *BlobReader) GetBlob(ctx context.Context, cid cid.Cid) (size int64, mimeType *string, stream io.ReadCloser, err error)
- func (br *BlobReader) GetBlobMetadata(ctx context.Context, cid cid.Cid) (size int64, mimeType *string, err error)
- func (br *BlobReader) GetBlobTakedownStatus(ctx context.Context, cid string) (*StatusAttr, error)
- func (br *BlobReader) GetRecordsForBlob(ctx context.Context, cid string) ([]string, error)
- func (br *BlobReader) ListBlobs(ctx context.Context, limit int, opts *ListBlobsOpts) ([]string, error)
- func (br *BlobReader) ListMissingBlobs(ctx context.Context, cursor *string, limit int) ([]MissingBlob, error)
- func (br *BlobReader) RecordBlobCount(ctx context.Context) (int64, error)
- type BlobTransactor
- func (ds BlobTransactor) Close() error
- func (t *BlobTransactor) DeleteBlob(ctx context.Context, cid cid.Cid) error
- func (t *BlobTransactor) GetBlobDetails(ctx context.Context, cid string) (map[string]interface{}, error)
- func (t *BlobTransactor) ListAllBlobs(ctx context.Context, limit int, offset int) ([]map[string]interface{}, error)
- func (t *BlobTransactor) ProcessWriteBlobs(ctx context.Context, rev string, writes []repo.PreparedWrite) error
- func (t *BlobTransactor) QuarantineBlob(ctx context.Context, cid cid.Cid) error
- func (t *BlobTransactor) UnQuarantineBlob(ctx context.Context, cid cid.Cid) error
- type LinkableRecord
- type ListBlobsOpts
- type MissingBlob
- type Preference
- type PreferenceReader
- type PreparedCreate
- type Record
- type RecordBacklink
- type RecordReader
- func (rr *RecordReader) Close() error
- func (rr *RecordReader) GetBacklinkConflicts(ctx context.Context, uri syntax.ATURI, record LinkableRecord) ([]syntax.ATURI, error)
- func (rr *RecordReader) GetByRev(ctx context.Context, rev string) (*Record, error)
- func (rr *RecordReader) GetRecord(ctx context.Context, uri syntax.ATURI, cid *cid.Cid, includeSoftDeleted bool) (*Record, error)
- func (rr *RecordReader) GetRecordBacklinks(ctx context.Context, collection syntax.NSID, path, linkTo string) ([]RecordBacklink, error)
- func (rr *RecordReader) ListAll(ctx context.Context) ([]Record, error)
- func (rr *RecordReader) ListCollections(ctx context.Context) (iter.Seq2[string, error], error)
- func (rr *RecordReader) ListForCollection(ctx context.Context, req *comatp.RepoListRecordsParams) (*comatp.RepoListRecordsResponse, error)
- func (rr *RecordReader) Tx(ctx context.Context, fn func(ctx context.Context, tx *RecordTransactor) error) error
- type RecordTransactor
- func (rt *RecordTransactor) AddBacklinks(ctx context.Context, backlinks []Backlink) error
- func (rt *RecordTransactor) DeleteRecord(ctx context.Context, uri syntax.ATURI) error
- func (rt *RecordTransactor) IndexRecord(ctx context.Context, uri syntax.ATURI, cid cid.Cid, record any, ...) error
- func (rt *RecordTransactor) RemoveBacklinksByURI(ctx context.Context, uri syntax.ATURI) error
- type RepoBlock
- type RepoRecord
- type RepoTransactor
- func (ds *RepoTransactor) Close() error
- func (t *RepoTransactor) CreateRepo(ctx context.Context, writes []repo.PreparedCreate) (*repo.CommitData, error)
- func (t *RepoTransactor) FormatCommit(ctx context.Context, writes []repo.PreparedWrite, swapCommit cid.Cid) (*repo.CommitData, error)
- func (t *RepoTransactor) GetDuplicateRecordCIDs(ctx context.Context, cids *cid.Set, touchedURIs []syntax.ATURI) ([]cid.Cid, error)
- func (t *RepoTransactor) ProcessWrites(ctx context.Context, writes []repo.PreparedWrite, swapCommitCID cid.Cid) (*repo.CommitData, error)
- type SQLRepoReader
- func (s *SQLRepoReader) Close() error
- func (s *SQLRepoReader) GetBlocks(ctx context.Context, cids []cid.Cid) (*repo.BlockResult, error)
- func (s *SQLRepoReader) GetBytes(ctx context.Context, c cid.Cid) ([]byte, error)
- func (s *SQLRepoReader) GetRoot(ctx context.Context) (cid.Cid, error)
- func (s *SQLRepoReader) GetRootDetailed(ctx context.Context) (*repo.RootInfo, error)
- func (s *SQLRepoReader) Has(ctx context.Context, cid cid.Cid) (bool, error)
- func (s *SQLRepoReader) ListAllBlocks(ctx context.Context) (*repo.BlockMap, error)
- func (s *SQLRepoReader) Tx(ctx context.Context, blob repo.BlobStore, ...) error
- type SQLRepoTransactor
- func (s *SQLRepoTransactor) ApplyCommit(ctx context.Context, commit *repo.CommitData, isCreate bool) error
- func (s *SQLRepoTransactor) CacheRev(ctx context.Context, rev string) error
- func (s *SQLRepoTransactor) DeleteMany(ctx context.Context, cids *cid.Set) error
- func (s *SQLRepoTransactor) PutBlock(ctx context.Context, cid cid.Cid, block []byte, rev string) error
- func (s *SQLRepoTransactor) PutMany(ctx context.Context, toPut *repo.BlockMap, rev string) error
- func (s *SQLRepoTransactor) UpdateRoot(ctx context.Context, cid cid.Cid, rev string, isCreate bool) error
- type ScannableString
- type StatusAttr
- type StoredCid
Constants ¶
This section is empty.
Variables ¶
var (
ErrInvalidRequest = errors.New("invalid request")
)
Custom errors
Functions ¶
func RunMigration ¶
Types ¶
type ActorStore ¶
func (*ActorStore) Create ¶
func (as *ActorStore) Create(did syntax.DID, signingKey crypto.PrivateKeyExportable) error
func (*ActorStore) CreateAsPref ¶
func (as *ActorStore) CreateAsPref(did syntax.DID, key crypto.PrivateKeyExportable) (*PreferenceReader, error)
func (*ActorStore) CreateAsRecord ¶
func (as *ActorStore) CreateAsRecord(did syntax.DID, key crypto.PrivateKeyExportable) (*RecordReader, error)
func (*ActorStore) CreateAsRepo ¶
func (as *ActorStore) CreateAsRepo(did syntax.DID, key crypto.PrivateKeyExportable) (*SQLRepoReader, error)
func (*ActorStore) Pref ¶
func (as *ActorStore) Pref(did syntax.DID) (r *PreferenceReader, err error)
func (*ActorStore) Record ¶
func (as *ActorStore) Record(did syntax.DID) (*RecordReader, error)
func (*ActorStore) Repo ¶
func (as *ActorStore) Repo(did syntax.DID, key crypto.PrivateKeyExportable) (*SQLRepoReader, error)
type ActorStoreTransactor ¶
type ActorStoreTransactor struct {
Repo *RepoTransactor
Record *RecordTransactor
Pref *PreferenceReader
}
type BackgroundQueue ¶
type BackgroundQueue any
type BlobReader ¶
type BlobReader struct {
// contains filtered or unexported fields
}
func NewBlobReader ¶
func NewBlobReader( db db.DB, blobstore repo.BlobStore, did syntax.DID, key crypto.PrivateKeyExportable, ) *BlobReader
func (*BlobReader) GetBlob ¶
func (br *BlobReader) GetBlob(ctx context.Context, cid cid.Cid) (size int64, mimeType *string, stream io.ReadCloser, err error)
func (*BlobReader) GetBlobMetadata ¶
func (*BlobReader) GetBlobTakedownStatus ¶
func (br *BlobReader) GetBlobTakedownStatus(ctx context.Context, cid string) (*StatusAttr, error)
func (*BlobReader) GetRecordsForBlob ¶
func (*BlobReader) ListBlobs ¶
func (br *BlobReader) ListBlobs(ctx context.Context, limit int, opts *ListBlobsOpts) ([]string, error)
func (*BlobReader) ListMissingBlobs ¶
func (br *BlobReader) ListMissingBlobs(ctx context.Context, cursor *string, limit int) ([]MissingBlob, error)
func (*BlobReader) RecordBlobCount ¶
func (br *BlobReader) RecordBlobCount(ctx context.Context) (int64, error)
type BlobTransactor ¶
type BlobTransactor struct{ *BlobReader }
func NewBlobTransactor ¶
func NewBlobTransactor(db db.DB, br *BlobReader) *BlobTransactor
func (*BlobTransactor) DeleteBlob ¶
func (*BlobTransactor) GetBlobDetails ¶
func (*BlobTransactor) ListAllBlobs ¶
func (*BlobTransactor) ProcessWriteBlobs ¶
func (t *BlobTransactor) ProcessWriteBlobs(ctx context.Context, rev string, writes []repo.PreparedWrite) error
func (*BlobTransactor) QuarantineBlob ¶
func (*BlobTransactor) UnQuarantineBlob ¶
type LinkableRecord ¶
type LinkableRecord interface {
// Type should return the "$type" field.
Type() (id string, found bool)
// Subject should return the record's subject.
Subject() (subj any, found bool)
}
LinkableRecord is a type that is stored as json and has a "$type" field and a "subject" field.
type ListBlobsOpts ¶
type ListBlobsOpts struct {
Since, Cursor *string
}
type MissingBlob ¶
type Preference ¶
type PreferenceReader ¶
type PreferenceReader datastore
func (*PreferenceReader) Get ¶
func (pr *PreferenceReader) Get(ctx context.Context, name string) (*Preference, error)
func (*PreferenceReader) List ¶
func (pr *PreferenceReader) List(ctx context.Context) ([]Preference, error)
type PreparedCreate ¶
PreparedCreate represents a create operation
type RecordBacklink ¶
type RecordReader ¶
type RecordReader datastore
func (*RecordReader) Close ¶
func (rr *RecordReader) Close() error
func (*RecordReader) GetBacklinkConflicts ¶
func (rr *RecordReader) GetBacklinkConflicts(ctx context.Context, uri syntax.ATURI, record LinkableRecord) ([]syntax.ATURI, error)
func (*RecordReader) GetRecordBacklinks ¶
func (rr *RecordReader) GetRecordBacklinks(ctx context.Context, collection syntax.NSID, path, linkTo string) ([]RecordBacklink, error)
func (*RecordReader) ListAll ¶
func (rr *RecordReader) ListAll(ctx context.Context) ([]Record, error)
func (*RecordReader) ListCollections ¶
func (*RecordReader) ListForCollection ¶
func (rr *RecordReader) ListForCollection( ctx context.Context, req *comatp.RepoListRecordsParams, ) (*comatp.RepoListRecordsResponse, error)
func (*RecordReader) Tx ¶
func (rr *RecordReader) Tx(ctx context.Context, fn func(ctx context.Context, tx *RecordTransactor) error) error
type RecordTransactor ¶
type RecordTransactor struct {
*RecordReader
}
func (*RecordTransactor) AddBacklinks ¶
func (rt *RecordTransactor) AddBacklinks(ctx context.Context, backlinks []Backlink) error
func (*RecordTransactor) DeleteRecord ¶
func (*RecordTransactor) IndexRecord ¶
func (*RecordTransactor) RemoveBacklinksByURI ¶
type RepoRecord ¶
func (RepoRecord) Subject ¶
func (r RepoRecord) Subject() (any, bool)
func (RepoRecord) Type ¶
func (r RepoRecord) Type() (string, bool)
type RepoTransactor ¶
type RepoTransactor struct {
// contains filtered or unexported fields
}
RepoTransactor handles repository operations
func NewRepoTransactor ¶
func NewRepoTransactor( db db.DB, did syntax.DID, signingKey crypto.PrivateKeyExportable, blobstore repo.BlobStore, backgroundQueue *BackgroundQueue, now string, ) *RepoTransactor
NewRepoTransactor creates a new repository transactor
func (*RepoTransactor) CreateRepo ¶
func (t *RepoTransactor) CreateRepo(ctx context.Context, writes []repo.PreparedCreate) (*repo.CommitData, error)
CreateRepo creates a new repository with the given writes
func (*RepoTransactor) FormatCommit ¶
func (t *RepoTransactor) FormatCommit( ctx context.Context, writes []repo.PreparedWrite, swapCommit cid.Cid, ) (*repo.CommitData, error)
FormatCommit formats a commit from the given writes
func (*RepoTransactor) GetDuplicateRecordCIDs ¶
func (t *RepoTransactor) GetDuplicateRecordCIDs(ctx context.Context, cids *cid.Set, touchedURIs []syntax.ATURI) ([]cid.Cid, error)
GetDuplicateRecordCIDs finds CIDs that are referenced by other records
func (*RepoTransactor) ProcessWrites ¶
func (t *RepoTransactor) ProcessWrites(ctx context.Context, writes []repo.PreparedWrite, swapCommitCID cid.Cid) (*repo.CommitData, error)
ProcessWrites processes multiple write operations
type SQLRepoReader ¶
type SQLRepoReader struct {
// contains filtered or unexported fields
}
SQLRepoReader implements the base read operations
func NewSQLRepoReader ¶
func NewSQLRepoReader(db database.DB, did syntax.DID, signingKey crypto.PrivateKeyExportable) *SQLRepoReader
func (*SQLRepoReader) Close ¶
func (s *SQLRepoReader) Close() error
func (*SQLRepoReader) GetBlocks ¶
func (s *SQLRepoReader) GetBlocks(ctx context.Context, cids []cid.Cid) (*repo.BlockResult, error)
func (*SQLRepoReader) GetRootDetailed ¶
func (*SQLRepoReader) ListAllBlocks ¶
type SQLRepoTransactor ¶
type SQLRepoTransactor struct {
*SQLRepoReader
// contains filtered or unexported fields
}
SQLRepoTransactor extends SQLRepoReader with write operations
func NewSQLRepoTransactor ¶
func NewSQLRepoTransactor(tx database.DB, did syntax.DID, key crypto.PrivateKeyExportable) *SQLRepoTransactor
func (*SQLRepoTransactor) ApplyCommit ¶
func (s *SQLRepoTransactor) ApplyCommit(ctx context.Context, commit *repo.CommitData, isCreate bool) error
func (*SQLRepoTransactor) CacheRev ¶
func (s *SQLRepoTransactor) CacheRev(ctx context.Context, rev string) error
func (*SQLRepoTransactor) DeleteMany ¶
func (s *SQLRepoTransactor) DeleteMany(ctx context.Context, cids []syntax.CID) error {
func (*SQLRepoTransactor) UpdateRoot ¶
type ScannableString ¶
type ScannableString string