models.go raw
1 package events
2
3 import (
4 "context"
5 )
6
7 type EventSubscriber interface {
8 ConsumeEvent(ctx context.Context, event *Event, globalProperties map[string]interface{})
9 }
10
11 type EventPublisher interface {
12 RegisterSubscriber(eventListener EventSubscriber)
13 RemoveSubscriber(eventListener EventSubscriber)
14 Publish(event *Event)
15 PublishSync(event *Event)
16 SetGlobalProperty(key string, value interface{})
17 }
18
19 type Event struct {
20 Event string `json:"event"`
21 Properties interface{} `json:"properties,omitempty"`
22 }
23
24 type StaticChannelsBackupEvent struct {
25 NodeID string `json:"node_id"`
26 Channels []ChannelBackup `json:"channels"`
27 Monitors []EncodedChannelMonitorBackup `json:"monitors"`
28 }
29
30 type EncodedChannelMonitorBackup struct {
31 Key string `json:"key"`
32 Value string `json:"value"`
33 }
34
35 type ChannelBackup struct {
36 ChannelID string `json:"channel_id"`
37 PeerID string `json:"peer_id"`
38 PeerSocketAddress string `json:"peer_socket_address"`
39 ChannelSize uint64 `json:"channel_size"`
40 FundingTxID string `json:"funding_tx_id"`
41 FundingTxVout uint32 `json:"funding_tx_vout"`
42 }
43