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") )
Functions ¶
Types ¶
type BufferedSubscription ¶
type BufferedSubscription interface { Since(id int, into []Event, timeout time.Duration) []Event Mask() EventType }
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 int64
const ( Starting EventType = 1 << iota StartupComplete DeviceDiscovered DeviceConnected DeviceDisconnected DeviceRejected // DEPRECATED, superseded by PendingDevicesChanged PendingDevicesChanged DevicePaused DeviceResumed ClusterConfigReceived LocalChangeDetected RemoteChangeDetected LocalIndexUpdated RemoteIndexUpdated ItemStarted ItemFinished StateChanged FolderRejected // DEPRECATED, superseded by PendingFoldersChanged PendingFoldersChanged ConfigSaved DownloadProgress RemoteDownloadProgress FolderSummary FolderCompletion FolderErrors FolderScanProgress FolderPaused FolderResumed FolderWatchStateChanged ListenAddressesChanged LoginAttempt Failure AllEvents = (1 << iota) - 1 )
func UnmarshalEventType ¶ added in v0.14.28
func (EventType) MarshalText ¶
func (*EventType) UnmarshalJSON ¶ added in v0.14.42
Click to show internal directories.
Click to hide internal directories.