Documentation
¶
Overview ¶
Package sqlite is the SQLite backend of meta.Store, for tests and for a service that runs with no other process. It uses a pure Go driver, so a binary that imports it builds with CGO disabled. One process uses one database file.
Index ¶
- Constants
- type Store
- func (s *Store) AckLand(ctx context.Context, repo, id string) error
- func (s *Store) AcquireLandLease(ctx context.Context, repo, ref, owner string, now, until time.Time) (time.Time, error)
- func (s *Store) AcquireLease(ctx context.Context, id string, partition int, owner string, ...) (meta.Lease, error)
- func (s *Store) AddPack(ctx context.Context, repo, packID string, bytes int64) error
- func (s *Store) AdvanceCursor(ctx context.Context, id string, partition int, owner string, cursor int64) error
- func (s *Store) BeginDelete(ctx context.Context, repo string, keys []string, ...) ([]string, error)
- func (s *Store) Claim(ctx context.Context, id string, epoch uint64, owner, repo string) (meta.Workspace, error)
- func (s *Store) ClaimLands(ctx context.Context, repo, ref, owner string, now time.Time, limit int) ([]meta.LandItem, error)
- func (s *Store) ClaimRetired(ctx context.Context, repo string, keys []string) (bool, error)
- func (s *Store) Close() error
- func (s *Store) CreateRepo(ctx context.Context, r meta.Repo, repoText, commit string) error
- func (s *Store) CreateSubscription(ctx context.Context, sub meta.Subscription) (meta.Subscription, error)
- func (s *Store) CreateUserToken(ctx context.Context, hash string, t meta.UserToken) error
- func (s *Store) Delete(ctx context.Context, id string) error
- func (s *Store) DeleteRef(ctx context.Context, ws string, epoch uint64, repo, name string, expect int64) error
- func (s *Store) DeleteSubscription(ctx context.Context, id string) error
- func (s *Store) EnqueueLand(ctx context.Context, r meta.LandRequest, now time.Time) (meta.LandItem, error)
- func (s *Store) EventHeads(ctx context.Context) ([]int64, error)
- func (s *Store) Events(ctx context.Context, partition int, after int64, limit int) ([]meta.Event, error)
- func (s *Store) FinishLands(ctx context.Context, repo, ref, owner string, now time.Time, ...) error
- func (s *Store) Flush(ctx context.Context, ws string, epoch uint64, generation int64, ...) error
- func (s *Store) ForgetRetired(ctx context.Context, repo string, keys []string) error
- func (s *Store) LandItem(ctx context.Context, repo, id string) (meta.LandItem, error)
- func (s *Store) LandLogSince(ctx context.Context, repo, ref, base string, limit int) ([]meta.LandLogRow, error)
- func (s *Store) LandPending(ctx context.Context) ([]meta.LandKey, error)
- func (s *Store) LandRef(ctx context.Context, m meta.LandMove, owner string, now time.Time) (meta.Ref, error)
- func (s *Store) Live(ctx context.Context, id string, epoch uint64, repo string) error
- func (s *Store) Manifest(ctx context.Context, repo string) (meta.Manifest, error)
- func (s *Store) MergeDeleteRef(ctx context.Context, repo, name string, expect int64) error
- func (s *Store) MergeRef(ctx context.Context, repo, name string, expect int64, sha string) (meta.Ref, error)
- func (s *Store) OpHeads(ctx context.Context, ws string) (meta.OpHeads, error)
- func (s *Store) PackRepos(ctx context.Context) ([]string, error)
- func (s *Store) Packs(ctx context.Context, repo string) ([]meta.Pack, error)
- func (s *Store) Ping(ctx context.Context) error
- func (s *Store) ProtectedRefs(ctx context.Context, repo string) ([]string, error)
- func (s *Store) PruneEvents(ctx context.Context, before time.Time) error
- func (s *Store) PruneLands(ctx context.Context, before time.Time) error
- func (s *Store) Ref(ctx context.Context, repo, name string) (meta.Ref, error)
- func (s *Store) Refs(ctx context.Context, repo string) ([]meta.Ref, error)
- func (s *Store) ReleaseLandLease(ctx context.Context, repo, ref, owner string) error
- func (s *Store) RemovePack(ctx context.Context, repo, packID string) error
- func (s *Store) Repo(ctx context.Context, path string) (meta.Repo, error)
- func (s *Store) Report(ctx context.Context, ws string, epoch uint64, repo string, generation int64, ...) error
- func (s *Store) Repos(ctx context.Context) ([]meta.Repo, error)
- func (s *Store) RetireFiles(ctx context.Context, repo string, keys []string, at time.Time) error
- func (s *Store) RetiredFiles(ctx context.Context, repo string) ([]meta.Retired, error)
- func (s *Store) RevokeUserToken(ctx context.Context, id string) error
- func (s *Store) SetProtectedRefs(ctx context.Context, repo string, patterns []string) error
- func (s *Store) Subscriptions(ctx context.Context) ([]meta.Subscription, error)
- func (s *Store) SwapManifest(ctx context.Context, repo string, expect int64, body []byte) (int64, error)
- func (s *Store) SwapOpHeads(ctx context.Context, ws string, epoch uint64, repo string, expect int64, ...) (meta.OpHeads, error)
- func (s *Store) SwapRef(ctx context.Context, ws string, epoch uint64, repo, name string, expect int64, ...) (meta.Ref, error)
- func (s *Store) UpdateRef(ctx context.Context, repo, name, old, new, kind string) (meta.Ref, error)
- func (s *Store) UpdateSubscription(ctx context.Context, sub meta.Subscription) (meta.Subscription, error)
- func (s *Store) UserTokenByHash(ctx context.Context, hash string) (meta.UserToken, error)
- func (s *Store) UserTokens(ctx context.Context) ([]meta.UserToken, error)
Constants ¶
const Memory = ":memory:"
Memory is the path of a database that lives as long as its Store.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store keeps the metadata in one SQLite database.
func (*Store) AcquireLandLease ¶
func (*Store) AcquireLease ¶
func (*Store) AdvanceCursor ¶
func (*Store) BeginDelete ¶ added in v0.10.0
func (*Store) ClaimLands ¶
func (*Store) ClaimRetired ¶ added in v0.10.0
func (*Store) CreateRepo ¶
func (*Store) CreateSubscription ¶
func (s *Store) CreateSubscription(ctx context.Context, sub meta.Subscription) (meta.Subscription, error)
func (*Store) CreateUserToken ¶ added in v0.9.0
func (*Store) DeleteSubscription ¶
func (*Store) EnqueueLand ¶
func (*Store) Events ¶
func (s *Store) Events(ctx context.Context, partition int, after int64, limit int) ([]meta.Event, error)
Events reads the rows first and the floor second, so a prune between the reads gives ErrEventsPruned and never a silent gap.
func (*Store) FinishLands ¶
func (*Store) ForgetRetired ¶ added in v0.10.0
func (*Store) LandLogSince ¶
func (*Store) LandPending ¶
func (*Store) LandRef ¶
func (s *Store) LandRef(ctx context.Context, m meta.LandMove, owner string, now time.Time) (meta.Ref, error)
LandRef is one transaction of conditional statements. Each carries the one condition applied: the event insert took its number in this transaction. No statement reads a result of the transaction into Go.
func (*Store) MergeDeleteRef ¶
func (*Store) ProtectedRefs ¶
func (*Store) PruneEvents ¶
func (*Store) ReleaseLandLease ¶
func (*Store) RemovePack ¶ added in v0.10.0
func (*Store) RetireFiles ¶ added in v0.10.0
func (*Store) RetiredFiles ¶ added in v0.10.0
func (*Store) RevokeUserToken ¶ added in v0.9.0
func (*Store) SetProtectedRefs ¶
func (*Store) Subscriptions ¶
func (*Store) SwapManifest ¶ added in v0.10.0
func (*Store) SwapOpHeads ¶
func (*Store) UpdateRef ¶
UpdateRef compares on the commit of the ref instead of its generation. Its event insert has the condition of the write and runs first, as in swapRef.
func (*Store) UpdateSubscription ¶ added in v0.19.0
func (s *Store) UpdateSubscription(ctx context.Context, sub meta.Subscription) (meta.Subscription, error)