Something went wrong. Try again.
An ATProto Powered Reputation Network
Something went wrong. Try again.
2.3 kB · 54 lines
Go
at master
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455package storage
import ( "context" "time"
"provenance/internal/domain" "provenance/internal/trust")
type Participant struct { DID string `json:"did"` Threshold float64 `json:"threshold"` SyncedAt string `json:"syncedAt"` BootstrapUS int64 `json:"bootstrapUs"` Active bool `json:"active"`}
// Store exposes domain operations so that another backend does not change the services.type Store interface { DatabaseStats(context.Context) (DatabaseStats, error) Join(context.Context, string) error Participant(context.Context, string) (Participant, error) Participants(context.Context, int) ([]Participant, error) SetThreshold(context.Context, string, float64) error Replace(context.Context, string, []domain.Vouch, time.Time) error Graph(context.Context, string, domain.Mode, int) ([]domain.Vouch, error) OwnVouches(context.Context, string, int, int) ([]domain.Vouch, error) Tags(context.Context, string, int) ([]string, error) Cursor(context.Context, string, int64) (int64, error) Apply(context.Context, string, domain.Change) error ApplyReplay(context.Context, string, []domain.Change, int64) error PrepareReplay(context.Context, string) (ReplayIndexMode, error) FinishReplay(context.Context) error TrustGraph(context.Context, string, domain.Mode, int) ([]domain.Vouch, int64, error) GraphRevision(context.Context) (int64, error) Outgoing(context.Context, string, string, domain.Mode, int) ([]domain.Vouch, int64, error) Incoming(context.Context, string, string, domain.Mode, int) ([]domain.Vouch, error) CachedTrust(context.Context, string, time.Time) (trust.Result, error) SaveTrust(context.Context, string, trust.Result, []trust.Dependency, int64, time.Time) (bool, error) SoftReady(context.Context, string) (bool, error) ReplaceWithLists(context.Context, string, []domain.Vouch, domain.ListSnapshot, time.Time) error NeedsList(context.Context, domain.Change) (bool, error) WantsListOwner(context.Context, string) (bool, error)}
type Secrets interface { Put(context.Context, string, string, []byte, time.Time) error Add(context.Context, string, string, []byte, time.Time) error Get(context.Context, string, string) ([]byte, error) Consume(context.Context, string, string) ([]byte, error) Remove(context.Context, string, string) error Prune(context.Context) error}