server

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

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

Go to latest
Published: Aug 8, 2022 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

nolint

Index

Constants

This section is empty.

Variables

View Source
var (
	//ErrorPeerAlreadyExists error if the peer with same name already exists
	ErrorPeerAlreadyExists = errors.New("peer with this name already exists in cluster")
)
View Source
var ErrorStoreAlreadyExists = errors.New("store with this name already exists")

ErrorStoreAlreadyExists error if store with this name already exists

View Source
var ErrorStoreDoesExists = errors.New("store does not exists")

ErrorStoreDoesExists error if store does not exists

Functions

func ExecuteCmdCreateStore

func ExecuteCmdCreateStore(args *CreateCommandArgs, address string, port int32) (*pb.StoreCreateReply, error)

ExecuteCmdCreateStore helper function to executed create store command

func ExecuteCmdGet

func ExecuteCmdGet(args *GetArgs, address string, port int32) (*pb.GetReply, error)

ExecuteCmdGet helper function to perform put command

func ExecuteCmdListStore

func ExecuteCmdListStore(address string, port int32) (*pb.ListStoreReply, error)

ExecuteCmdListStore executes the list command for a store

func ExecuteCmdPut

func ExecuteCmdPut(args *PutArgs, address string, port int32) error

ExecuteCmdPut helper function to perform put command

func ExecuteCmdQuery

func ExecuteCmdQuery(args *QueryArgs, address string, port int32) (*pb.ExecuteQueryReply, error)

ExecuteCmdQuery executes the query on the store

func ExecuteCmdSQLQuery

func ExecuteCmdSQLQuery(args *QueryArgs, address string, port int32) (*pb.QueryReply, error)

ExecuteCmdSQLQuery executes the query on the store

func ExecuteCmdStatus

func ExecuteCmdStatus(address string, port int32) (*pb.ClusterStatusReply, error)

ExecuteCmdStatus helper function to execute grpc call to get the status

func GetLeader

func GetLeader(address string, port int32) (*pb.Peer, error)

GetLeader returns the current leader in the system

Types

type CreateCommandArgs

type CreateCommandArgs struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

CreateCommandArgs argument structure for this command

type GetArgs

type GetArgs struct {
	Key       string `json:"key"`
	StoreName string `json:"storeName"`
}

GetArgs argument structure for this command

type HTTPHandler

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

HTTPHandler http handler

func NewHTTPHandler

func NewHTTPHandler(srv Server) *HTTPHandler

NewHTTPHandler create object of the router

func (*HTTPHandler) Router

func (h *HTTPHandler) Router() *gin.Engine

Router return the Gin router object

type NewServerArgs

type NewServerArgs struct {
	Name        string
	Address     string
	Port        int32
	Loglevel    string
	WalDir      string
	IsTestMode  bool
	HTTPPort    int
	Controllers []string
}

NewServerArgs argument structure for new server

type PutArgs

type PutArgs struct {
	Key       string `json:"key"`
	Value     string `json:"value"`
	StoreName string `json:"storeName"`
}

PutArgs argument structure for this command

type QueryArgs

type QueryArgs struct {
	SQLStr    string `json:"sql"`
	StoreName string `json:"storeName"`
}

QueryArgs arguments for the query command

type Server

type Server interface {
	pb.YadosServiceServer
	Name() string
	Stop() error
	Address() string
	Port() int32
	Peers() map[string]*pb.Peer
	Logger() *logrus.Logger
	SetLogLevel(level string)
	Serve() error
	RPCServer() rpc.Server
	Raft() raft.Raft
	Self() *pb.Peer
	State() raft.State
	WALDir() string
	WAL() wal.Wal
	HTTPPort() int
	StartHTTPServer()
	StopHTTPServer() error
	StoreManager() store.Manager
	Controller() []controller

	// EventHandler for test purpose
	EventHandler() *events.Events
}

Server Server interface

func NewServer

func NewServer(args *NewServerArgs) (Server, error)

NewServer creates new instance of a server

type StatusArgs

type StatusArgs struct {
	Address string
	Port    int32
}

StatusArgs arguments for status cluster

Jump to

Keyboard shortcuts

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