Documentation ¶
Index ¶
- Variables
- func Consume(s Consumer, group string, evs ...Unmarshaller) (<-chan interface{}, error)
- func Publish(s Publisher, ev interface{}) error
- type Consumer
- type FileDownloaded
- type FileUploaded
- type FileVersionRestored
- type ItemMoved
- type ItemPurged
- type ItemRestored
- type ItemTrashed
- type LinkAccessFailed
- type LinkAccessed
- type LinkCreated
- type LinkRemoved
- type LinkUpdated
- type Publisher
- type ReceivedShareUpdated
- type ShareCreated
- type ShareRemoved
- type ShareUpdated
- type SpaceCreated
- type SpaceDeleted
- type SpaceDisabled
- type SpaceEnabled
- type SpaceRenamed
- type Stream
- type Unmarshaller
Constants ¶
This section is empty.
Variables ¶
var ( // MainQueueName is the name of the main queue // All events will go through here as they are forwarded to the consumer via the // group name // TODO: "fan-out" so not all events go through the same queue? requires investigation MainQueueName = "main-queue" // MetadatakeyEventType is the key used for the eventtype in the metadata map of the event MetadatakeyEventType = "eventtype" )
Functions ¶
func Consume ¶
func Consume(s Consumer, group string, evs ...Unmarshaller) (<-chan interface{}, error)
Consume returns a channel that will get all events that match the given evs group defines the service type: One group will get exactly one copy of a event that is emitted NOTE: uses reflect on initialization
Types ¶
type FileDownloaded ¶ added in v2.1.0
FileDownloaded is emitted when a file is downloaded
func (FileDownloaded) Unmarshal ¶ added in v2.1.0
func (FileDownloaded) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type FileUploaded ¶ added in v2.1.0
FileUploaded is emitted when a file is uploaded
func (FileUploaded) Unmarshal ¶ added in v2.1.0
func (FileUploaded) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type FileVersionRestored ¶ added in v2.1.0
FileVersionRestored is emitted when a file version is restored
func (FileVersionRestored) Unmarshal ¶ added in v2.1.0
func (FileVersionRestored) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type ItemMoved ¶ added in v2.1.0
type ItemMoved struct { FileID *provider.Reference Owner *user.UserId OldReference *provider.Reference }
ItemMoved is emitted when a file or folder is moved
type ItemPurged ¶ added in v2.1.0
ItemPurged is emitted when a file or folder is removed from trashbin
func (ItemPurged) Unmarshal ¶ added in v2.1.0
func (ItemPurged) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type ItemRestored ¶ added in v2.1.0
type ItemRestored struct { FileID *provider.Reference Owner *user.UserId OldReference *provider.Reference Key string }
ItemRestored is emitted when a file or folder is restored from trashbin
func (ItemRestored) Unmarshal ¶ added in v2.1.0
func (ItemRestored) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type ItemTrashed ¶ added in v2.1.0
ItemTrashed is emitted when a file or folder is trashed
func (ItemTrashed) Unmarshal ¶ added in v2.1.0
func (ItemTrashed) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type LinkAccessFailed ¶ added in v2.1.0
LinkAccessFailed is emitted when an access to a public link has resulted in an error (by token)
func (LinkAccessFailed) Unmarshal ¶ added in v2.1.0
func (LinkAccessFailed) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type LinkAccessed ¶ added in v2.1.0
type LinkAccessed struct { ItemID *provider.ResourceId Permissions *link.PublicSharePermissions DisplayName string Expiration *types.Timestamp PasswordProtected bool CTime *types.Timestamp Token string }
LinkAccessed is emitted when a public link is accessed successfully (by token)
func (LinkAccessed) Unmarshal ¶ added in v2.1.0
func (LinkAccessed) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type LinkCreated ¶ added in v2.1.0
type LinkCreated struct { ItemID *provider.ResourceId Permissions *link.PublicSharePermissions DisplayName string Expiration *types.Timestamp PasswordProtected bool CTime *types.Timestamp Token string }
LinkCreated is emitted when a public link is created
func (LinkCreated) Unmarshal ¶ added in v2.1.0
func (LinkCreated) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type LinkRemoved ¶ added in v2.1.0
type LinkRemoved struct { // split protobuf Ref }
LinkRemoved is emitted when a share is removed
func (LinkRemoved) Unmarshal ¶ added in v2.1.0
func (LinkRemoved) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type LinkUpdated ¶ added in v2.1.0
type LinkUpdated struct { ItemID *provider.ResourceId Permissions *link.PublicSharePermissions DisplayName string Expiration *types.Timestamp PasswordProtected bool CTime *types.Timestamp Token string FieldUpdated string }
LinkUpdated is emitted when a public link is updated
func (LinkUpdated) Unmarshal ¶ added in v2.1.0
func (LinkUpdated) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type Publisher ¶
type Publisher interface {
Publish(string, interface{}, ...events.PublishOption) error
}
Publisher is the interface publishers need to fulfill
type ReceivedShareUpdated ¶ added in v2.1.0
type ReceivedShareUpdated struct {}
ReceivedShareUpdated is emitted when a received share is accepted or declined
func (ReceivedShareUpdated) Unmarshal ¶ added in v2.1.0
func (ReceivedShareUpdated) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type ShareCreated ¶
type ShareCreated struct { // split the protobuf Grantee oneof so we can use stdlib encoding/json }
ShareCreated is emitted when a share is created
func (ShareCreated) Unmarshal ¶
func (ShareCreated) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type ShareRemoved ¶ added in v2.1.0
type ShareRemoved struct { // split protobuf Spec }
ShareRemoved is emitted when a share is removed
func (ShareRemoved) Unmarshal ¶ added in v2.1.0
func (ShareRemoved) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type ShareUpdated ¶ added in v2.1.0
type ShareUpdated struct { string }Updated
ShareUpdated is emitted when a share is updated
func (ShareUpdated) Unmarshal ¶ added in v2.1.0
func (ShareUpdated) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type SpaceCreated ¶ added in v2.1.0
type SpaceCreated struct { ID *provider.StorageSpaceId Owner *user.UserId Root *provider.ResourceId Name string Type string Quota *provider.Quota MTime *types.Timestamp }
SpaceCreated is emitted when a space is created
func (SpaceCreated) Unmarshal ¶ added in v2.1.0
func (SpaceCreated) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type SpaceDeleted ¶ added in v2.1.0
type SpaceDeleted struct {
ID *provider.StorageSpaceId
}
SpaceDeleted is emitted when a space is deleted
func (SpaceDeleted) Unmarshal ¶ added in v2.1.0
func (SpaceDeleted) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type SpaceDisabled ¶ added in v2.1.0
type SpaceDisabled struct {
ID *provider.StorageSpaceId
}
SpaceDisabled is emitted when a space is disabled
func (SpaceDisabled) Unmarshal ¶ added in v2.1.0
func (SpaceDisabled) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type SpaceEnabled ¶ added in v2.1.0
type SpaceEnabled struct { ID *provider.StorageSpaceId Owner *user.UserId }
SpaceEnabled is emitted when a space is (re-)enabled
func (SpaceEnabled) Unmarshal ¶ added in v2.1.0
func (SpaceEnabled) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type SpaceRenamed ¶ added in v2.1.0
type SpaceRenamed struct { ID *provider.StorageSpaceId Owner *user.UserId Name string }
SpaceRenamed is emitted when a space is renamed
func (SpaceRenamed) Unmarshal ¶ added in v2.1.0
func (SpaceRenamed) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type Stream ¶
type Stream interface { Publish(string, interface{}, ...events.PublishOption) error Consume(string, ...events.ConsumeOption) (<-chan events.Event, error) }
Stream is the interface common to Publisher and Consumer
type Unmarshaller ¶
Unmarshaller is the interface events need to fulfill
Directories ¶
Path | Synopsis |
---|---|
consumer
Package consumer contains an example implementation of an event consumer
|
Package consumer contains an example implementation of an event consumer |
publisher
Package publisher contains an example implementation for a publisher
|
Package publisher contains an example implementation for a publisher |