cluster

package
v0.0.0-...-9f8336a Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

func NewHandler

func NewHandler(s *Server) *Handler

func (*Handler) HandleJoin

func (h *Handler) HandleJoin(member serf.Member) error

func (*Handler) HandleLeave

func (s *Handler) HandleLeave(member serf.Member) error

func (*Handler) HandleMessage

func (s *Handler) HandleMessage(payload []byte) error

func (*Handler) HandleQuery

func (s *Handler) HandleQuery(payload []byte) error

func (*Handler) HandleUpdate

func (h *Handler) HandleUpdate(member serf.Member) error

type Message

type Message struct {
	Action string
	Key    string
	Val    any
}

func (*Message) Decode

func (m *Message) Decode(payload []byte) error

func (*Message) Encode

func (m *Message) Encode() ([]byte, error)

type Options

type Options struct {
	// Unique ID of server
	ID string
	// Local address to bind to
	Address string
	// Members in the cluster
	Members []string
}

type Server

type Server struct {
	Opts *Options
	// contains filtered or unexported fields
}

func New

func New(opts *Options) (*Server, error)

func (*Server) Broadcast

func (s *Server) Broadcast(payload []byte)

func (*Server) Delete

func (s *Server) Delete(key string, local bool) error

func (*Server) Get

func (s *Server) Get(key string) (any, error)

func (*Server) Join

func (s *Server) Join(members []string) error

func (*Server) Set

func (s *Server) Set(key string, val any, local bool) error

Jump to

Keyboard shortcuts

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