negentropy

package
v0.57.2 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: Unlicense Imports: 2 Imported by: 0

Documentation

Overview

Package negentropy defines the interface for NIP-77 negentropy operations.

Index

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      int64
	LastActivity   int64
	RoundCount     int32
}

ClientSession represents an active client negentropy session.

type Handler

type Handler interface {
	// HandleNegOpen processes a NEG-OPEN message from a client.
	// Returns: message, haveIDs, needIDs, complete, errorStr, error
	HandleNegOpen(ctx context.Context, connectionID, subscriptionID string, filter *commonv1.Filter, initialMessage []byte) ([]byte, [][]byte, [][]byte, bool, string, error)

	// HandleNegMsg processes a NEG-MSG message from a client.
	// Returns: message, haveIDs, needIDs, complete, errorStr, error
	HandleNegMsg(ctx context.Context, connectionID, subscriptionID string, message []byte) ([]byte, [][]byte, [][]byte, bool, string, error)

	// HandleNegClose processes a NEG-CLOSE message from a client.
	HandleNegClose(ctx context.Context, connectionID, subscriptionID string) error

	// ListSessions returns active client negentropy sessions.
	ListSessions(ctx context.Context) ([]*ClientSession, error)

	// CloseSession forcefully closes a client session.
	CloseSession(ctx context.Context, connectionID, subscriptionID string) error

	// Ready returns a channel that closes when the handler is ready.
	Ready() <-chan struct{}

	// Close cleans up resources.
	Close() error
}

Handler defines the interface for handling NIP-77 negentropy messages. This interface is implemented by both the gRPC client and the embedded handler.

Source Files

  • negentropy.go

Jump to

Keyboard shortcuts

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