-
Notifications
You must be signed in to change notification settings - Fork 3
/
connector.go
44 lines (34 loc) · 869 Bytes
/
connector.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package eventline
import (
"net/url"
"github.com/exograd/go-daemon/check"
"github.com/exograd/go-daemon/daemon"
"github.com/exograd/go-daemon/pg"
"github.com/exograd/go-daemon/dlog"
)
type ConnectorInitData struct {
Daemon *daemon.Daemon
Log *dlog.Logger
WebHTTPServerURI *url.URL
}
type ConnectorCfg interface {
check.Object
}
type Connector interface {
Name() string
Definition() *ConnectorDef
DefaultCfg() ConnectorCfg
Init(ConnectorCfg, ConnectorInitData) error
Terminate()
}
type SubscribableConnector interface {
Connector
Subscribe(pg.Conn, *SubscriptionContext) error
Unsubscribe(pg.Conn, *SubscriptionContext) error
}
// The optional aspect of the connector is related to events only. But at this
// point I do not have a better idea for a name.
type OptionalConnector interface {
Connector
Enabled() bool
}