sqliteStorage

package
v1.28.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UnexpectedJournalMode = errors.New("unexpected journal mode")

Functions

func InitSchema added in v1.22.0

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

func NewDirectStorage added in v1.28.0

func NewDirectStorage(opts NewDirectStorageOpts) (_ 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 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 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
	NumConns() int
}

func NewPool added in v1.19.0

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

type InitConnOpts added in v1.28.0

type InitConnOpts struct {
	SetSynchronous string
	SetJournalMode string
	MmapSizeOk     bool  // If false, a package-specific default will be used.
	MmapSize       int64 // If MmapSizeOk is set, use sqlite default if < 0, otherwise this value.
}

func (InitConnOpts) JournalMode added in v1.28.0

func (me InitConnOpts) JournalMode() string

type InitDbOpts added in v1.28.0

type InitDbOpts struct {
	DontInitSchema bool
	PageSize       int
	// If non-zero, overrides the existing setting.
	Capacity   int64
	NoTriggers bool
}

type InitPoolOpts added in v1.28.0

type InitPoolOpts struct {
	NumConns int
	InitConnOpts
}

type NewConnOpts added in v1.28.0

type NewConnOpts 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
	// Whether multiple blobs will not be read simultaneously. Enables journal mode other than WAL,
	// and NumConns < 2.
	NoConcurrentBlobReads bool
}

type NewDirectStorageOpts added in v1.28.0

type NewDirectStorageOpts struct {
	NewConnOpts
	InitDbOpts
	InitConnOpts
	GcBlobs           bool
	CacheBlobs        bool
	BlobFlushInterval time.Duration
}

type NewPiecesStorageOpts added in v1.22.0

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

type NewPoolOpts added in v1.19.0

type NewPoolOpts struct {
	NewConnOpts
	InitConnOpts
	NumConns int
}

type PoolConf added in v1.28.0

type PoolConf struct {
	NumConns    int
	JournalMode string
}

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.

type ProviderOpts added in v1.19.0

type ProviderOpts struct {
	BatchWrites bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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