api

package
v0.0.1-78 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeCommandPacket

func DecodeCommandPacket(data []byte) (interface{}, error)

DecodeCommandPacket decodes a packet from bytes to a structure.

func EncodeCommandPacket

func EncodeCommandPacket(command interface{}) ([]byte, error)

EncodeCommandPacket encodes a packet from a structure to bytes bytes.

Types

type Client

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

Client represents a connected client.

func ConnectAsServer

func ConnectAsServer(opts ConnectAsServerOptions) (*Client, error)

ConnectAsServer creates a new API client connection, but acts as if we are the server-side. This is used so the client can kill this process automatically.

func (*Client) WaitForClose

func (c *Client) WaitForClose()

WaitForClose will wait until this client disconnects

type CmdAddBucket

type CmdAddBucket struct {
	ClusterID   string `json:"cluster"`
	BucketName  string `json:"name"`
	NumReplicas uint   `json:"replicas"`
	BucketType  string `json:"bucket_type"`
}

CmdAddBucket requests a new mock bucket be created.

type CmdAddedBucket

type CmdAddedBucket struct {
}

CmdAddedBucket represents the reply to an add bucket request.

type CmdCreateCluster

type CmdCreateCluster struct {
	ClusterID string `json:"id"`
}

CmdCreateCluster requests a new mock cluster be created.

type CmdCreatedCluster

type CmdCreatedCluster struct {
	MgmtAddrs []string `json:"mgmt_addrs"`
	ConnStr   string   `json:"connstr"`
}

CmdCreatedCluster represents the reply to a create cluster request.

type CmdEndTest

type CmdEndTest struct {
	RunID  string `json:"run"`
	Result interface{}
}

CmdEndTest indicates to end a particular test.

type CmdEndTesting

type CmdEndTesting struct {
	RunID string `json:"run"`
}

CmdEndTesting indicates to stop a particular report.

type CmdEndedTest

type CmdEndedTest struct {
	Error string
}

CmdEndedTest is returned when a test has been stopped.

type CmdEndedTesting

type CmdEndedTesting struct {
	Report interface{} `json:"report"`
}

CmdEndedTesting indicates a particular report has ended.

type CmdHello

type CmdHello struct {
}

CmdHello represents a hello to the server

type CmdStartTest

type CmdStartTest struct {
	RunID    string `json:"run"`
	TestName string `json:"test"`
}

CmdStartTest indicates to start a particular test.

type CmdStartTesting

type CmdStartTesting struct {
	RunID      string `json:"run"`
	ClientName string `json:"client"`
}

CmdStartTesting indicates to start a new report.

type CmdStartedTest

type CmdStartedTest struct {
	ConnStr        string `json:"connstr"`
	BucketName     string `json:"bucket"`
	ScopeName      string `json:"scope"`
	CollectionName string `json:"collection"`
}

CmdStartedTest is returned when a test has been started.

type CmdStartedTesting

type CmdStartedTesting struct {
	MgmtAddrs []string `json:"mgmt_addrs"`
	ConnStr   string   `json:"connstr"`
}

CmdStartedTesting indicates a new report was started.

type CmdTimeTravel

type CmdTimeTravel struct {
	RunID     string `json:"run"`
	ClusterID string `json:"cluster"`
	Amount    uint64 `json:"amount_ms"`
}

CmdTimeTravel allows a test run or cluster to be time travelled.

type CmdTimeTravelled

type CmdTimeTravelled struct {
}

CmdTimeTravelled represents a reply to time travelling.

type ConnectAsServerOptions

type ConnectAsServerOptions struct {
	Address string
	Handler HandlerFunc
}

ConnectAsServerOptions provides options when creating an API client.

type HandlerFunc

type HandlerFunc func(command interface{}) interface{}

HandlerFunc provides an interface for handling and replying to messages received via the API server.

type NewServerOptions

type NewServerOptions struct {
	ListenPort int
	Handler    HandlerFunc
}

NewServerOptions provides options when creating an API server.

type Server

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

Server represents an instance of the API server.

func NewServer

func NewServer(opts NewServerOptions) (*Server, error)

NewServer creates a new API server.

func (*Server) ListenPort

func (s *Server) ListenPort() int

ListenPort returns the port this server is listening on.

Jump to

Keyboard shortcuts

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