server

package
Version: v0.0.0-...-3cbc9b2 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2015 License: MIT Imports: 19 Imported by: 1

Documentation

Index

Constants

View Source
const (
	KRootDir = "/root"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FsStateMachine

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

func NewFsStateMachine

func NewFsStateMachine(fs *db.Fs) *FsStateMachine

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

func (*FsStateMachine) Recovery

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

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

func (*FsStateMachine) Save

func (d *FsStateMachine) 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 Server

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

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

func New

func New(path string, host string, port int) *Server

Creates a new server.

func (*Server) HandleFunc

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

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

func (*Server) Join

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

Joins to the leader of an existing cluster.

func (*Server) ListenAndServe

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

Starts the server.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL