gateway

package
v0.0.0-...-05bc493 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EphemeralPulse = beat.Beat{Data: pulse.Data{
	PulseNumber: pulse.MinTimePulse,
	DataExt: pulse.DataExt{
		PulseEpoch: pulse.EphemeralPulseEpoch,
		Timestamp:  pulse.UnixTimeOfMinTimePulse,
	}}}

Functions

func CalcAnnounceSignature

func CalcAnnounceSignature(nodeID node.ShortNodeID, role member.PrimaryRole, addr endpoints.IPAddress, startPower member.Power, isDiscovery bool,
	pk []byte, keystore cryptography.KeyStore, scheme cryptography.PlatformCryptographyScheme,
) ([]byte, *cryptography.Signature, error)

func EnsureGetPulse

func EnsureGetPulse(ctx context.Context, report network.Report) pulse.Data

EnsureGetPulse checks if NodeKeeper got list for pulseNumber

func NewGatewayer

func NewGatewayer(g network.Gateway) network.Gatewayer

func SelectWorking

func SelectWorking(nodes []nodeinfo.NetworkNode) []nodeinfo.NetworkNode

deprecated // improve

Types

type Base

type Base struct {
	component.Initer

	Self                network.Gateway
	Gatewayer           network.Gatewayer                       `inject:""`
	NodeKeeper          beat.NodeKeeper                         `inject:""`
	CryptographyService cryptography.Service                    `inject:""`
	CryptographyScheme  cryptography.PlatformCryptographyScheme `inject:""`
	CertificateManager  nodeinfo.CertificateManager             `inject:""`
	HostNetwork         network.HostNetwork                     `inject:""`
	PulseAppender       beat.Appender                           `inject:""`
	PulseManager        chorus.Conductor                        `inject:""`
	BootstrapRequester  bootstrap.Requester                     `inject:""`
	KeyProcessor        cryptography.KeyProcessor               `inject:""`
	Aborter             network.Aborter                         `inject:""`
	TransportFactory    transport.Factory                       `inject:""`

	ConsensusMode consensus.Mode

	ConsensusController consensus.Controller

	Options *network.Options
	// contains filtered or unexported fields
}

Base is abstract class for gateways

func (*Base) Auther

func (g *Base) Auther() network.Auther

Auther casts us to Auther or obtain it in another way

func (*Base) Bootstrapper

func (g *Base) Bootstrapper() network.Bootstrapper

Bootstrapper casts us to Bootstrapper or obtain it in another way

func (*Base) CancelNodeState

func (g *Base) CancelNodeState()

func (*Base) EphemeralMode

func (g *Base) EphemeralMode(nodes census.OnlinePopulation) bool

func (*Base) FailState

func (g *Base) FailState(ctx context.Context, reason string)

func (*Base) GetCert

func (g *Base) GetCert(ctx context.Context, ref reference.Global) (nodeinfo.Certificate, error)

GetCert method returns node certificate by requesting sign from discovery nodes

func (*Base) GetLocalNodeStaticProfile

func (g *Base) GetLocalNodeStaticProfile() profiles.StaticProfile

func (*Base) HandleNodeAuthorizeRequest

func (g *Base) HandleNodeAuthorizeRequest(ctx context.Context, request network.ReceivedPacket) (network.Packet, error)

func (*Base) HandleNodeBootstrapRequest

func (g *Base) HandleNodeBootstrapRequest(ctx context.Context, request network.ReceivedPacket) (network.Packet, error)

func (*Base) HandleReconnect

func (g *Base) HandleReconnect(ctx context.Context, request network.ReceivedPacket) (network.Packet, error)

func (*Base) HandleUpdateSchedule

func (g *Base) HandleUpdateSchedule(ctx context.Context, request network.ReceivedPacket) (network.Packet, error)

func (*Base) Init

func (g *Base) Init(ctx context.Context) error

func (*Base) NewGateway

func (g *Base) NewGateway(ctx context.Context, state network.State) network.Gateway

NewGateway creates new gateway on top of existing

func (*Base) OnConsensusFinished

func (g *Base) OnConsensusFinished(ctx context.Context, report network.Report)

func (*Base) OnPulseFromConsensus

func (g *Base) OnPulseFromConsensus(ctx context.Context, pu beat.Beat)

func (*Base) RequestNodeState

func (g *Base) RequestNodeState(fn chorus.NodeStateFunc)

func (*Base) StartConsensus

func (g *Base) StartConsensus(ctx context.Context) error

func (*Base) Stop

func (g *Base) Stop(ctx context.Context) error

func (*Base) UpdateState

func (g *Base) UpdateState(ctx context.Context, pu beat.Beat)

UpdateState called then Consensus is done

func (*Base) ValidateCert

func (g *Base) ValidateCert(ctx context.Context, authCert nodeinfo.AuthorizationCertificate) (bool, error)

ValidateCert validates node certificate

type Complete

type Complete struct {
	*Base
}

func (*Complete) CancelNodeState

func (g *Complete) CancelNodeState()

func (*Complete) EphemeralMode

func (g *Complete) EphemeralMode(census.OnlinePopulation) bool

func (*Complete) GetCert

func (g *Complete) GetCert(ctx context.Context, registeredNodeRef reference.Global) (nodeinfo.Certificate, error)

GetCert method generates cert by requesting signs from discovery nodes

func (*Complete) GetState

func (g *Complete) GetState() network.State

func (*Complete) OnPulseFromConsensus

func (g *Complete) OnPulseFromConsensus(ctx context.Context, pulse network.NetworkedPulse)

func (*Complete) RequestNodeState

func (g *Complete) RequestNodeState(fn chorus.NodeStateFunc)

func (*Complete) Run

func (g *Complete) Run(context.Context, pulse.Data)

func (*Complete) UpdateState

func (g *Complete) UpdateState(ctx context.Context, beat beat.Beat)

type DiscoveryBootstrap

type DiscoveryBootstrap struct {
	*Base
}

DiscoveryBootstrap void network state

func (*DiscoveryBootstrap) GetState

func (g *DiscoveryBootstrap) GetState() network.State

func (*DiscoveryBootstrap) Run

func (g *DiscoveryBootstrap) Run(ctx context.Context, p pulse.Data)

type JoinerBootstrap

type JoinerBootstrap struct {
	*Base
}

JoinerBootstrap void network state

func (*JoinerBootstrap) GetState

func (g *JoinerBootstrap) GetState() network.State

func (*JoinerBootstrap) Run

func (g *JoinerBootstrap) Run(ctx context.Context, p pulse.Data)

type NoNetwork

type NoNetwork struct {
	*Base
}

NoNetwork initial state

func (*NoNetwork) GetState

func (g *NoNetwork) GetState() network.State

func (*NoNetwork) Run

func (g *NoNetwork) Run(ctx context.Context, pulse pulse.Data)

type WaitConsensus

type WaitConsensus struct {
	*Base
	// contains filtered or unexported fields
}

func (*WaitConsensus) GetState

func (g *WaitConsensus) GetState() network.State

func (*WaitConsensus) OnConsensusFinished

func (g *WaitConsensus) OnConsensusFinished(ctx context.Context, report network.Report)

func (*WaitConsensus) Run

func (g *WaitConsensus) Run(ctx context.Context, _ pulse.Data)

type WaitMajority

type WaitMajority struct {
	*Base
	// contains filtered or unexported fields
}

func (*WaitMajority) GetState

func (g *WaitMajority) GetState() network.State

func (*WaitMajority) OnConsensusFinished

func (g *WaitMajority) OnConsensusFinished(ctx context.Context, report network.Report)

func (*WaitMajority) Run

func (g *WaitMajority) Run(ctx context.Context, pulse pulse.Data)

type WaitMinRoles

type WaitMinRoles struct {
	*Base
	// contains filtered or unexported fields
}

func (*WaitMinRoles) GetState

func (g *WaitMinRoles) GetState() network.State

func (*WaitMinRoles) OnConsensusFinished

func (g *WaitMinRoles) OnConsensusFinished(ctx context.Context, report network.Report)

func (*WaitMinRoles) Run

func (g *WaitMinRoles) Run(ctx context.Context, pulse pulse.Data)

func (*WaitMinRoles) UpdateState

func (g *WaitMinRoles) UpdateState(ctx context.Context, beat beat.Beat)

type WaitPulsar

type WaitPulsar struct {
	*Base
	// contains filtered or unexported fields
}

func (*WaitPulsar) GetState

func (g *WaitPulsar) GetState() network.State

func (*WaitPulsar) OnConsensusFinished

func (g *WaitPulsar) OnConsensusFinished(ctx context.Context, report network.Report)

func (*WaitPulsar) OnPulseFromConsensus

func (g *WaitPulsar) OnPulseFromConsensus(ctx context.Context, pulse network.NetworkedPulse)

func (*WaitPulsar) Run

func (g *WaitPulsar) Run(ctx context.Context, pulse pulse.Data)

func (*WaitPulsar) UpdateState

func (g *WaitPulsar) UpdateState(ctx context.Context, beat beat.Beat)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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