federation

package
v0.0.0-...-55c251c Latest Latest
Warning

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

Go to latest
Published: May 24, 2022 License: MIT Imports: 19 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MinNodeID = NodeID{0, 0}

MinNodeID is the start of NodeID of a federacy ring

Functions

This section is empty.

Types

type BootingInfo

type BootingInfo struct {
	Leader NodeID
	Time   common.StopwatchTime
}

type Dialer

type Dialer func(addr string) (*transport.Client, error)

type FederationPartnerNodeHeader

type FederationPartnerNodeHeader struct {
	PartnerNodeInfo
	Flags int32
}

type GlobalLease

type GlobalLease struct {
	Tickets  []VoteTicket
	Delta    common.TimeSpan
	BaseTime common.StopwatchTime
}

type NodeID

type NodeID uint128

NodeID is an unique identifier for each node in a federacy ring a NodeID is a 128 bit number, unit128_t

func NodeIDFromHex

func NodeIDFromHex(v string) (NodeID, error)

NodeIDFromHex convert string in 16 base from to NodeID

func NodeIDFromMD5

func NodeIDFromMD5(v string) NodeID

NodeIDFromMD5 hash any string into a NodeID using MD5

func NodeIDFromV4Generator

func NodeIDFromV4Generator(v string) (nodeId NodeID)

func (*NodeID) Marshal

func (n *NodeID) Marshal(s serialization.Encoder) error

func (NodeID) String

func (n NodeID) String() string

func (*NodeID) Unmarshal

type NodeIdRange

type NodeIdRange struct {
	Begin NodeID
	End   NodeID
}

func (*NodeIdRange) Contains

func (r *NodeIdRange) Contains(id NodeID) bool

func (*NodeIdRange) Marshal

func (r *NodeIdRange) Marshal(s serialization.Encoder) error

func (*NodeIdRange) Unmarshal

type NodeInstance

type NodeInstance struct {
	Id         NodeID
	InstanceId uint64
}

type NodePhase

type NodePhase int64
const (
	NodePhaseBooting NodePhase = iota
	NodePhaseJoining
	NodePhaseInserting
	NodePhaseRouting
	NodePhaseShutdown
)

func (NodePhase) String

func (i NodePhase) String() string

type PToPActor

type PToPActor int64
const (
	PToPActorDirect PToPActor = iota
	PToPActorFederation
	PToPActorRouting
	PToPActorBroadcast
	PToPActorUpperBound
)

type PToPHeader

type PToPHeader struct {
	From          NodeInstance
	To            NodeInstance
	Actor         PToPActor
	FromRing      string
	ToRing        string
	ExactInstance bool
}

type PartnerNodeInfo

type PartnerNodeInfo struct {
	Instance             NodeInstance // The node instance of the node which this information is of.
	Phase                NodePhase    // The phase of the node.
	Address              string       // The address of the node.
	Token                RoutingToken // The token owned by this node.
	LeaseAgentAddress    string       // The address of the lease agent for this node.
	LeaseAgentInstanceId int64        // Instance of the lease agent.
	EndToEnd             bool
	NodeFaultDomainId    common.Uri // The fault domain setting of this node.
	RingName             string
}

type RoutingHeader

type RoutingHeader struct {
	From NodeInstance
	To   NodeInstance
	transport.MessageId
	UseExactRouting bool
	ExpectsReply    bool
	Expiration      common.TimeSpan
	RetryTimeout    common.TimeSpan
	FromRing        string
	ToRing          string
}

type RoutingToken

type RoutingToken struct {
	Range   NodeIdRange
	Version uint64
}

type SeedNodeInfo

type SeedNodeInfo struct {
	Id      NodeID
	Address string
}

type SiteNode

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

func NewSiteNode

func NewSiteNode(config SiteNodeConfig) (*SiteNode, error)

func (*SiteNode) Bootstrap

func (s *SiteNode) Bootstrap(ctx context.Context) error

func (*SiteNode) Close

func (s *SiteNode) Close() error

func (*SiteNode) Discover

func (s *SiteNode) Discover(ctx context.Context) ([]PartnerNodeInfo, error)

func (*SiteNode) Join

func (s *SiteNode) Join(ctx context.Context) error

func (*SiteNode) KnownPartnerNodes

func (s *SiteNode) KnownPartnerNodes(filter func(PartnerNodeInfo) bool) []PartnerNodeInfo

func (*SiteNode) Route

func (*SiteNode) SendOneWay

func (s *SiteNode) SendOneWay(id NodeID, msg *transport.Message) error

func (*SiteNode) Serve

func (s *SiteNode) Serve() error

type SiteNodeConfig

type SiteNodeConfig struct {
	ClientTLS       *tls.Config
	ClientDialer    Dialer
	TransportServer *transport.Server
	LeaseAgent      *lease.Agent
	Instance        NodeInstance
	SeedNodes       []SeedNodeInfo
}

type TicketGap

type TicketGap struct {
	Range    NodeIdRange
	Interval TimeRange
}

type TimeRange

type TimeRange struct {
	Begin common.StopwatchTime
	End   common.StopwatchTime
}

type VoteTicket

type VoteTicket struct {
	VoteId     NodeID
	ExpireTime common.StopwatchTime
	Gaps       []TicketGap
}

Jump to

Keyboard shortcuts

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