hosthandler

package
v0.5.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommonFacade

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

CommonFacade implements a NetworkCommonFacade.

func NewNetworkCommonFacade

func NewNetworkCommonFacade(r rpc.RPC, casc *cascade.Cascade) *CommonFacade

NewNetworkCommonFacade creates a NetworkCommonFacade.

func (*CommonFacade) GetCascade

func (fac *CommonFacade) GetCascade() *cascade.Cascade

GetCascade returns a cascade pointer.

func (*CommonFacade) GetPulseManager

func (fac *CommonFacade) GetPulseManager() core.PulseManager

GetPulseManager returns a pulse manager pointer.

func (*CommonFacade) GetRPC

func (fac *CommonFacade) GetRPC() rpc.RPC

GetRPC return an RPC pointer.

func (*CommonFacade) SetPulseManager

func (fac *CommonFacade) SetPulseManager(manager core.PulseManager)

SetPulseManager sets a pulse manager to common facade.

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
	GetActiveNodes() error
	Bootstrap() error
	GetHostsFromBootstrap()
	NumHosts(ctx Context) int
	AnalyzeNetwork(ctx Context) error
	ConfirmNodeRole(role string) bool
	StoreRetrieve(key store.Key) ([]byte, bool)
	HtFromCtx(ctx Context) *routing.HashTable
	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)
	AddActiveNodes(activeNode []*core.ActiveNode)
	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)

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

	SetHighKnownHostID(id string)
	SetOuterHostsCount(hosts int)
	SetAuthStatus(targetID string, status bool)

	GetProxyHostsCount() int
	GetOuterHostsCount() int
	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
	GetNodeID() core.RecordRef
	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)
}

NetworkCommonFacade is used for implementation of rpc and cascade.

Jump to

Keyboard shortcuts

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