refsql

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CreateTableStmts = []string{
	`CREATE TABLE refs (
		name TEXT NOT NULL PRIMARY KEY,
		sum  BLOB NOT NULL
	)`,
	`CREATE TABLE transactions (
		id     BLOB NOT NULL PRIMARY KEY,
		status TEXT NOT NULL,
		begin  DATETIME NOT NULL,
		end    DATETIME
	)`,
	`CREATE TABLE reflogs (
		ref         TEXT NOT NULL,
		ordinal     INTEGER NOT NULL,
		oldoid      BLOB,
		newoid      BLOB NOT NULL,
		authorname  TEXT NOT NULL DEFAULT '',
		authoremail TEXT NOT NULL DEFAULT '',
		time        DATETIME NOT NULL,
		action      TEXT NOT NULL DEFAULT '',
		message     TEXT NOT NULL DEFAULT '',
		txid        BLOB,
		PRIMARY KEY (ref, ordinal),
		FOREIGN KEY (ref) REFERENCES refs(name),
		FOREIGN KEY (txid) REFERENCES transactions(id)
	)`,
}

Functions

This section is empty.

Types

type ReflogReader

type ReflogReader struct {
	// contains filtered or unexported fields
}

func (*ReflogReader) Close

func (l *ReflogReader) Close() error

func (*ReflogReader) Read

func (l *ReflogReader) Read() (*ref.Reflog, error)

type Store

type Store struct {
	// contains filtered or unexported fields
}

func NewStore

func NewStore(db *sql.DB) *Store

func (*Store) Copy

func (s *Store) Copy(srcKey, dstKey string) (err error)

func (*Store) CountTransactions

func (s *Store) CountTransactions() (int, error)

func (*Store) Delete

func (s *Store) Delete(key string) error

func (*Store) DeleteTransaction

func (s *Store) DeleteTransaction(id uuid.UUID) error

func (*Store) Filter

func (s *Store) Filter(prefixes []string, notPrefixes []string) (m map[string][]byte, err error)

func (*Store) FilterKey

func (s *Store) FilterKey(prefixes []string, notPrefixes []string) (keys []string, err error)

func (*Store) GCTransactions

func (s *Store) GCTransactions(txTTL time.Duration) (ids []uuid.UUID, err error)

func (*Store) Get

func (s *Store) Get(key string) ([]byte, error)

func (*Store) GetTransaction

func (s *Store) GetTransaction(id uuid.UUID) (*ref.Transaction, error)

func (*Store) GetTransactionLogs

func (s *Store) GetTransactionLogs(txid uuid.UUID) (logs map[string]*ref.Reflog, err error)

func (*Store) ListTransactions

func (s *Store) ListTransactions(offset, limit int) (txs []*ref.Transaction, err error)

func (*Store) LogReader

func (s *Store) LogReader(key string) (ref.ReflogReader, error)

func (*Store) NewTransaction

func (s *Store) NewTransaction(tx *ref.Transaction) (*uuid.UUID, error)

func (*Store) Rename

func (s *Store) Rename(oldKey, newKey string) (err error)

func (*Store) Set

func (s *Store) Set(key string, sum []byte) error

func (*Store) SetWithLog

func (s *Store) SetWithLog(key string, sum []byte, rl *ref.Reflog) error

func (*Store) UpdateTransaction

func (s *Store) UpdateTransaction(tx *ref.Transaction) error

Jump to

Keyboard shortcuts

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