Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is a high-level helper for initializing a typical dqlite-based Go application.
It takes care of starting a dqlite node and registering a dqlite Go SQL driver.
func (*App) Handover ¶
Handover transfers all responsibilities for this node (such has leadership and voting rights) to another node, if one is available.
This method should always be called before invoking Close(), in order to gracefully shut down a node.
func (*App) Ready ¶
Ready can be used to wait for a node to complete tasks that are initiated at startup. For example a new node will attempt to join the cluster, a restarted node will check if it should assume some particular role, etc.
If this method returns without error it means that those initial tasks have succeeded and follow-up operations like Open() are more likely to succeed quickly.
type Option ¶
type Option func()
Option can be used to tweak app parameters.
func WithAddress ¶
WithAddress sets the network address of the application node.
Other application nodes must be able to connect to this application node using the given address.
If the application node is not the first one in the cluster, the address must match the value that was passed to the App.Add() method upon registration.
If not given the first non-loopback IP address of any of the system network interfaces will be used, with port 9000.
The address must be stable across application restarts.
func WithCluster ¶
WithCluster must be used when starting a newly added application node for the first time.
It should contain the addresses of one or more applications nodes which are already part of the cluster.
func WithLogFunc ¶
WithLogFunc sets a custom log function.
func WithTLS ¶
WithTLS enables TLS encryption of network traffic.
The "listen" parameter must hold the TLS configuration to use when accepting incoming connections clients or application nodes.
The "dial" parameter must hold the TLS configuration to use when establishing outgoing connections to other application nodes.
func WithTracing ¶
WithTracing will emit a log message at the given level every time a statement gets executed.