Documentation
¶
Overview ¶
Package negentropy provides NIP-77 negentropy-based set reconciliation for both relay-to-relay sync and client-facing WebSocket operations.
Index ¶
- type ClientSession
- type Config
- type Manager
- func (m *Manager) AddPeer(peerURL string)
- func (m *Manager) CleanupExpiredSessions() int
- func (m *Manager) CloseSession(connectionID, subscriptionID string)
- func (m *Manager) CloseSessionsByConnection(connectionID string)
- func (m *Manager) GetPeerState(peerURL string) (*PeerState, bool)
- func (m *Manager) GetPeerStates() []*PeerState
- func (m *Manager) GetPeers() []string
- func (m *Manager) GetSession(connectionID, subscriptionID string) (*ClientSession, bool)
- func (m *Manager) IsActive() bool
- func (m *Manager) LastSync() time.Time
- func (m *Manager) ListSessions() []*ClientSession
- func (m *Manager) OpenSession(connectionID, subscriptionID string) *ClientSession
- func (m *Manager) RemovePeer(peerURL string)
- func (m *Manager) Start()
- func (m *Manager) Stop()
- func (m *Manager) TriggerSync(ctx context.Context, peerURL string)
- func (m *Manager) UpdateSessionActivity(connectionID, subscriptionID string)
- type PeerState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientSession ¶
type ClientSession struct {
SubscriptionID string
ConnectionID string
CreatedAt time.Time
LastActivity time.Time
RoundCount int32
// contains filtered or unexported fields
}
ClientSession represents an active client negentropy session.
func (*ClientSession) GetNegentropy ¶
func (s *ClientSession) GetNegentropy() *negentropy.Negentropy
GetNegentropy returns the negentropy instance for this session.
func (*ClientSession) SetNegentropy ¶
func (s *ClientSession) SetNegentropy(neg *negentropy.Negentropy, storage *negentropy.Vector)
SetNegentropy sets the negentropy instance and storage for this session.
type Config ¶
type Config struct {
Peers []string
SyncInterval time.Duration
FrameSize int
IDSize int
ClientSessionTimeout time.Duration
Filter *filter.F // Optional filter for selective sync
}
Config holds configuration for the negentropy manager.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles negentropy sync operations.
func NewManager ¶
NewManager creates a new negentropy manager.
func (*Manager) AddPeer ¶
AddPeer adds a peer for negentropy sync.
func (*Manager) CleanupExpiredSessions ¶
CleanupExpiredSessions removes sessions that have been inactive beyond timeout.
func (*Manager) CloseSession ¶
CloseSession closes a client session.
func (*Manager) CloseSessionsByConnection ¶
CloseSessionsByConnection closes all sessions for a connection.
func (*Manager) GetPeerState ¶
GetPeerState returns the sync state for a specific peer.
func (*Manager) GetPeerStates ¶
GetPeerStates returns the sync state for all peers.
func (*Manager) GetPeers ¶
GetPeers returns the list of peer URLs.
func (*Manager) GetSession ¶
func (m *Manager) GetSession(connectionID, subscriptionID string) (*ClientSession, bool)
GetSession retrieves an existing session.
func (*Manager) IsActive ¶
IsActive returns whether background sync is running.
func (*Manager) LastSync ¶
LastSync returns the timestamp of the last sync cycle.
func (*Manager) ListSessions ¶
func (m *Manager) ListSessions() []*ClientSession
ListSessions returns all active sessions.
func (*Manager) OpenSession ¶
func (m *Manager) OpenSession(connectionID, subscriptionID string) *ClientSession
OpenSession opens a new client negentropy session.
func (*Manager) RemovePeer ¶
RemovePeer removes a peer from negentropy sync.
func (*Manager) TriggerSync ¶
TriggerSync manually triggers sync with a specific peer or all peers.
Source Files
¶
- manager.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package grpc provides a gRPC client for the negentropy sync service.
|
Package grpc provides a gRPC client for the negentropy sync service. |
|
Package server provides the gRPC server implementation for negentropy sync.
|
Package server provides the gRPC server implementation for negentropy sync. |