sqlite

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Level1SchemaVersion is the version of the SQLite schema understood by this backend.
	// Whenever changes to the schema are made, this version number should be increased
	// to prevent data corruption between incompatible database schemas.
	Level1SchemaVersion = 1
	// Level1Schema is the SQLite database layout.
	Level1Schema = `` /* 339-byte string literal not displayed */

)

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

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

Level1Backend implements a level 1 drkey DB with sqlite.

func NewBackend

func NewBackend(path string) (*Backend, error)

NewLevel1Backend creates a database and prepares all statements.

func (*Backend) Close

func (b *Backend) Close() error

Close closes the database connection.

func (Backend) DeleteExpiredLevel1Keys

func (e Backend) DeleteExpiredLevel1Keys(ctx context.Context, cutoff time.Time) (int, error)

DeleteExpiredLevel1Keys removes all expired Level1 key, i.e. all the keys which expiration time is strictly smaller than the cutoff

func (Backend) GetLevel1Key

func (e Backend) GetLevel1Key(
	ctx context.Context,
	meta drkey.Level1Meta,
) (drkey.Level1Key, error)

GetLevel1Key takes metadata information for the Level1 key and a timestamp at which it should be valid and returns the corresponding Level1Key.

func (Backend) InsertLevel1Key

func (e Backend) InsertLevel1Key(ctx context.Context, key drkey.Level1Key) error

InsertLevel1Key inserts a Level1 key.

func (*Backend) SetMaxIdleConns

func (b *Backend) SetMaxIdleConns(maxIdleConns int)

SetMaxIdleConns sets the maximum number of idle connections.

func (*Backend) SetMaxOpenConns

func (b *Backend) SetMaxOpenConns(maxOpenConns int)

SetMaxOpenConns sets the maximum number of open connections.

Jump to

Keyboard shortcuts

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