Documentation ¶
Overview ¶
Package dqlite implements a database/sql/driver with raft-based SQLite replication.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFSM ¶
NewFSM creates a new dqlite FSM, suitable to be passed to raft.NewRaft.
It will handle replication of the SQLite write-ahead log.
This is mostly an internal implementation detail of dqlite, but it needs to be exposed since the raft.Raft parameter that NewDriver accepts doesn't allow access to the FSM that it was passed when created with raft.NewRaft().
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn implements the sql.Conn interface.
func (*Conn) Close ¶
Close invalidates and potentially stops any current prepared statements and transactions, marking this connection as no longer in use.
Because the sql package maintains a free pool of connections and only calls Close when there's a surplus of idle connections, it shouldn't be necessary for drivers to do their own connection caching.
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver manages a node partecipating to a dqlite replicated cluster.
func NewDriver ¶
NewDriver creates a new node of a dqlite cluster, which also implements the driver.Driver interface.
The Registry instance must be the same one that was passed to NewFSM to build the raft.FSM which in turn got passed to raft.NewRaft for creating the raft instance.
func (*Driver) Open ¶
Open starts a new connection to a SQLite database.
The given name must be a pure file name without any directory segment, dqlite will connect to a database with that name in its data directory.
Query parameters are always valid except for "mode=memory".
If this node is not the leader, or the leader is unknown an ErrNotLeader error is returned.
type DriverConfig ¶
type DriverConfig struct { Logger *log.Logger // Logger to use to emit messages. BarrierTimeout time.Duration // Maximum amount of time to wait for the FSM to catch up with logs. ApplyTimeout time.Duration // Maximum amount of time to wait for a raft FSM command to be applied. CheckpointThreshold uint64 // Minimum number of WAL frames before performing a checkpoint. }
DriverConfig holds configuration options for a dqlite SQL Driver.
type Registry ¶
Registry tracks internal data shared by the dqlite Driver and FSM.
func NewRegistry ¶
NewRegistry creates a new Registry, which is expected to be passed to both NewFSM and NewDriver.
The dir parameter is the directory where dqlite will store the underlying SQLite database files.
type Stmt ¶
type Stmt struct {
// contains filtered or unexported fields
}
Stmt is a prepared statement. It is bound to a Conn and not used by multiple goroutines concurrently.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
internal
|
|
protocol
Package protocol is a generated protocol buffer package.
|
Package protocol is a generated protocol buffer package. |
replication
Package replication implements the core part of dqlite, setting up raft-based replication of the SQLite WAL.
|
Package replication implements the core part of dqlite, setting up raft-based replication of the SQLite WAL. |
trace
Package trace implements a tracing system that can handle emitting large amounts of entries with minimal performance overhead.
|
Package trace implements a tracing system that can handle emitting large amounts of entries with minimal performance overhead. |
recover
|
|