node

package
v2.6.7 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 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 Builder

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

func NewBuilder

func NewBuilder(opts *ClientOptions) *Builder

func (*Builder) Build

func (b *Builder) Build(addr string) (*Client, error)

Build returns a client for addr, reusing a cached client when one already exists.

Dialing is bounded by the dial timeout so that an unreachable endpoint does not trigger indefinite retries. It returns errors.ErrClientClosed once the builder has been closed.

func (*Builder) Close added in v2.6.7

func (b *Builder) Close() error

Close closes every cached client and rejects new builds. It is idempotent.

type Client

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

func NewClient

func NewClient(cli *drpc.Client) *Client

func (*Client) Close added in v2.6.7

func (c *Client) Close() error

Close closes the client and releases its connections.

func (*Client) Deliver

func (c *Client) Deliver(ctx context.Context, cid, uid int64, buf buffer.Buffer) error

Deliver delivers a message to the node.

func (*Client) GetState

func (c *Client) GetState(ctx context.Context) (cluster.State, error)

GetState returns the state of the node.

func (*Client) SetState

func (c *Client) SetState(ctx context.Context, state cluster.State) error

SetState sets the state of the node.

func (*Client) Trigger

func (c *Client) Trigger(ctx context.Context, event cluster.Event, cid, uid int64) error

Trigger triggers an event on the node.

type ClientOptions added in v2.5.4

type ClientOptions = drpc.ClientOptions

type Provider

type Provider interface {
	// Trigger triggers an event.
	Trigger(ctx context.Context, gid string, cid, uid int64, event cluster.Event) error
	// Deliver delivers a message.
	Deliver(ctx context.Context, gid, nid string, cid, uid int64, buf buffer.Buffer) error
	// GetState returns the state.
	GetState() (cluster.State, error)
	// SetState sets the state.
	SetState(state cluster.State) error
}

type Server

type Server struct {
	*drpc.Server
	// contains filtered or unexported fields
}

func NewServer

func NewServer(provider Provider, opts *ServerOptions) (*Server, error)

type ServerOptions added in v2.3.0

type ServerOptions = drpc.ServerOptions

Jump to

Keyboard shortcuts

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