session

package
v0.2.24 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrQueueNotOpened = errors.New("queue has not been opened")

Functions

This section is empty.

Types

type Manager

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

func NewManager

func NewManager(detection func(ctx context.Context, sessionID string) error, genSessionID func(ctx context.Context) string) *Manager

func (*Manager) CloseAllSessions

func (m *Manager) CloseAllSessions()

func (*Manager) CloseSession

func (m *Manager) CloseSession(sessionID string)

func (*Manager) CreateSession

func (m *Manager) CreateSession(ctx context.Context) string

func (*Manager) DequeueMessageForSend added in v0.2.0

func (m *Manager) DequeueMessageForSend(ctx context.Context, sessionID string) ([]byte, error)

func (*Manager) EnqueueMessageForSend added in v0.2.0

func (m *Manager) EnqueueMessageForSend(ctx context.Context, sessionID string, message []byte) error

func (*Manager) GetSession

func (m *Manager) GetSession(sessionID string) (*State, bool)

func (*Manager) IsActiveSession added in v0.2.0

func (m *Manager) IsActiveSession(sessionID string) bool

func (*Manager) IsClosedSession added in v0.2.0

func (m *Manager) IsClosedSession(sessionID string) bool

func (*Manager) IsEmpty

func (m *Manager) IsEmpty() bool

func (*Manager) OpenMessageQueueForSend added in v0.2.0

func (m *Manager) OpenMessageQueueForSend(sessionID string) error

func (*Manager) RangeSessions

func (m *Manager) RangeSessions(f func(sessionID string, state *State) bool)

func (*Manager) SetLogger added in v0.2.0

func (m *Manager) SetLogger(logger pkg.Logger)

func (*Manager) SetMaxIdleTime

func (m *Manager) SetMaxIdleTime(d time.Duration)

func (*Manager) StartHeartbeatAndCleanInvalidSessions

func (m *Manager) StartHeartbeatAndCleanInvalidSessions()

func (*Manager) StopHeartbeat

func (m *Manager) StopHeartbeat()

func (*Manager) UpdateSessionLastActiveAt

func (m *Manager) UpdateSessionLastActiveAt(sessionID string)

type State

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

func NewState

func NewState() *State

func (*State) Close

func (s *State) Close()

func (*State) GetClientCapabilities added in v0.2.3

func (s *State) GetClientCapabilities() *protocol.ClientCapabilities

func (*State) GetClientReqID2cancelFunc added in v0.2.7

func (s *State) GetClientReqID2cancelFunc() cmap.ConcurrentMap[string, context.CancelFunc]

func (*State) GetReady

func (s *State) GetReady() bool

func (*State) GetReceivedInitRequest

func (s *State) GetReceivedInitRequest() bool

func (*State) GetServerReqID2respChan added in v0.2.7

func (s *State) GetServerReqID2respChan() cmap.ConcurrentMap[string, chan *protocol.JSONRPCResponse]

func (*State) GetSubscribedResources

func (s *State) GetSubscribedResources() cmap.ConcurrentMap[string, struct{}]

func (*State) IncRequestID

func (s *State) IncRequestID() int64

func (*State) SetClientInfo

func (s *State) SetClientInfo(ClientInfo *protocol.Implementation, ClientCapabilities *protocol.ClientCapabilities)

func (*State) SetReady

func (s *State) SetReady()

func (*State) SetReceivedInitRequest

func (s *State) SetReceivedInitRequest()

Jump to

Keyboard shortcuts

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