|
|
@ -12,12 +12,18 @@ import ( |
|
|
|
"sync" |
|
|
|
) |
|
|
|
|
|
|
|
// ServiceMetrics outlines higher level information about the service e.g. counts of connections
|
|
|
|
type ServiceMetrics struct { |
|
|
|
ConnectionCount int |
|
|
|
} |
|
|
|
|
|
|
|
// Service defines the interface for a Tapir Service
|
|
|
|
type Service interface { |
|
|
|
Init(acn connectivity.ACN, privateKey ed25519.PrivateKey, identity *primitives.Identity) |
|
|
|
Connect(hostname string, application Application) (bool, error) |
|
|
|
Listen(application Application) error |
|
|
|
GetConnection(connectionID string) (Connection, error) |
|
|
|
Metrics() ServiceMetrics |
|
|
|
Broadcast(message []byte, capability Capability) error |
|
|
|
WaitForCapabilityOrClose(connectionID string, capability Capability) (Connection, error) |
|
|
|
Shutdown() |
|
|
|