Documentation ¶
Index ¶
Constants ¶
const Subsystem = "NTFNS"
Subsystem defines the sub system name of this package.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client interface { // SubscribeNotifications subscribes to the notifications from the server. SubscribeNotifications(ctx context.Context, in *swapserverrpc.SubscribeNotificationsRequest, opts ...grpc.CallOption) ( swapserverrpc.SwapServer_SubscribeNotificationsClient, error) }
Client is the interface that the notification manager needs to implement in order to be able to subscribe to notifications.
type Config ¶
type Config struct { // Client is the client used to communicate with the swap server. Client Client // FetchL402 is the function used to fetch the l402 token. FetchL402 func(context.Context) error }
Config contains all the services that the notification manager needs to operate.
type Manager ¶
Manager is a manager for notifications that the swap server sends to the client.
func NewManager ¶
NewManager creates a new notification manager.
func (*Manager) Run ¶
Run starts the notification manager. It will keep on running until the context is canceled. It will subscribe to notifications and forward them to the subscribers. On a first successful connection to the server, it will close the readyChan to signal that the manager is ready.
func (*Manager) SubscribeReservations ¶
func (m *Manager) SubscribeReservations(ctx context.Context, ) <-chan *swapserverrpc.ServerReservationNotification
SubscribeReservations subscribes to the reservation notifications.
type NotificationType ¶
type NotificationType int
NotificationType is the type of notification that the manager can handle.
const ( // NotificationTypeUnknown is the default notification type. NotificationTypeUnknown NotificationType = iota // NotificationTypeReservation is the notification type for reservation // notifications. NotificationTypeReservation )