net

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2023 License: MIT Imports: 40 Imported by: 0

Documentation

Overview

Package net implements the network layer for go-threads. Nodes exchange messages with each other via gRPC, and the format is defined under /pb.

Index

Constants

This section is empty.

Variables

View Source
var (
	// DialTimeout is the max time duration to wait when dialing a peer.
	DialTimeout = time.Second * 20
	PushTimeout = time.Second * 20
	PullTimeout = time.Second * 20
)
View Source
var (

	// MaxThreadsExchanged is the maximum number of threads for the single edge exchange.
	MaxThreadsExchanged = 2 // 2 is the minimum number of threads for the exchange to work for app

	// ExchangeCompressionTimeout is the maximum duration of collecting threads for the exchange edges request.
	ExchangeCompressionTimeout = PullTimeout / 2

	// QueuePollInterval is the polling interval for the call queue.
	QueuePollInterval = time.Millisecond * 500

	// EventBusCapacity is the buffer size of local event bus listeners.
	EventBusCapacity = 1
)

Functions

func NewNetwork

func NewNetwork(
	ctx context.Context,
	h host.Host,
	bstore bs.Blockstore,
	ds format.DAGService,
	ls lstore.Logstore,
	conf Config,
	serverOptions []grpc.ServerOption,
	dialOptions []grpc.DialOption,
	threadExtern core.ThreadExternal,
) (app.Net, error)

NewNetwork creates an instance of net from the given host and thread store.

func NewRecord

func NewRecord(r core.Record, id thread.ID, lid peer.ID) core.ThreadRecord

NewRecord returns a record with the given values.

Types

type Config

type Config struct {
	NetPullingLimit           uint
	NetPullingStartAfter      time.Duration
	NetPullingInitialInterval time.Duration
	NetPullingInterval        time.Duration
	NoNetPulling              bool
	NoExchangeEdgesMigration  bool
	PubSub                    bool
	Debug                     bool
}

Config is used to specify thread instance options.

func (Config) Validate

func (c Config) Validate() error

type Record

type Record struct {
	core.Record
	// contains filtered or unexported fields
}

Record implements core.Record. The most basic component of a Log.

func (*Record) LogID

func (r *Record) LogID() peer.ID

func (*Record) ThreadID

func (r *Record) ThreadID() thread.ID

func (*Record) Value

func (r *Record) Value() core.Record

Directories

Path Synopsis
api
Package api is all about the Network API.
Package api is all about the Network API.
pb

Jump to

Keyboard shortcuts

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