Documentation ¶
Index ¶
Constants ¶
const BootstrapID = 0x2dc171858c3155be
BootstrapID is a magic ID that should be used for the fist node in a cluster. Alternatively ID 1 can be used as well.
Variables ¶
This section is empty.
Functions ¶
func ConfigMultiThread ¶ added in v1.2.0
func ConfigMultiThread() error
ConfigMultiThread sets the threading mode of SQLite to Multi-thread.
By default go-dqlite configures SQLite to Single-thread mode, because the dqlite engine itself is single-threaded, and enabling Multi-thread or Serialized modes would incur in a performance penality.
If your Go process also uses SQLite directly (e.g. using the github.com/mattn/go-sqlite3 bindings) you might need to switch to Multi-thread mode in order to be thread-safe.
IMPORTANT: It's possible to successfully change SQLite's threading mode only if no SQLite APIs have been invoked yet (e.g. no database has been opened yet). Therefore you'll typically want to call ConfigMultiThread() very early in your process setup. Alternatively you can set the GO_DQLITE_MULTITHREAD environment variable to 1 at process startup, in order to prevent go-dqlite from setting Single-thread mode at all.
func GenerateID ¶ added in v1.4.0
GenerateID generates a unique ID for a new node, based on a hash of its address and the current time.
func ReconfigureMembership ¶ added in v1.8.1
ReconfigureMembership can be used to recover a cluster whose majority of nodes have died, and therefore has become unavailable.
It forces appending a new configuration to the raft log stored in the given directory, effectively replacing the current configuration.
Types ¶
type Node ¶ added in v1.0.0
type Node struct {
// contains filtered or unexported fields
}
Node runs a dqlite node.
func New ¶ added in v1.0.0
func New(id uint64, address string, dir string, emmc_ip string, emmc_port int, options ...Option) (*Node, error)
New creates a new Node instance.
func (*Node) BindAddress ¶ added in v1.0.0
BindAddress returns the network address the node is listening to.
type Option ¶ added in v1.0.0
type Option func(*options)
Option can be used to tweak node parameters.
func WithBindAddress ¶ added in v1.0.0
WithBindAddress sets a custom bind address for the server.
func WithDialFunc ¶
WithDialFunc sets a custom dial function for the server.
func WithFailureDomain ¶ added in v1.8.1
WithFailureDomain sets the code of the failure domain the node belongs to.
func WithNetworkLatency ¶ added in v1.0.0
WithNetworkLatency sets the average one-way network latency.