29 lines
644 B
Go
29 lines
644 B
Go
package core
|
|
|
|
import "github.com/google/uuid"
|
|
|
|
// abstraction for dispatcher to make it replaceable
|
|
type Subscriber interface {
|
|
Subscribe() (int16, <-chan string)
|
|
Unsubscribe(id int16) error
|
|
}
|
|
|
|
// abstraction for dispatcher to make it replaceable
|
|
type Publisher interface {
|
|
Publish(message string)
|
|
Streamer
|
|
}
|
|
|
|
// implementing struct should be responsible for message forwarding (to client)
|
|
type Streamer interface {
|
|
SetStreaming(s bool) (ok bool)
|
|
IsClosed() bool
|
|
}
|
|
|
|
// abstraction for persistance layer
|
|
type Storer interface {
|
|
Save(tracking Tracking) error
|
|
LoadAll() ([]TrackingMetadata, error)
|
|
Load(id uuid.UUID) (*Tracking, error)
|
|
}
|