db

package
v2.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: AGPL-3.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB holds all information internal to the dqlite database.

func NewDB

func NewDB(ctx context.Context, serverCert *shared.CertInfo, clusterCert func() *shared.CertInfo, os *sys.OS) *DB

NewDB creates an empty db struct with no dqlite connection.

func (*DB) Accept

func (db *DB) Accept(conn net.Conn)

Accept sends the outbound connection through the acceptCh channel to be received by dqlite.

func (*DB) Bootstrap

func (db *DB) Bootstrap(extensions extensions.Extensions, project string, addr api.URL, clusterRecord cluster.InternalClusterMember) error

Bootstrap dqlite.

func (*DB) Cluster

func (db *DB) Cluster(ctx context.Context, client *dqliteClient.Client) ([]dqliteClient.NodeInfo, error)

Cluster returns information about dqlite cluster members.

func (*DB) IsOpen

func (db *DB) IsOpen() bool

IsOpen returns true only if the DB has been opened and the schema loaded.

func (*DB) Join

func (db *DB) Join(extensions extensions.Extensions, project string, addr api.URL, joinAddresses ...string) error

Join a dqlite cluster with the address of a member.

func (*DB) Leader

func (db *DB) Leader(ctx context.Context) (*dqliteClient.Client, error)

Leader returns a client connected to the leader of the dqlite cluster.

func (*DB) NotifyUpgraded

func (db *DB) NotifyUpgraded()

NotifyUpgraded sends a notification that we can stop waiting for a cluster member to be upgraded.

func (*DB) Open

func (db *DB) Open(ext extensions.Extensions, bootstrap bool, project string) error

Open opens the dqlite database and loads the schema. Returns true if we need to wait for other nodes to catch up to our version.

func (*DB) Schema

func (db *DB) Schema() *update.SchemaUpdate

func (*DB) SetSchema

func (db *DB) SetSchema(schemaExtensions []schema.Update)

func (*DB) StartWithCluster

func (db *DB) StartWithCluster(extensions extensions.Extensions, project string, addr api.URL, clusterMembers map[string]types.AddrPort) error

StartWithCluster starts up dqlite and joins the cluster.

func (*DB) Stop

func (db *DB) Stop() error

Stop closes the database and dqlite connection.

func (*DB) Transaction

func (db *DB) Transaction(outerCtx context.Context, f func(context.Context, *sql.Tx) error) error

Transaction handles performing a transaction on the dqlite database.

func (*DB) Update

func (db *DB) Update() error

Update attempts to update the database with the executable at the path specified by the SCHEMA_UPDATE variable.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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