hosthandler

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context context.Context

Context type is localized for future purposes. Network Host can have multiple IDs, but each action must be executed with only one ID. Context is used in all actions to select specific ID to work with.

type HostHandler

type HostHandler interface {
	Disconnect()
	Listen() error
	ObtainIP() error
	Bootstrap() error
	NumHosts(ctx Context) int
	AnalyzeNetwork(ctx Context) error
	ConfirmNodeRole(role string) bool
	HtFromCtx(ctx Context) *routing.HashTable
	StoreRetrieve(key store.Key) ([]byte, bool)
	EqualAuthSentKey(targetID string, key []byte) bool
	SendRequest(packet *packet.Packet) (transport.Future, error)
	FindHost(ctx Context, targetID string) (*host.Host, bool, error)
	RemoteProcedureRegister(name string, method core.RemoteProcedure)
	InvokeRPC(sender *host.Host, method string, args [][]byte) ([]byte, error)
	CascadeSendMessage(data core.Cascade, targetID string, method string, args [][]byte) error
	Store(key store.Key, data []byte, replication time.Time, expiration time.Time, publisher bool) error
	RemoteProcedureCall(ctx Context, targetID string, method string, args [][]byte) (result []byte, err error)

	AddPossibleProxyID(id string)
	AddPossibleRelayID(id string)
	AddProxyHost(targetID string)
	AddSubnetID(ip, targetID string)
	AddAuthSentKey(id string, key []byte)
	AddRelayClient(host *host.Host) error
	AddReceivedKey(target string, key []byte)
	AddHost(ctx Context, host *routing.RouteHost)
	AddActiveNodes(activeNode []*core.ActiveNode) error

	RemoveAuthHost(key string)
	RemoveProxyHost(targetID string)
	RemovePossibleProxyID(id string)
	RemoveAuthSentKeys(targetID string)
	RemoveRelayClient(host *host.Host) error

	SetHighKnownHostID(id string)
	SetOuterHostsCount(hosts int)
	SetNodeID(nodeID core.RecordRef)
	SetAuthStatus(targetID string, status bool)

	GetHostsFromBootstrap()
	GetProxyHostsCount() int
	GetOuterHostsCount() int
	GetNodeID() core.RecordRef
	GetHighKnownHostID() string
	GetSelfKnownOuterHosts() int
	GetOriginHost() *host.Origin
	GetPacketTimeout() time.Duration
	GetReplicationTime() time.Duration
	HostIsAuthenticated(targetID string) bool
	KeyIsReceived(targetID string) ([]byte, bool)
	GetNetworkCommonFacade() NetworkCommonFacade
	GetExpirationTime(ctx Context, key []byte) time.Time
	GetActiveNodesList() []*core.ActiveNode
}

HostHandler is an interface which uses for host network implementation.

type NetworkCommonFacade

type NetworkCommonFacade interface {
	GetRPC() rpc.RPC
	GetCascade() *cascade.Cascade
	GetPulseManager() core.PulseManager
	SetPulseManager(manager core.PulseManager)
	SetConsensus(insolarConsensus consensus.Processor)
	GetConsensus() consensus.Processor
	SetNetworkCoordinator(coordinator core.NetworkCoordinator)
	GetNetworkCoordinator() core.NetworkCoordinator
	GetSignHandler() signhandler.SignHandler
}

NetworkCommonFacade is used to implement additional features in network to evade showing them in the main HostHandler interface

func NewNetworkCommonFacade

func NewNetworkCommonFacade(r rpc.RPC, casc *cascade.Cascade, signH signhandler.SignHandler) NetworkCommonFacade

NewNetworkCommonFacade creates a NetworkCommonFacade.

Jump to

Keyboard shortcuts

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