cluster

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Query

func Query(node string) *client.Client

Query query a registed node in cluster

Returns a *client.Client

func Register

func Register(node string, address string, opts ...client.Option) (*client.Client, error)

Register register skynet cluster node default withArgsCodec(json) and Timeout(5*second)

Examples:

Register("node1", "192.0.2.1:6789", client.WithArgsCodec(&client.ArgsCodecJson{})

If you want to reload node address to port:6790, old client will close after 30s Register("node1", "192.0.2.1:6790")

func ReloadCluster

func ReloadCluster(nodes map[string]string, opts ...client.Option) map[string]error

ReloadCluster register multi skynet cluster node

Default withArgsCodec(json) and Timeout(5*second)

# It's safely to Reload multi times with same config # If client connecting. It will closed after 30s

Examples:

ReloadCluster("node1", map[string]string{"node":"127.0.0.1:8080"}, client.WithArgsCodec(&client.ArgsCodecJson{})

Returns register fail nodesErr

func Remove

func Remove(node string)

Remove remove cluster registed node

Client connecting will break afeter 30s

Types

type Cluster

type Cluster struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func GetCluster

func GetCluster() *Cluster

Jump to

Keyboard shortcuts

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