sessionmanager

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: Apache-2.0, MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PeerManagerFactory

type PeerManagerFactory func(ctx context.Context, 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)
	Shutdown()
}

Session is a session that is managed by the session manager

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 delay.D,
	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(ctx context.Context, 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 cancelled

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 time.Duration,
	rebroadcastDelay delay.D) exchange.Fetcher

NewSession initializes a session with the given context, and adds to the session manager.

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

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