session

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Open        = Status(0)
	Completed   = Status(2)
	Uncompleted = Status(1)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager added in v1.1.4

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

func NewManager added in v1.1.4

func NewManager(sessionTimeout time.Duration) *Manager

func (*Manager) HasAnyOpenSession added in v1.1.4

func (sm *Manager) HasAnyOpenSession() bool

func (*Manager) HasOpenSession added in v1.1.4

func (sm *Manager) HasOpenSession(pid peer.ID) bool

func (*Manager) NumberOfSessions added in v1.1.4

func (sm *Manager) NumberOfSessions() int

func (*Manager) OpenSession added in v1.1.4

func (sm *Manager) OpenSession(pid peer.ID, from, count uint32) *Session

func (*Manager) RemoveAllSessions added in v1.1.4

func (sm *Manager) RemoveAllSessions()

func (*Manager) Sessions added in v1.1.4

func (sm *Manager) Sessions() []*Session

func (*Manager) SetExpiredSessionsAsUncompleted added in v1.1.4

func (sm *Manager) SetExpiredSessionsAsUncompleted()

func (*Manager) SetSessionCompleted added in v1.1.4

func (sm *Manager) SetSessionCompleted(sid int) *Session

func (*Manager) SetSessionUncompleted added in v1.1.4

func (sm *Manager) SetSessionUncompleted(sid int)

func (*Manager) Stats added in v1.1.4

func (sm *Manager) Stats() Stats

func (*Manager) UpdateSessionLastActivity added in v1.1.4

func (sm *Manager) UpdateSessionLastActivity(sid int)

type Session

type Session struct {
	SessionID    int
	Status       Status
	PeerID       peer.ID
	From         uint32
	Count        uint32
	LastActivity time.Time
}

func NewSession

func NewSession(id int, peerID peer.ID, from, count uint32) *Session

type Stats added in v1.1.4

type Stats struct {
	Total       int
	Open        int
	Completed   int
	Uncompleted int
}

func (*Stats) String added in v1.1.4

func (ss *Stats) String() string

type Status

type Status int

Jump to

Keyboard shortcuts

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