connmgr

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2022 License: MIT Imports: 3 Imported by: 132

README

DEPRECATION NOTICE

This package has moved into go-libp2p as a sub-package, github.com/libp2p/go-libp2p/p2p/net/connmgr.

go-libp2p-connmgr

==================

Travis CI Discourse posts

A package to help manage connections in go-libp2p.

Table of Contents

Install

go get github.com/libp2p/go-libp2p-connmgr

Contribute

PRs are welcome!

Small note: If editing the Readme, please conform to the standard-readme specification.

License

MIT © Whyrusleeping


The last gx published version of this module was: 0.3.34: QmSTKY2v62v9RjcfTMCFKMVAWvVjWGixkYWEi68iG7e1TT

Documentation

Overview

Deprecated: This package has moved into go-libp2p as a sub-package: github.com/libp2p/go-libp2p/p2p/net/connmgr.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDecayer added in v0.2.2

func NewDecayer(cfg *DecayerCfg, mgr *BasicConnMgr) (connmgr.Decayer, error)

NewDecayer creates a new decaying tag registry. Deprecated: use go-libp2p/p2p/net/connmgr.NewDecayer instead.

Types

type BasicConnMgr

type BasicConnMgr = lconnmgr.BasicConnMgr

BasicConnMgr is a ConnManager that trims connections whenever the count exceeds the high watermark. New connections are given a grace period before they're subject to trimming. Trims are automatically run on demand, only if the time from the previous trim is higher than 10 seconds. Furthermore, trims can be explicitly requested through the public interface of this struct (see TrimOpenConns).

See configuration parameters in NewConnManager. Deprecated: use go-libp2p/p2p/net/connmgr.BasicConnMgr instead.

func NewConnManager

func NewConnManager(low, hi int, opts ...lconnmgr.Option) (*BasicConnMgr, error)

NewConnManager creates a new BasicConnMgr with the provided params: lo and hi are watermarks governing the number of connections that'll be maintained. When the peer count exceeds the 'high watermark', as many peers will be pruned (and their connections terminated) until 'low watermark' peers remain. Deprecated: use go-libp2p/p2p/net/connmgr.NewConnManager instead.

type DecayerCfg added in v0.2.2

type DecayerCfg = lconnmgr.DecayerCfg

DecayerCfg is the configuration object for the Decayer. Deprecated: use go-libp2p/p2p/net/connmgr.DecayerCfg instead.

type Option added in v0.2.2

type Option = lconnmgr.Option

Option represents an option for the basic connection manager. Deprecated: use go-libp2p/p2p/net/connmgr.Option instead.

func DecayerConfig added in v0.2.2

func DecayerConfig(opts *DecayerCfg) Option

DecayerConfig applies a configuration for the decayer. Deprecated: use go-libp2p/p2p/net/connmgr.DecayerConfig instead.

func WithEmergencyTrim added in v0.3.1

func WithEmergencyTrim(enable bool) Option

WithEmergencyTrim is an option to enable trimming connections on memory emergency. Deprecated: use go-libp2p/p2p/net/connmgr.WithEmergencyTrim instead.

func WithGracePeriod added in v0.3.0

func WithGracePeriod(p time.Duration) Option

WithGracePeriod sets the grace period. The grace period is the time a newly opened connection is given before it becomes subject to pruning. Deprecated: use go-libp2p/p2p/net/connmgr.WithGracePeriod instead.

func WithSilencePeriod added in v0.3.0

func WithSilencePeriod(p time.Duration) Option

WithSilencePeriod sets the silence period. The connection manager will perform a cleanup once per silence period if the number of connections surpasses the high watermark. Deprecated: use go-libp2p/p2p/net/connmgr.WithSilencePeriod instead.

Jump to

Keyboard shortcuts

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