Documentation ¶
Overview ¶
Package events provides event subscription and polling functionality.
Index ¶
Constants ¶
View Source
const BufferSize = 64
Variables ¶
View Source
var ( ErrTimeout = errors.New("timeout") ErrClosed = errors.New("closed") )
View Source
var Default = NewLogger()
Functions ¶
Types ¶
type BufferedSubscription ¶
func NewBufferedSubscription ¶
func NewBufferedSubscription(s *Subscription, size int) BufferedSubscription
type Event ¶
type Event struct { // Per-subscription sequential event ID. Named "id" for backwards compatibility with the REST API SubscriptionID int `json:"id"` // Global ID of the event across all subscriptions GlobalID int `json:"globalID"` Time time.Time `json:"time"` Type EventType `json:"type"` Data interface{} `json:"data"` }
type EventType ¶
type EventType int
const ( Ping EventType = 1 << iota Starting StartupComplete DeviceDiscovered DeviceConnected DeviceDisconnected DeviceRejected DevicePaused DeviceResumed LocalChangeDetected LocalIndexUpdated RemoteIndexUpdated ItemStarted ItemFinished StateChanged FolderRejected ConfigSaved DownloadProgress RemoteDownloadProgress FolderSummary FolderCompletion FolderErrors FolderScanProgress ListenAddressesChanged LoginAttempt AllEvents = (1 << iota) - 1 )
func (EventType) MarshalText ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func (*Logger) Subscribe ¶
func (l *Logger) Subscribe(mask EventType) *Subscription
func (*Logger) Unsubscribe ¶
func (l *Logger) Unsubscribe(s *Subscription)
type Subscription ¶
type Subscription struct {
// contains filtered or unexported fields
}
func (*Subscription) C ¶
func (s *Subscription) C() <-chan Event
Click to show internal directories.
Click to hide internal directories.