remote

package
v0.0.0-...-543ca17 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 15 Imported by: 0

README

Remote Endpoint

Remote Endpoint connects another Remote Endpoint via a network.Conn interface.

Intents

Local Intent is registered only if LocalPeer path matches the prefix of the Route.

Remote Intent is only registered if RemotePeer path matches the prefix of the Route.

Interests

Local Interest is registered only if RemotePeer path matches the prefix of the Route.

Remote Interest is registered only if LocalPeer path matches the prefix of the Route.

Messages

TBD

Ping-Pong

A Ping-Pong is exchanged with a configured period. Each peer is sending Ping and Pong back.

TODO: Perhaps only exchange OWL messages and estimate TTL from that saving some traffic(Might have issues with patents).

Basic protocol idea draft

Publish: broadcasts intent to publish data Subscribe: broadcasts interest in data

At the beginning router tries to connect to peers

When a peer is connected:

  • share peers
  • share interests
  • share intents

When a peer is disconnected:

  • remove interests and intents

When router encounters Intent message:

  • register intent

When router encounters Interest message:

  • register interest

What to do if intent/interest exists locally and we receive one remotely?

  • TBD

We have Interest and Intent match:

  • register a link only if intent and interest source IDs do not match (allow only remote communication)
  • if intent is local and interest remote -> send data to remote
  • if intent is remote and interest is local -> receive data from remote
  • if both are remote - ignore (relay not supported)

Documentation

Index

Constants

View Source
const DefaultTimeToLive = time.Hour * 24 * 30 * 365

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	dndm.BaseEndpoint
	// contains filtered or unexported fields
}

func New

func New(self dndm.Peer, conn network.Conn, size int, timeout, pingDuration time.Duration) *Endpoint

New creates a endpoint that communicates with a remote via Remote interface.

func (*Endpoint) Close

func (t *Endpoint) Close() error

func (*Endpoint) Init

func (t *Endpoint) Init(ctx context.Context, logger *slog.Logger, addIntent dndm.IntentCallback, addInterest dndm.InterestCallback) error

func (*Endpoint) Latency

func (t *Endpoint) Latency() *LatencyTracker

func (*Endpoint) Local

func (t *Endpoint) Local() dndm.Peer

func (*Endpoint) OnClose

func (t *Endpoint) OnClose(f func()) dndm.Endpoint

func (*Endpoint) Publish

func (t *Endpoint) Publish(route dndm.Route, opt ...dndm.PubOpt) (dndm.Intent, error)

func (*Endpoint) Remote

func (t *Endpoint) Remote() dndm.Peer

func (*Endpoint) Subscribe

func (t *Endpoint) Subscribe(route dndm.Route, opt ...dndm.SubOpt) (dndm.Interest, error)

type LatencyTracker

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

func NewLatencyTracker

func NewLatencyTracker(size int) *LatencyTracker

func (*LatencyTracker) MakePing

func (l *LatencyTracker) MakePing(size int) *types.Ping

func (*LatencyTracker) MakePong

func (l *LatencyTracker) MakePong(hdr *types.Header, ping *types.Ping) *types.Pong

func (*LatencyTracker) ObservePong

func (l *LatencyTracker) ObservePong(hdr *types.Header, msg *types.Pong)

type LocalIntent

type LocalIntent struct {
	*dndm.LocalIntent
	// contains filtered or unexported fields
}

func (*LocalIntent) Close

func (i *LocalIntent) Close() error
func (i *LocalIntent) Link(c chan<- proto.Message)

func (*LocalIntent) Send

func (i *LocalIntent) Send(ctx context.Context, msg proto.Message) error

type LocalInterest

type LocalInterest struct {
	*dndm.LocalInterest
	// contains filtered or unexported fields
}

func (*LocalInterest) Close

func (i *LocalInterest) Close() error

type Ping

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

type Pong

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

type RemoteIntent

type RemoteIntent struct {
	*dndm.LocalIntent
	// contains filtered or unexported fields
}

func (*RemoteIntent) Close

func (i *RemoteIntent) Close() error
func (i *RemoteIntent) Link(c chan<- proto.Message)

func (*RemoteIntent) Send

func (i *RemoteIntent) Send(ctx context.Context, msg proto.Message) error

type RemoteInterest

type RemoteInterest struct {
	*dndm.LocalInterest
	// contains filtered or unexported fields
}

func (*RemoteInterest) Close

func (i *RemoteInterest) Close() error

type Watchdog

type Watchdog struct {
	*time.Timer
	// contains filtered or unexported fields
}

func (*Watchdog) Reset

func (wd *Watchdog) Reset()

Jump to

Keyboard shortcuts

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