Documentation ¶
Overview ¶
Package rcmgr is the resource manager for go-libp2p. This allows you to track resources being used throughout your go-libp2p process. As well as making sure that the process doesn't use more resources than what you define as your limits. The resource manager only knows about things it is told about, so it's the responsibility of the user of this library (either go-libp2p or a go-libp2p user) to make sure they check with the resource manager before actually allocating the resource.
Deprecated: This package has moved into go-libp2p as a sub-package: github.com/libp2p/go-libp2p/p2p/host/resource-manager.
Index ¶
- Constants
- Variables
- func IsConnScope(name string) booldeprecated
- func IsSpan(name string) bool
- func IsSystemScope(name string) booldeprecated
- func IsTransientScope(name string) booldeprecated
- func NewResourceManager(limits Limiter, opts ...Option) (network.ResourceManager, error)deprecated
- func ParsePeerScopeName(name string) peer.ID
- func ParseProtocolScopeName(name string) string
- func ParseServiceScopeName(name string) string
- type Allowlistdeprecated
- type BaseLimit
- type BaseLimitIncrease
- type Limit
- type LimitConfigdeprecated
- type Limiter
- type MetricsReporter
- type Optiondeprecated
- type ResourceManagerStatdeprecated
- type ResourceManagerState
- type ResourceScopeLimiter
- type ScalingLimitConfig
- type TraceEvtdeprecated
- type TraceEvtTypdeprecated
- type TraceReporterdeprecated
Constants ¶
const ( TraceStartEvt = rcmgr.TraceStartEvt TraceCreateScopeEvt = rcmgr.TraceCreateScopeEvt TraceDestroyScopeEvt = rcmgr.TraceDestroyScopeEvt TraceReserveMemoryEvt = rcmgr.TraceReserveMemoryEvt TraceBlockReserveMemoryEvt = rcmgr.TraceBlockReserveMemoryEvt TraceReleaseMemoryEvt = rcmgr.TraceReleaseMemoryEvt TraceAddStreamEvt = rcmgr.TraceAddStreamEvt TraceBlockAddStreamEvt = rcmgr.TraceBlockAddStreamEvt TraceRemoveStreamEvt = rcmgr.TraceRemoveStreamEvt TraceAddConnEvt = rcmgr.TraceAddConnEvt TraceBlockAddConnEvt = rcmgr.TraceBlockAddConnEvt TraceRemoveConnEvt = rcmgr.TraceRemoveConnEvt )
Variables ¶
var DefaultLimits = rcmgr.DefaultLimits
DefaultLimits are the limits used by the default limiter constructors. Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.DefaultLimits instead
var InfiniteLimits = rcmgr.InfiniteLimits
InfiniteLimits are a limiter configuration that uses infinite limits, thus effectively not limiting anything. Keep in mind that the operating system limits the number of file descriptors that an application can use. Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.InfiniteLimits instead
Functions ¶
func IsConnScope
deprecated
added in
v0.4.0
func IsSpan ¶ added in v0.4.0
IsSpan will return true if this name was created by newResourceScopeSpan Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.IsSpan instead
func IsSystemScope
deprecated
added in
v0.4.0
func IsTransientScope
deprecated
added in
v0.4.0
func NewResourceManager
deprecated
func NewResourceManager(limits Limiter, opts ...Option) (network.ResourceManager, error)
Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.NewResourceManager instead
func ParsePeerScopeName ¶ added in v0.4.0
ParsePeerScopeName returns "" if name is not a peerScopeName Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.ParsePeerScopeName instead
func ParseProtocolScopeName ¶ added in v0.4.0
ParseProtocolScopeName returns the service name if name is a serviceScopeName. Otherwise returns "" Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.ParseProtocolScopeName instead
func ParseServiceScopeName ¶ added in v0.4.0
ParseServiceScopeName returns the service name if name is a serviceScopeName. Otherwise returns "" Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.ParseServiceScopeName instead
Types ¶
type Allowlist
deprecated
added in
v0.4.0
Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.Allowlist instead
func GetAllowlist ¶ added in v0.5.0
func GetAllowlist(mgr network.ResourceManager) *Allowlist
GetAllowlist tries to get the allowlist from the given resourcemanager interface by checking to see if its concrete type is a resourceManager. Returns nil if it fails to get the allowlist. Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.GetAllowlist instead
type BaseLimit ¶
BaseLimit is a mixin type for basic resource limits. Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.BaseLimit instead
type BaseLimitIncrease ¶ added in v0.5.0
type BaseLimitIncrease = rcmgr.BaseLimitIncrease
BaseLimitIncrease is the increase per GB of system memory. Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.BaseLimitIncrease instead
type Limit ¶
Limit is an object that specifies basic resource limits. Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.Limit instead
type LimitConfig
deprecated
added in
v0.5.0
type LimitConfig = rcmgr.LimitConfig
Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.LimitConfig instead
type Limiter ¶
Limiter is the interface for providing limits to the resource manager. Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.Limiter instead
func NewDefaultLimiterFromJSON ¶
NewDefaultLimiterFromJSON creates a new limiter by parsing a json configuration, using the default limits for fallback. Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.NewDefaultLimiterFromJSON instead
func NewFixedLimiter
deprecated
added in
v0.5.0
func NewFixedLimiter(conf LimitConfig) Limiter
Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.NewFixedLimiter instead
func NewLimiterFromJSON ¶
func NewLimiterFromJSON(in io.Reader, defaults LimitConfig) (Limiter, error)
NewLimiterFromJSON creates a new limiter by parsing a json configuration. Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.NewLimiterFromJSON instead
type MetricsReporter ¶ added in v0.1.4
type MetricsReporter = rcmgr.MetricsReporter
MetricsReporter is an interface for collecting metrics from resource manager actions Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.MetricsReporter instead
type Option
deprecated
Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.Option instead
func WithAllowlistedMultiaddrs ¶ added in v0.4.0
func WithAllowlistedMultiaddrs(mas []multiaddr.Multiaddr) Option
WithAllowlistedMultiaddrs sets the multiaddrs to be in the allowlist Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.WithAllowlistedMultiaddrs instead
func WithMetrics ¶ added in v0.1.4
func WithMetrics(reporter MetricsReporter) Option
WithMetrics is a resource manager option to enable metrics collection Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.WithMetrics instead
func WithTraceReporter
deprecated
added in
v0.4.0
func WithTraceReporter(reporter TraceReporter) Option
Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.WithTraceReporter instead
type ResourceManagerStat
deprecated
type ResourceManagerStat = rcmgr.ResourceManagerStat
Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.ResourceManagerStat instead
type ResourceManagerState ¶
type ResourceManagerState = rcmgr.ResourceManagerState
ResourceManagerState is a trait that allows you to access resource manager state. Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.ResourceManagerState instead
type ResourceScopeLimiter ¶
type ResourceScopeLimiter = rcmgr.ResourceScopeLimiter
ResourceScopeLimiter is a trait interface that allows you to access scope limits. Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.ResourceScopeLimiter instead
type ScalingLimitConfig ¶ added in v0.5.0
type ScalingLimitConfig = rcmgr.ScalingLimitConfig
ScalingLimitConfig is a struct for configuring default limits. {}BaseLimit is the limits that Apply for a minimal node (128 MB of memory for libp2p) and 256 file descriptors. {}LimitIncrease is the additional limit granted for every additional 1 GB of RAM. Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.ScalingLimitConfig instead
type TraceEvtTyp
deprecated
added in
v0.4.0
type TraceEvtTyp = rcmgr.TraceEvtTyp
Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.TraceEvtTyp instead
type TraceReporter
deprecated
added in
v0.4.0
type TraceReporter = rcmgr.TraceReporter
Deprecated: use github.com/libp2p/go-libp2p/p2p/host/resource-manager.TraceReporter instead