mirror

package
v0.0.0-...-ba27772 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package mirror provides a range assignment mirror, which can maintain a map of all range assignments via the streaming Node.Ranges endpoint provided by the rangelet. This is useful for proxies and clients wishing to forward requests to the relevant node(s).

Note that this interface is eventually consistent, in that the orchestrator doesn't wait for clients to ack changes to the keyspace or anything like it. This interface doesn't even care what the orchestrator or even keyspace say; it simply reports what placements nodes report when probed or in response to actuations. The clients' mirror will thus always be a bit out of date.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSuchClientConn = errors.New("no such connection")

Functions

This section is empty.

Types

type Dialler

type Dialler func(context.Context, api.Remote) (*grpc.ClientConn, error)

type Mirror

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

func New

func New(disc discovery.Discoverer) *Mirror

func (*Mirror) Conn

func (m *Mirror) Conn(nID api.NodeID) (*grpc.ClientConn, bool)

Conn returns a connection to the given node ID. This is just a convenience for callers; the mirror needs to have a connection to every node in order to receive their range assignments, so callers may wish to reuse it to exchange other RPCs rather than creating a new one.

Note that because the connection is owned by the Mirror, may be closed while the user is trying to use it. If that isn't acceptable, callers should manage their own connections.

func (*Mirror) Find

func (m *Mirror) Find(key api.Key, states ...api.RemoteState) []Result

func (*Mirror) Stop

func (m *Mirror) Stop() error

func (*Mirror) WithDialler

func (m *Mirror) WithDialler(d Dialler) *Mirror

type Result

type Result struct {
	RangeID api.RangeID
	Remote  api.Remote
	State   api.RemoteState
}

Result is returned by the Find method. Don't use it for anything else.

func (*Result) NodeID

func (r *Result) NodeID() api.NodeID

Jump to

Keyboard shortcuts

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