Documentation ¶
Index ¶
- Constants
- Variables
- func ErrorCode(err error) int
- func Init() error
- type DialFunc
- type Error
- type LogFunc
- type Server
- func (s *Server) Bootstrap(servers []ServerInfo) error
- func (s *Server) Close()
- func (s *Server) Cluster() ([]ServerInfo, error)
- func (s *Server) Dump(filename string) ([]byte, error)
- func (s *Server) Handle(conn net.Conn) error
- func (s *Server) Leader() *ServerInfo
- func (s *Server) Ready() bool
- func (s *Server) Run() error
- func (s *Server) SetDialFunc(dial DialFunc)
- func (s *Server) SetLogFunc(log LogFunc)
- func (s *Server) SetWatchFunc(watch WatchFunc)
- func (s *Server) Stop() error
- type ServerInfo
- type WatchFunc
Constants ¶
const ( Integer = C.SQLITE_INTEGER Float = C.SQLITE_FLOAT Text = C.SQLITE_TEXT Blob = C.SQLITE_BLOB Null = C.SQLITE_NULL )
SQLite datatype codes
const ( UnixTime = C.DQLITE_UNIXTIME ISO8601 = C.DQLITE_ISO8601 Boolean = C.DQLITE_BOOLEAN )
Special data types for time values.
const ( LogDebug = C.DQLITE_DEBUG LogInfo = C.DQLITE_INFO LogWarn = C.DQLITE_WARN LogError = C.DQLITE_ERROR )
Logging levels.
const ( Follower = C.DQLITE_FOLLOWER Candidate = C.DQLITE_CANDIDATE Leader = C.DQLITE_LEADER )
States
const ( RequestLeader = C.DQLITE_REQUEST_LEADER RequestClient = C.DQLITE_REQUEST_CLIENT RequestHeartbeat = C.DQLITE_REQUEST_HEARTBEAT RequestOpen = C.DQLITE_REQUEST_OPEN RequestPrepare = C.DQLITE_REQUEST_PREPARE RequestExec = C.DQLITE_REQUEST_EXEC RequestQuery = C.DQLITE_REQUEST_QUERY RequestFinalize = C.DQLITE_REQUEST_FINALIZE RequestExecSQL = C.DQLITE_REQUEST_EXEC_SQL RequestQuerySQL = C.DQLITE_REQUEST_QUERY_SQL RequestInterrupt = C.DQLITE_REQUEST_INTERRUPT RequestJoin = C.DQLITE_REQUEST_JOIN RequestPromote = C.DQLITE_REQUEST_PROMOTE RequestRemove = C.DQLITE_REQUEST_REMOVE )
Request types.
const ( ResponseFailure = C.DQLITE_RESPONSE_FAILURE ResponseServer = C.DQLITE_RESPONSE_SERVER ResponseWelcome = C.DQLITE_RESPONSE_WELCOME ResponseServers = C.DQLITE_RESPONSE_SERVERS ResponseDb = C.DQLITE_RESPONSE_DB ResponseStmt = C.DQLITE_RESPONSE_STMT ResponseResult = C.DQLITE_RESPONSE_RESULT ResponseRows = C.DQLITE_RESPONSE_ROWS ResponseEmpty = C.DQLITE_RESPONSE_EMPTY )
Response types.
const ( ErrError = C.SQLITE_ERROR ErrInternal = C.SQLITE_INTERNAL ErrNoMem = C.SQLITE_NOMEM ErrInterrupt = C.SQLITE_INTERRUPT ErrBusy = C.SQLITE_BUSY ErrIoErr = C.SQLITE_IOERR ErrIoErrNotLeader = C.SQLITE_IOERR_NOT_LEADER ErrIoErrLeadershipLost = C.SQLITE_IOERR_LEADERSHIP_LOST )
Error codes.
const ProtocolVersion = uint64(C.DQLITE_PROTOCOL_VERSION)
ProtocolVersion is the latest dqlite server protocol version.
Variables ¶
var ErrServerCantBootstrap = fmt.Errorf("server already bootstrapped")
ErrServerCantBootstrap is returned by Server.Bootstrap() if the server has already a raft configuration.
var ErrServerStopped = fmt.Errorf("server was stopped")
ErrServerStopped is returned by Server.Handle() is the server was stopped.
Functions ¶
Types ¶
type DialFunc ¶ added in v0.9.2
DialFunc is a function that can be used to establish a network connection.
type Server ¶
Server is a Go wrapper arround dqlite_server.
func (*Server) Bootstrap ¶ added in v0.9.0
func (s *Server) Bootstrap(servers []ServerInfo) error
Bootstrap the a server, setting its initial raft configuration.
func (*Server) Cluster ¶ added in v0.9.2
func (s *Server) Cluster() ([]ServerInfo, error)
Cluster returns information about all servers in the cluster.
func (*Server) Leader ¶ added in v0.9.2
func (s *Server) Leader() *ServerInfo
Leader returns information about the current leader, if any.
func (*Server) SetDialFunc ¶ added in v0.9.2
SetDialFunc configure a custom dial function.
func (*Server) SetLogFunc ¶ added in v0.9.2
SetLogFunc configure a custom log function.
func (*Server) SetWatchFunc ¶ added in v0.9.3
SetWatchFunc configures a watch function to be notified about state changes.
type ServerInfo ¶
ServerInfo is the Go equivalent of dqlite_server.