cluster

package
v2.1.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2020 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApplyCommandEvent = "CONFIG_CLUSTER:APPLY_COMMAND"

	ClusterParam = "cluster"
)
View Source
const (
	UpdateBackendDeclarationCommand
	DeleteBackendDeclarationCommand

	UpdateConfigSchemaCommand

	ModuleConnectedCommand
	ModuleDisconnectedCommand
	DeleteModulesCommand

	ActivateConfigCommand
	DeleteConfigsCommand
	UpsertConfigCommand

	DeleteCommonConfigsCommand
	UpsertCommonConfigCommand
)

Variables

View Source
var (
	ErrNoLeader                   = errors.New("no leader in cluster")
	ErrLeaderClientNotInitialized = errors.New("leader client not initialized")
	ErrNotLeader                  = errors.New("node is not a leader")
)
View Source
var (
	// Set from config in main
	WsConnectionReadLimit int64
)

Functions

func PrepareActivateConfigCommand

func PrepareActivateConfigCommand(configID string, date time.Time) []byte

func PrepareDeleteBackendDeclarationCommand

func PrepareDeleteBackendDeclarationCommand(backend structure.BackendDeclaration) []byte

func PrepareDeleteCommonConfigsCommand

func PrepareDeleteCommonConfigsCommand(id string) []byte

func PrepareDeleteConfigsCommand

func PrepareDeleteConfigsCommand(ids []string) []byte

func PrepareDeleteModulesCommand

func PrepareDeleteModulesCommand(ids []string) []byte

func PrepareModuleConnectedCommand

func PrepareModuleConnectedCommand(module entity.Module) []byte

func PrepareModuleDisconnectedCommand

func PrepareModuleDisconnectedCommand(module entity.Module) []byte

func PrepareUpdateBackendDeclarationCommand

func PrepareUpdateBackendDeclarationCommand(backend structure.BackendDeclaration) []byte

func PrepareUpdateConfigSchemaCommand

func PrepareUpdateConfigSchemaCommand(schema entity.ConfigSchema) []byte

func PrepareUpsertCommonConfigCommand

func PrepareUpsertCommonConfigCommand(config UpsertCommonConfig) []byte

func PrepareUpsertConfigCommand

func PrepareUpsertConfigCommand(config UpsertConfig) []byte

Types

type ActivateConfig

type ActivateConfig struct {
	ConfigId string
	Date     time.Time
}

type ApplyLogResponse

type ApplyLogResponse struct {
	ApplyError string
	Result     json2.RawMessage
}

func (ApplyLogResponse) Error

func (a ApplyLogResponse) Error() string

type Client

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

func NewRaftClusterClient

func NewRaftClusterClient(r *raft.Raft, declaration structure.BackendDeclaration, onLeaderDisconnect func(string)) *Client

func (*Client) IsLeader

func (client *Client) IsLeader() bool

func (*Client) Shutdown

func (client *Client) Shutdown() error

func (*Client) SyncApply

func (client *Client) SyncApply(command []byte) (*ApplyLogResponse, error)

func (*Client) SyncApplyOnLeader

func (client *Client) SyncApplyOnLeader(command []byte) (*ApplyLogResponse, error)

type DeleteCommonConfig

type DeleteCommonConfig struct {
	Id string
}

type DeleteConfigs

type DeleteConfigs struct {
	Ids []string
}

type DeleteModules

type DeleteModules struct {
	Ids []string
}

type ResponseWithError

type ResponseWithError struct {
	Response  interface{}
	Error     string
	ErrorCode codes.Code
}

func NewResponse

func NewResponse(value interface{}) ResponseWithError

func NewResponseErrorf

func NewResponseErrorf(code codes.Code, format string, args ...interface{}) ResponseWithError

type SocketLeaderClient

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

func NewSocketLeaderClient

func NewSocketLeaderClient(address string, leaderDisconnectionCallback func()) *SocketLeaderClient

func (*SocketLeaderClient) Ack

func (c *SocketLeaderClient) Ack(data []byte, timeout time.Duration) ([]byte, error)

func (*SocketLeaderClient) Close

func (c *SocketLeaderClient) Close()

func (*SocketLeaderClient) Dial

func (c *SocketLeaderClient) Dial(timeout time.Duration) error

func (*SocketLeaderClient) SendDeclaration

func (c *SocketLeaderClient) SendDeclaration(backend structure.BackendDeclaration, timeout time.Duration) (string, error)

type UpsertCommonConfig

type UpsertCommonConfig struct {
	Config entity.CommonConfig
	Create bool
}

type UpsertConfig

type UpsertConfig struct {
	Config entity.Config
	Create bool
	Unsafe bool
}

Jump to

Keyboard shortcuts

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