sessionmanager

package
v0.42.2 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: Apache-2.0, MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PeerManagerFactory

type PeerManagerFactory func(id uint64) bssession.SessionPeerManager

PeerManagerFactory generates a new peer manager for a session.

type Session

type Session interface {
	exchange.Fetcher
	ID() uint64
	ReceiveFrom(peer.ID, []cid.Cid, []cid.Cid, []cid.Cid)
	Close()
}

Session represents a bitswap session managed by the SessionManager.

type SessionFactory

type SessionFactory func(
	ctx context.Context,
	sm bssession.SessionManager,
	id uint64,
	sprm bssession.SessionPeerManager,
	sim *bssim.SessionInterestManager,
	pm bssession.PeerManager,
	bpm *bsbpm.BlockPresenceManager,
	notif notifications.PubSub,
	provSearchDelay time.Duration,
	rebroadcastDelay time.Duration,
	self peer.ID) Session

SessionFactory generates a new session for the SessionManager to track.

type SessionManager

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

SessionManager is responsible for creating, managing, and dispatching to sessions.

func New

func New(sessionFactory SessionFactory, sessionInterestManager *bssim.SessionInterestManager, peerManagerFactory PeerManagerFactory,
	blockPresenceManager *bsbpm.BlockPresenceManager, peerManager bssession.PeerManager, notif notifications.PubSub, self peer.ID,
) *SessionManager

New creates a new SessionManager.

func (*SessionManager) CancelSessionWants

func (sm *SessionManager) CancelSessionWants(sesid uint64, wants []cid.Cid)

CancelSessionWants is called when a session cancels wants because a call to GetBlocks() is canceled.

func (*SessionManager) GetNextSessionID

func (sm *SessionManager) GetNextSessionID() uint64

GetNextSessionID returns the next sequential identifier for a session.

func (*SessionManager) NewSession

func (sm *SessionManager) NewSession(ctx context.Context, provSearchDelay, rebroadcastDelay time.Duration) Session

NewSession initializes a session and adds to the session manager.

The returned Session must be closed via its Close() method, or by canceling the context, when no longer needed.

func (*SessionManager) ReceiveFrom

func (sm *SessionManager) ReceiveFrom(ctx context.Context, p peer.ID, blks []cid.Cid, haves []cid.Cid, dontHaves []cid.Cid)

ReceiveFrom is called when a new message is received.

IMPORTANT: ReceiveFrom filters the given CID slices in place, modifying their contents. If the caller needs to preserve a copy of the lists it should make a copy before calling ReceiveFrom.

func (*SessionManager) RemoveSession

func (sm *SessionManager) RemoveSession(sesid uint64)

func (*SessionManager) Shutdown

func (sm *SessionManager) Shutdown()

Jump to

Keyboard shortcuts

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