routing

package
v0.0.14-alpha Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Copyright (c) Microsoft Corporation. Licensed under the MIT License.

Initial Copyright (c) 2023 Xenit AB and 2024 The Spegel Authors. Portions Copyright (c) Microsoft Corporation. Licensed under the MIT License.

Index

Constants

View Source
const (
	MaxRecordAge = 30 * time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentNotFoundError

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

ContentNotFoundError indicates that the content for the given key was not found in the network.

type PeerInfo

type PeerInfo struct {
	peer.ID

	// HttpHost is the HTTP host of the peer.
	HttpHost string
}

PeerInfo describes a peer.

type Router

type Router interface {
	// Net returns the network interface.
	Net() peernet.Network

	// Resolve resolves the given key to a peer address.
	Resolve(ctx context.Context, key string, allowSelf bool, count int) (<-chan PeerInfo, error)

	// ResolveWithNegativeCacheCallback is like Resolve but it also returns a function callback that can be used to cache that a key could not be resolved.
	ResolveWithNegativeCacheCallback(ctx context.Context, key string, allowSelf bool, count int) (<-chan PeerInfo, func(), error)

	// Provide provides the given keys to the network.
	// This lets the k-closest peers to the key know that we are providing it.
	Provide(ctx context.Context, keys []string) error

	// Close closes the router.
	Close() error
}

Router provides a content routing interface to the network.

func NewRouter

func NewRouter(ctx context.Context, clientset *k8s.ClientSet, hostAddr, peerRegistryPort string) (Router, error)

NewRouter creates a new Router.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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