metadata

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_metadata_metadata_proto protoreflect.FileDescriptor

Functions

func RegisterMetadataTestServer

func RegisterMetadataTestServer(srv *gorums.Server, impl MetadataTestServer)

Types

type Configuration

type Configuration struct {
	gorums.RawConfiguration
	// contains filtered or unexported fields
}

A Configuration represents a static set of nodes on which quorum remote procedure calls may be invoked.

func ConfigurationFromRaw added in v0.7.0

func ConfigurationFromRaw(rawCfg gorums.RawConfiguration, qspec QuorumSpec) (*Configuration, error)

ConfigurationFromRaw returns a new Configuration from the given raw configuration and QuorumSpec.

This function may for example be used to "clone" a configuration but install a different QuorumSpec:

cfg1, err := mgr.NewConfiguration(qspec1, opts...)
cfg2 := ConfigurationFromRaw(cfg1.RawConfig, qspec2)

func (Configuration) And

And returns a NodeListOption that can be used to create a new configuration combining c and d.

func (Configuration) Except

Except returns a NodeListOption that can be used to create a new configuration from c without the nodes in rm.

func (*Configuration) Nodes

func (c *Configuration) Nodes() []*Node

Nodes returns a slice of each available node. IDs are returned in the same order as they were provided in the creation of the Manager.

NOTE: mutating the returned slice is not supported.

type IPAddr

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

func (*IPAddr) GetAddr

func (x *IPAddr) GetAddr() string

func (*IPAddr) ProtoMessage

func (*IPAddr) ProtoMessage()

func (*IPAddr) ProtoReflect

func (x *IPAddr) ProtoReflect() protoreflect.Message

func (*IPAddr) Reset

func (x *IPAddr) Reset()

func (*IPAddr) SetAddr added in v0.10.0

func (x *IPAddr) SetAddr(v string)

func (*IPAddr) String

func (x *IPAddr) String() string

type IPAddr_builder added in v0.10.0

type IPAddr_builder struct {
	Addr string
	// contains filtered or unexported fields
}

func (IPAddr_builder) Build added in v0.10.0

func (b0 IPAddr_builder) Build() *IPAddr

type Manager

type Manager struct {
	*gorums.RawManager
}

Manager maintains a connection pool of nodes on which quorum calls can be performed.

func NewManager

func NewManager(opts ...gorums.ManagerOption) *Manager

NewManager returns a new Manager for managing connection to nodes added to the manager. This function accepts manager options used to configure various aspects of the manager.

func (*Manager) NewConfiguration

func (m *Manager) NewConfiguration(opts ...gorums.ConfigOption) (c *Configuration, err error)

NewConfiguration returns a configuration based on the provided list of nodes (required) and an optional quorum specification. The QuorumSpec is necessary for call types that must process replies. For configurations only used for unicast or multicast call types, a QuorumSpec is not needed. The QuorumSpec interface is also a ConfigOption. Nodes can be supplied using WithNodeMap or WithNodeList, or WithNodeIDs. A new configuration can also be created from an existing configuration, using the And, WithNewNodes, Except, and WithoutNodes methods.

func (*Manager) Nodes

func (m *Manager) Nodes() []*Node

Nodes returns a slice of available nodes on this manager. IDs are returned in the order they were added at creation of the manager.

type MetadataTestNodeClient added in v0.8.0

type MetadataTestNodeClient interface {
	IDFromMD(ctx context.Context, in *emptypb.Empty) (resp *NodeID, err error)
	WhatIP(ctx context.Context, in *emptypb.Empty) (resp *IPAddr, err error)
}

MetadataTestNodeClient is the single node client interface for the MetadataTest service.

type MetadataTestServer added in v0.8.0

type MetadataTestServer interface {
	IDFromMD(ctx gorums.ServerCtx, request *emptypb.Empty) (response *NodeID, err error)
	WhatIP(ctx gorums.ServerCtx, request *emptypb.Empty) (response *IPAddr, err error)
}

MetadataTest is the server-side API for the MetadataTest Service

type Node

type Node struct {
	*gorums.RawNode
}

Node encapsulates the state of a node on which a remote procedure call can be performed.

func (*Node) IDFromMD

func (n *Node) IDFromMD(ctx context.Context, in *emptypb.Empty) (resp *NodeID, err error)

IDFromMD returns the 'id' field from the metadata.

func (*Node) WhatIP

func (n *Node) WhatIP(ctx context.Context, in *emptypb.Empty) (resp *IPAddr, err error)

WhatIP returns the address of the client that calls it.

type NodeID

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

func (*NodeID) GetID

func (x *NodeID) GetID() uint32

func (*NodeID) ProtoMessage

func (*NodeID) ProtoMessage()

func (*NodeID) ProtoReflect

func (x *NodeID) ProtoReflect() protoreflect.Message

func (*NodeID) Reset

func (x *NodeID) Reset()

func (*NodeID) SetID added in v0.10.0

func (x *NodeID) SetID(v uint32)

func (*NodeID) String

func (x *NodeID) String() string

type NodeID_builder added in v0.10.0

type NodeID_builder struct {
	ID uint32
	// contains filtered or unexported fields
}

func (NodeID_builder) Build added in v0.10.0

func (b0 NodeID_builder) Build() *NodeID

type QuorumSpec

type QuorumSpec interface{}

There are no quorum calls.

Jump to

Keyboard shortcuts

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