server

package
v0.0.0-...-816f7d6 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: Apache-2.0 Imports: 17 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHostRequestAddr

func GetHostRequestAddr() string

func GetHostTCPAddr

func GetHostTCPAddr() string

func GetHostUDPAddr

func GetHostUDPAddr() string

func GetPeerTCPAddr

func GetPeerTCPAddr() []string

func GetPeerUDPAddr

func GetPeerUDPAddr() []string

func NewClientRequest

func NewClientRequest(req *Request, reply **Reply) error

This is the API for client that is co-located withe gometa server in the same process.

func NewEnv

func NewEnv(config string) (err error)

func RunOnce

func RunOnce() int

Run the server until it stop. Will not attempt to re-run.

func RunServer

func RunServer(config string) error

Types

type Config

type Config struct {
	Host *Node
	Peer []*Node
}

type EmbeddedServer

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

func RunEmbeddedServer

func RunEmbeddedServer(msgAddr string) (*EmbeddedServer, error)

func RunEmbeddedServerWithCustomHandler

func RunEmbeddedServerWithCustomHandler(msgAddr string,
	notifier action.EventNotifier,
	reqHandler protocol.CustomRequestHandler,
	repoName string,
	memory_quota uint64) (*EmbeddedServer, error)

func RunEmbeddedServerWithCustomHandler2

func RunEmbeddedServerWithCustomHandler2(msgAddr string,
	notifier action.EventNotifier,
	reqHandler protocol.CustomRequestHandler,
	repoName string,
	memory_quota uint64,
	sleepDur uint64,
	threshold uint8,
	minFileSize uint64) (*EmbeddedServer, error)

func RunEmbeddedServerWithCustomHandler3

func RunEmbeddedServerWithCustomHandler3(msgAddr string,
	notifier action.EventNotifier,
	reqHandler protocol.CustomRequestHandler,
	repoName string,
	memory_quota uint64,
	sleepDur uint64,
	threshold uint8,
	minFileSize uint64,
	authfn common.ServerAuthFunction) (*EmbeddedServer, error)

func RunEmbeddedServerWithNotifier

func RunEmbeddedServerWithNotifier(msgAddr string, notifier action.EventNotifier) (*EmbeddedServer, error)

func (*EmbeddedServer) Broadcast

func (s *EmbeddedServer) Broadcast(key string, value []byte) error

Broadcast value

func (*EmbeddedServer) Delete

func (s *EmbeddedServer) Delete(key string) error

Delete value

func (*EmbeddedServer) DeleteConfigValue

func (s *EmbeddedServer) DeleteConfigValue(key string) error

func (*EmbeddedServer) DeleteValue

func (s *EmbeddedServer) DeleteValue(key string)

Delete value

func (*EmbeddedServer) GetConfigValue

func (s *EmbeddedServer) GetConfigValue(key string) (string, error)

func (*EmbeddedServer) GetEnsembleSize

func (s *EmbeddedServer) GetEnsembleSize() uint64

func (*EmbeddedServer) GetFollowerId

func (s *EmbeddedServer) GetFollowerId() string

func (*EmbeddedServer) GetIterator

func (s *EmbeddedServer) GetIterator(startKey, endKey string) (*r.RepoIterator, error)

Create a new iterator

func (*EmbeddedServer) GetServerConfigIterator

func (s *EmbeddedServer) GetServerConfigIterator(startKey, endKey string) (*r.RepoIterator, error)

func (*EmbeddedServer) GetStatus

func (s *EmbeddedServer) GetStatus() protocol.PeerStatus

func (*EmbeddedServer) GetValue

func (s *EmbeddedServer) GetValue(key string) ([]byte, error)

Retrieve value

func (*EmbeddedServer) HasQuorum

func (s *EmbeddedServer) HasQuorum(count int) bool

func (*EmbeddedServer) IsActive

func (s *EmbeddedServer) IsActive() bool

Check if server is active

func (*EmbeddedServer) IsDone

func (s *EmbeddedServer) IsDone() bool

Check if server is terminated

func (*EmbeddedServer) MakeAsyncRequest

func (s *EmbeddedServer) MakeAsyncRequest(op common.OpCode, key string, value []byte) error

func (*EmbeddedServer) MakeRequest

func (s *EmbeddedServer) MakeRequest(op common.OpCode, key string, value []byte) error

Set value

func (*EmbeddedServer) ResetConnections

func (s *EmbeddedServer) ResetConnections() error

Reset Connections

func (*EmbeddedServer) Set

func (s *EmbeddedServer) Set(key string, value []byte) error

Set value

func (*EmbeddedServer) SetConfigValue

func (s *EmbeddedServer) SetConfigValue(key string, value string) error

func (*EmbeddedServer) SetValue

func (s *EmbeddedServer) SetValue(key string, value []byte)

Set value

func (*EmbeddedServer) Terminate

func (s *EmbeddedServer) Terminate()

Terminate the Server

func (*EmbeddedServer) UpdateStateOnCommit

func (s *EmbeddedServer) UpdateStateOnCommit(txnid common.Txnid, key string)

Callback when a commit arrives

func (*EmbeddedServer) UpdateStateOnNewProposal

func (s *EmbeddedServer) UpdateStateOnNewProposal(proposal protocol.ProposalMsg)

Callback when a new proposal arrives

func (*EmbeddedServer) UpdateStateOnRespond

func (s *EmbeddedServer) UpdateStateOnRespond(fid string, reqId uint64, err string, content []byte)

func (*EmbeddedServer) UpdateWinningEpoch

func (s *EmbeddedServer) UpdateWinningEpoch(epoch uint32)

type Env

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

type Node

type Node struct {
	ElectionAddr string
	MessageAddr  string
	RequestAddr  string
}

type Reply

type Reply struct {
	Result []byte
}

type Request

type Request struct {
	OpCode string
	Key    string
	Value  []byte
}

type RequestListener

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

func StartRequestListener

func StartRequestListener(laddr string, server *Server) (*RequestListener, error)

Start a new RequestListener for listening to new client request. laddr - local network address (host:port)

func (*RequestListener) Close

func (li *RequestListener) Close()

Close the listener. This does not reclaim the exisiting client conection immediately, but it will stop new connection.

type RequestReceiver

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

func (*RequestReceiver) NewRequest

func (s *RequestReceiver) NewRequest(req *Request, reply **Reply) error

Handle a new incoming request

func (s *RequestReceiver) NewRequest(message []byte, reply *[]byte) error {

type Server

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

func (*Server) GetEnsembleSize

func (s *Server) GetEnsembleSize() uint64

func (*Server) GetFollowerId

func (s *Server) GetFollowerId() string

func (*Server) GetHostTCPAddr

func (s *Server) GetHostTCPAddr() string

func (*Server) GetPeerUDPAddr

func (s *Server) GetPeerUDPAddr() []string

func (*Server) GetStatus

func (s *Server) GetStatus() protocol.PeerStatus

func (*Server) GetValue

func (s *Server) GetValue(key string) ([]byte, error)

func (*Server) HasQuorum

func (s *Server) HasQuorum(count int) bool

func (*Server) IsDone

func (s *Server) IsDone() bool

Check if server is terminated

func (*Server) Terminate

func (s *Server) Terminate()

Terminate the Server

func (*Server) UpdateStateOnCommit

func (s *Server) UpdateStateOnCommit(txnid common.Txnid, key string)

Callback when a commit arrives

func (*Server) UpdateStateOnNewProposal

func (s *Server) UpdateStateOnNewProposal(proposal protocol.ProposalMsg)

Callback when a new proposal arrives

func (*Server) UpdateStateOnRespond

func (s *Server) UpdateStateOnRespond(fid string, reqId uint64, err string, content []byte)

func (*Server) UpdateWinningEpoch

func (s *Server) UpdateWinningEpoch(epoch uint32)

type ServerState

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

func (*ServerState) AddPendingRequest

func (s *ServerState) AddPendingRequest(handle *protocol.RequestHandle)

func (*ServerState) CleanupOnError

func (s *ServerState) CleanupOnError()

func (*ServerState) GetRequestChannel

func (s *ServerState) GetRequestChannel() <-chan *protocol.RequestHandle

Jump to

Keyboard shortcuts

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