sqllog

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SupersededCount = 100
)

Variables

This section is empty.

Functions

func ScanAll

func ScanAll[T any](rows *sql.Rows, scanOne func(*sql.Rows) (T, error)) ([]T, error)

Types

type Driver added in v1.4.1

type Driver interface {
	List(ctx context.Context, prefix, startKey string, limit, revision int64) (*sql.Rows, error)
	ListTTL(ctx context.Context, revision int64) (*sql.Rows, error)
	Count(ctx context.Context, prefix, startKey string, revision int64) (int64, error)
	CurrentRevision(ctx context.Context) (int64, error)
	AfterPrefix(ctx context.Context, prefix string, rev, limit int64) (*sql.Rows, error)
	After(ctx context.Context, rev, limit int64) (*sql.Rows, error)
	Create(ctx context.Context, key string, value []byte, lease int64) (int64, bool, error)
	Update(ctx context.Context, key string, value []byte, prevRev, lease int64) (int64, bool, error)
	Delete(ctx context.Context, key string, revision int64) (int64, bool, error)
	DeleteRevision(ctx context.Context, revision int64) error
	GetCompactRevision(ctx context.Context) (int64, int64, error)
	Compact(ctx context.Context, revision int64) error
	Fill(ctx context.Context, revision int64) error
	IsFill(key string) bool
	GetSize(ctx context.Context) (int64, error)
	Close() error
}

type SQLLog

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

func New

func New(config *SQLLogConfig) *SQLLog

func (*SQLLog) After

func (s *SQLLog) After(ctx context.Context, prefix string, revision, limit int64) (int64, []*server.Event, error)

func (*SQLLog) Close

func (s *SQLLog) Close() error

func (*SQLLog) Count

func (s *SQLLog) Count(ctx context.Context, prefix, startKey string, revision int64) (int64, int64, error)

func (*SQLLog) Create

func (s *SQLLog) Create(ctx context.Context, key string, value []byte, lease int64) (int64, bool, error)

func (*SQLLog) CurrentRevision

func (s *SQLLog) CurrentRevision(ctx context.Context) (int64, error)

func (*SQLLog) DbSize

func (s *SQLLog) DbSize(ctx context.Context) (int64, error)

func (*SQLLog) Delete

func (s *SQLLog) Delete(ctx context.Context, key string, revision int64) (rev int64, deleted bool, err error)

func (*SQLLog) DoCompact

func (s *SQLLog) DoCompact(ctx context.Context) (err error)

DoCompact makes a single compaction run when called. It is intended to be called from test functions that have access to the backend.

func (*SQLLog) GetCompactRevision

func (s *SQLLog) GetCompactRevision(ctx context.Context) (int64, int64, error)

func (*SQLLog) List

func (s *SQLLog) List(ctx context.Context, prefix, startKey string, limit, revision int64) (int64, []*server.KeyValue, error)

func (*SQLLog) Start

func (s *SQLLog) Start(startCtx context.Context) error

func (*SQLLog) Stop

func (s *SQLLog) Stop() error

func (*SQLLog) Update

func (s *SQLLog) Update(ctx context.Context, key string, value []byte, prevRev, lease int64) (rev int64, updated bool, err error)

func (*SQLLog) Watch

func (s *SQLLog) Watch(ctx context.Context, key string, startRevision int64) (<-chan []*server.Event, error)

type SQLLogConfig added in v1.4.1

type SQLLogConfig struct {
	// Driver is the SQL driver to use to query the database.
	Driver Driver

	// CompactInterval is interval between database compactions performed by kine.
	CompactInterval time.Duration

	// PollInterval is the event poll interval used by kine.
	PollInterval time.Duration

	// WatchQueryTimeout is the timeout on the after query in the poll loop.
	WatchQueryTimeout time.Duration
}

Jump to

Keyboard shortcuts

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