ProtocolScopeImpl class

ProtocolScopeImpl is the concrete implementation for protocol-specific scopes.

Inheritance
Implemented types

Constructors

ProtocolScopeImpl(Limit limit, ProtocolID protocol, {List<ResourceScopeImpl>? edges})

Properties

edges ↔ List<ResourceScopeImpl>
getter/setter pairinherited
hashCode → int
The hash code for this object.
no setterinherited
name → String
finalinherited
peerSubScopeCount → int
The number of per-peer sub-scopes.
no setter
protocol → String
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stat → ScopeStat
Stat retrieves current resource usage for the scope.
no setterinherited

Methods

addConn(Direction dir, bool usefd) → void
inherited
addStream(Direction dir) → void
inherited
beginSpan() → Future<ResourceScopeSpan>
BeginSpan creates a new span scope rooted at this scope.
inherited
decRef() → void
inherited
done() → void
Done ends the span and releases associated resources.
inherited
gcPeerSubScopes() → void
Drops the per-peer sub-scopes that nothing uses. Called by the resource manager's garbage collector; without it this map would keep an entry for every peer that ever used this protocol.
getPeerSubScope(PeerId peerId, Limiter limiter, ResourceScopeImpl systemScope) → ResourceScopeImpl
incRef() → void
inherited
isUnused({int ownRefs = 0}) → bool
Whether nothing uses this scope: it holds no resource and no scope or span refers to it. ownRefs references are not counted; the resource manager holds one on each peer scope it keeps.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
releaseMemory(int size) → void
ReleaseMemory explicitly releases memory previously reserved with ReserveMemory.
inherited
removeConn(Direction dir, bool usefd) → void
inherited
removeStream(Direction dir) → void
inherited
reparent(List<ResourceScopeImpl> newEdges) → void
Moves this scope under newEdges. Its current resources are counted in the ancestors it gains and released from the ones it loses; an ancestor it keeps (the system scope, usually) keeps counting them once. This is how go-libp2p's SetPeer and SetProtocol juggle resources. Throws, and changes nothing, if a gained ancestor's limit would be exceeded.
inherited
reserveMemory(int size, int priority) → Future<void>
ReserveMemory reserves memory/buffer space in the scope; the unit is bytes.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited