sqliteStorage

package
v1.26.1 Latest Latest
Warning

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

Go to latest
Published: May 4, 2021 License: MPL-2.0 Imports: 19 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitSchema added in v1.22.0

func InitSchema(conn conn, pageSize int, triggers bool) error

func NewPiecesStorage added in v1.19.0

func NewPiecesStorage(opts NewPiecesStorageOpts) (_ storage.ClientImplCloser, err error)

A convenience function that creates a connection pool, resource provider, and a pieces storage ClientImpl and returns them all with a Close attached.

func NewPool added in v1.19.0

func NewPool(opts NewPoolOpts) (_ ConnPool, _ ProviderOpts, err error)

func NewProvider

func NewProvider(pool ConnPool, opts ProviderOpts) (_ *provider, err error)

Needs the ConnPool size so it can initialize all the connections with pragmas. Takes ownership of the ConnPool (since it has to initialize all the connections anyway).

func SetCapacity added in v1.19.0

func SetCapacity(conn conn, cap int64) error

Set the capacity limit to exactly this value.

func UnlimitCapacity added in v1.19.0

func UnlimitCapacity(conn conn) error

Remove any capacity limits.

Types

type ConnPool added in v1.19.0

type ConnPool interface {
	Get(context.Context) conn
	Put(conn)
	Close() error
}

type NewPiecesStorageOpts added in v1.22.0

type NewPiecesStorageOpts struct {
	NewPoolOpts
	ProvOpts    func(*ProviderOpts)
	StorageOpts func(*storage.ResourcePiecesOpts)
}

type NewPoolOpts added in v1.19.0

type NewPoolOpts struct {
	// See https://www.sqlite.org/c3ref/open.html. NB: "If the filename is an empty string, then a
	// private, temporary on-disk database will be created. This private database will be
	// automatically deleted as soon as the database connection is closed."
	Path     string
	Memory   bool
	NumConns int
	// Forces WAL, disables shared caching.
	NoConcurrentBlobReads bool
	DontInitSchema        bool
	PageSize              int
	// If non-zero, overrides the existing setting.
	Capacity int64
}

type ProviderOpts added in v1.19.0

type ProviderOpts struct {
	NumConns int
	// Concurrent blob reads require WAL.
	NoConcurrentBlobReads bool
	BatchWrites           bool
	MmapSize              int64
	MmapSizeOk            bool
}

There's some overlap here with NewPoolOpts, and I haven't decided what needs to be done. For now, the fact that the pool opts are a superset, means our helper NewPiecesStorage can just take the top-level option type.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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