sqlite

package
v0.23.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 16 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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 Open

func Open(ctx context.Context, path string) (*Store, error)

Open opens the database file at path, or creates it, and applies the migrations.

func (*Store) AckLand added in v0.19.0

func (s *Store) AckLand(ctx context.Context, repo, id string) error

func (*Store) AcquireLandLease

func (s *Store) AcquireLandLease(ctx context.Context, repo, ref, owner string, now, until time.Time) (time.Time, error)

func (*Store) AcquireLease

func (s *Store) AcquireLease(ctx context.Context, id string, partition int, owner string, now, until time.Time) (meta.Lease, error)

func (*Store) AdvanceCursor

func (s *Store) AdvanceCursor(ctx context.Context, id string, partition int, owner string, cursor int64) error

func (*Store) BeginDelete added in v0.10.0

func (s *Store) BeginDelete(ctx context.Context, repo string, keys []string, now, staleBefore, retiredBefore time.Time) ([]string, error)

func (*Store) Claim

func (s *Store) Claim(ctx context.Context, id string, epoch uint64, owner, repo string) (meta.Workspace, error)

func (*Store) ClaimLands

func (s *Store) ClaimLands(ctx context.Context, repo, ref, owner string, now time.Time, limit int) ([]meta.LandItem, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) CreateRepo

func (s *Store) CreateRepo(ctx context.Context, r meta.Repo, repoText, commit string) error

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 (s *Store) CreateUserToken(ctx context.Context, hash string, t meta.UserToken) error

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, id string) error

func (*Store) DeleteRef

func (s *Store) DeleteRef(ctx context.Context, ws string, epoch uint64, repo, name string, expect int64) error

func (*Store) DeleteSubscription

func (s *Store) DeleteSubscription(ctx context.Context, id string) error

func (*Store) EnqueueLand

func (s *Store) EnqueueLand(ctx context.Context, r meta.LandRequest, now time.Time) (meta.LandItem, error)

func (*Store) EventHeads

func (s *Store) EventHeads(ctx context.Context) ([]int64, error)

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 (s *Store) FinishLands(ctx context.Context, repo, ref, owner string, now time.Time, results []meta.LandDone) error

func (*Store) Flush

func (s *Store) Flush(ctx context.Context, ws string, epoch uint64, generation int64, prev, op, snapshot string) error

func (*Store) ForgetRetired added in v0.10.0

func (s *Store) ForgetRetired(ctx context.Context, repo string, keys []string) error

func (*Store) LandItem

func (s *Store) LandItem(ctx context.Context, repo, id string) (meta.LandItem, error)

func (*Store) LandLogSince

func (s *Store) LandLogSince(ctx context.Context, repo, ref, base string, limit int) ([]meta.LandLogRow, error)

func (*Store) LandPending

func (s *Store) LandPending(ctx context.Context) ([]meta.LandKey, error)

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) Live

func (s *Store) Live(ctx context.Context, id string, epoch uint64, repo string) error

func (*Store) Manifest added in v0.10.0

func (s *Store) Manifest(ctx context.Context, repo string) (meta.Manifest, error)

func (*Store) ManifestRepos added in v0.22.1

func (s *Store) ManifestRepos(ctx context.Context) ([]string, error)

func (*Store) MergeDeleteRef

func (s *Store) MergeDeleteRef(ctx context.Context, repo, name string, expect int64) error

func (*Store) MergeRef

func (s *Store) MergeRef(ctx context.Context, repo, name string, expect int64, sha string) (meta.Ref, error)

func (*Store) OpHeads

func (s *Store) OpHeads(ctx context.Context, ws string) (meta.OpHeads, error)

func (*Store) Ping

func (s *Store) Ping(ctx context.Context) error

func (*Store) ProtectedRefs

func (s *Store) ProtectedRefs(ctx context.Context, repo string) ([]string, error)

func (*Store) PruneEvents

func (s *Store) PruneEvents(ctx context.Context, before time.Time) error

func (*Store) PruneLands

func (s *Store) PruneLands(ctx context.Context, before time.Time) error

func (*Store) Ref

func (s *Store) Ref(ctx context.Context, repo, name string) (meta.Ref, error)

func (*Store) Refs

func (s *Store) Refs(ctx context.Context, repo string) ([]meta.Ref, error)

func (*Store) ReleaseLandLease

func (s *Store) ReleaseLandLease(ctx context.Context, repo, ref, owner string) error

func (*Store) Repo

func (s *Store) Repo(ctx context.Context, path string) (meta.Repo, error)

func (*Store) Report

func (s *Store) Report(ctx context.Context, ws string, epoch uint64, repo string, generation int64, prev, op, snapshot string) error

func (*Store) Repos

func (s *Store) Repos(ctx context.Context) ([]meta.Repo, error)

func (*Store) RetireFiles added in v0.10.0

func (s *Store) RetireFiles(ctx context.Context, repo string, keys []string, at time.Time) error

func (*Store) RetiredFiles added in v0.10.0

func (s *Store) RetiredFiles(ctx context.Context, repo string) ([]meta.Retired, error)

func (*Store) RevokeUserToken added in v0.9.0

func (s *Store) RevokeUserToken(ctx context.Context, id string) error

func (*Store) SetProtectedRefs

func (s *Store) SetProtectedRefs(ctx context.Context, repo string, patterns []string) error

func (*Store) Subscriptions

func (s *Store) Subscriptions(ctx context.Context) ([]meta.Subscription, error)

func (*Store) SwapManifest added in v0.10.0

func (s *Store) SwapManifest(ctx context.Context, repo string, expect int64, body []byte) (int64, error)

func (*Store) SwapOpHeads

func (s *Store) SwapOpHeads(ctx context.Context, ws string, epoch uint64, repo string, expect int64, heads []string) (meta.OpHeads, error)

func (*Store) SwapRef

func (s *Store) SwapRef(ctx context.Context, ws string, epoch uint64, repo, name string, expect int64, sha string) (meta.Ref, error)

func (*Store) UpdateRef

func (s *Store) UpdateRef(ctx context.Context, repo, name, old, new, kind string) (meta.Ref, error)

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)

func (*Store) UserTokenByHash added in v0.9.0

func (s *Store) UserTokenByHash(ctx context.Context, hash string) (meta.UserToken, error)

func (*Store) UserTokens added in v0.9.0

func (s *Store) UserTokens(ctx context.Context) ([]meta.UserToken, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL