server

package
v0.0.0-...-7d0679b Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2015 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DbStateMachine

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

DbStateMachine contains the DB path.

func NewDbStateMachine

func NewDbStateMachine(path string) *DbStateMachine

NewDbStateMachine returns a StateMachine for capturing and restoring the state of an sqlite database.

func (*DbStateMachine) Recovery

func (d *DbStateMachine) Recovery(b []byte) error

Recovery restores the state of the database using the given data.

func (*DbStateMachine) Save

func (d *DbStateMachine) Save() ([]byte, error)

Save captures the state of the database. The caller must ensure that no transaction is taking place during this call.

http://sqlite.org/howtocorrupt.html states it is safe to do this as long as no transaction is in progress.

type Diagnostics

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

Diagnostics contains a start time of the server.

func NewDiagnostics

func NewDiagnostics() *Diagnostics

NewDiagnostics creates a new Diagnostics object.

type FailedSqlStmt

type FailedSqlStmt struct {
	Sql   string `json:"sql"`
	Error string `json:"error"`
}

FailedSqlStmt contains a SQL query and an error.

type Metrics

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

Metrics are the server metrics user for statistics.

func NewMetrics

func NewMetrics() *Metrics

NewMetrics creates a new Metrics object.

type QueryResponse

type QueryResponse struct {
	Time     string          `json:"time,omitempty"`
	Failures []FailedSqlStmt `json:"failures"`
	Rows     db.RowResults   `json:"rows"`
}

QueryResponse contains the response to a query.

type Server

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

Server is is a combination of the Raft server and an HTTP server which acts as the transport.

func NewServer

func NewServer(dataDir string, dbfile string, snapAfter int, host string, port int) *Server

NewServer creates a new server.

func (*Server) GetStatistics

func (s *Server) GetStatistics() (metrics.Registry, error)

GetStatistics returns an object storing statistics, which supports JSON marshalling.

func (*Server) HandleFunc

func (s *Server) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))

HandleFunc is a hack around Gorilla mux not providing the correct net/http HandleFunc() interface.

func (*Server) Join

func (s *Server) Join(leader string) error

Join joins to the leader of an existing cluster.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe(leader string) error

ListenAndServe starts the server.

type SnapshotConf

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

SnapshotConf contains the index when the last snapshot happened and a threshold for index entries since the last snapshot.

type StmtResponse

type StmtResponse struct {
	Time     string          `json:"time,omitempty"`
	Failures []FailedSqlStmt `json:"failures"`
}

StmtResponse contains a date and a list of failed SQL statements.

Jump to

Keyboard shortcuts

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