balancer

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package balancer defines APIs for load balancing in RSocket.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Balancer

type Balancer interface {
	io.Closer
	// Put puts a new client.
	Put(client rsocket.Client)
	// PutLabel puts a new client with a label.
	PutLabel(label string, client rsocket.Client)
	// Next returns next balanced RSocket client.
	Next() rsocket.Client
	// OnLeave handle events when a client exit.
	OnLeave(fn func(label string))
}

Balancer manage input RSocket clients.

func NewRoundRobinBalancer

func NewRoundRobinBalancer() Balancer

NewRoundRobinBalancer returns a new Round-Robin Balancer.

type Group

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

Group manage a group of Balancer. Group can be used to create a simple RSocket Broker.

func NewGroup

func NewGroup(gen func() Balancer) *Group

NewGroup returns a new Group.

func (*Group) Close

func (p *Group) Close() (err error)

func (*Group) Get

func (p *Group) Get(id string) Balancer

Get returns a Balancer with custom id.

Jump to

Keyboard shortcuts

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