client

package
v0.0.0-...-7336bec Latest Latest
Warning

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

Go to latest
Published: May 27, 2020 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RPCMethodLeaderRequest = "cl"
	RPCMethodActionRequest = "ca"
	RPCMethodQueryRequest  = "cq"
)

Variables

This section is empty.

Functions

func StartClientFromFile

func StartClientFromFile(filepath string) error

StartClientFromFile starts Client from given file

Types

type ActionReq

type ActionReq struct {
	Cmd sm.TSMAction
}

ActionReq representing the action request

type ActionRes

type ActionRes struct {
	Started bool
}

ActionRes representing the action response

type Client

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

Client representing the client

func NewClientFromConfig

func NewClientFromConfig(config clientConfig) (*Client, error)

NewClientFromConfig returns a new Client from a given configuration

type ClientCore

type ClientCore struct {
	ActBuilder *sm.TSMActionBuilder
	// contains filtered or unexported fields
}

ClientCore representing the detailed info of clietn

func NewClientCore

func NewClientCore(clientID string, nodeIDs []rpccore.NodeID, cnode rpccore.Node, logger *logrus.Logger) ClientCore

NewClientCore takes arguments and returns a ClientCore object

func (*ClientCore) ExecuteActionRequest

func (core *ClientCore) ExecuteActionRequest(act sm.TSMAction) (bool, string)

ExecuteActionRequest takes ClientCore and TSMAction structs as arguments, and returns whether the action is succeed and error value if occurs

func (*ClientCore) ExecuteQueryRequest

func (core *ClientCore) ExecuteQueryRequest(query sm.TSMQuery) (interface{}, error)

ExecuteQueryRequest takes ClientCore and TSMQuery structs as arguments, and returns data from the query response and error value if occurs

type LeaderRes

type LeaderRes struct {
	HasLeader bool
	LeaderID  rpccore.NodeID
}

LeaderRes representing the leader response

type QueryReq

type QueryReq struct {
	Cmd sm.TSMQuery
}

QueryReq representing the query request

type QueryRes

type QueryRes struct {
	Success  bool
	QueryErr *string
	Data     interface{}
}

QueryRes representing the query response

Jump to

Keyboard shortcuts

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