cluster

package
v0.0.0-...-c6fe19a Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventSource = "jupiter/internal"
)

Variables

View Source
var (
	ErrClusterOffline = fmt.Errorf("failed: cluster not running")

	CtrlBroadcastLeaderLiveness = "CTRL_BROADCAST_LEADER_LIVENESS"
	CtrlBroadcastDistributedGet = "CTRL_BROADCAST_DISTRIBUTED_GET"
)

Functions

func BroadcastHandler

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

func EnsureLeaderActive

func EnsureLeaderActive(ctx context.Context, app *appdata.AppData) (bool, error)

func LeaderHandler

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

func LeaderLiveness

func LeaderLiveness(ctx context.Context, app *appdata.AppData)

func SendToLeader

func SendToLeader(ctx context.Context, app *appdata.AppData, m []byte) ([]byte, error)

Types

type Cluster

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

func NewCluster

func NewCluster() *Cluster

func (*Cluster) AddMember

func (m *Cluster) AddMember(host string)

func (*Cluster) Close

func (m *Cluster) Close()

func (*Cluster) Do

func (m *Cluster) Do(key string, args [][]byte) (interface{}, error)

func (*Cluster) RandomPing

func (m *Cluster) RandomPing() error

type ClusterData

type ClusterData struct {
	App       *appdata.AppData
	Cluster   *Cluster
	ClusterOk int32 // Cluster is working if > 0
}

type DistributedGetInput

type DistributedGetInput struct {
	Name   string         `json:"name"`
	Assign map[int]string `json:"assign"`
}

type DistributedGetOutput

type DistributedGetOutput struct {
	Data map[int][]byte `json:"data"`
}

type Hasher

type Hasher struct{}

func (Hasher) Sum64

func (h Hasher) Sum64(data []byte) uint64

Jump to

Keyboard shortcuts

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