Documentation ¶
Index ¶
- Variables
- func Consume(s Consumer, group string, evs ...Unmarshaller) (<-chan Event, error)
- func ConsumeAll(s Consumer, group string) (<-chan Event, error)
- func Publish(s Publisher, ev interface{}) error
- type BytesReceived
- type Consumer
- type ContainerCreated
- type Event
- type FileDownloaded
- type FileTouched
- type FileUploaded
- type FileVersionRestored
- type GroupCreated
- type GroupDeleted
- type GroupFeature
- type GroupFeatureChanged
- type GroupMemberAdded
- type GroupMemberRemoved
- type ItemMoved
- type ItemPurged
- type ItemRestored
- type ItemTrashed
- type LinkAccessFailed
- type LinkAccessed
- type LinkCreated
- type LinkRemoved
- type LinkUpdated
- type PersonalDataExtracted
- type PostprocessingFinished
- type PostprocessingOutcome
- type PostprocessingStepFinished
- type Postprocessingstep
- type Publisher
- type ReceivedShareUpdated
- type ShareCreated
- type ShareExpired
- type ShareRemoved
- type ShareUpdated
- type SpaceCreated
- type SpaceDeleted
- type SpaceDisabled
- type SpaceEnabled
- type SpaceMembershipExpired
- type SpaceRenamed
- type SpaceShared
- type SpaceUnshared
- type SpaceUpdated
- type StartPostprocessingStep
- type Stream
- type TagsAdded
- type TagsRemoved
- type Unmarshaller
- type UploadReady
- type UserCreated
- type UserDeleted
- type UserFeature
- type UserFeatureChanged
- type VirusscanResult
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" // MetadatakeyEventID is the key used for the eventID in the metadata map of the event MetadatakeyEventID = "eventid" )
var ( // PPStepAntivirus is the step that scans for viruses PPStepAntivirus Postprocessingstep = "virusscan" // PPStepPolicies is the step the step that enforces policies PPStepPolicies Postprocessingstep = "policies" // PPStepDelay is the step that processing. Useful for testing or user annoyment PPStepDelay Postprocessingstep = "delay" // PPOutcomeDelete means that the file and the upload should be deleted PPOutcomeDelete PostprocessingOutcome = "delete" // PPOutcomeAbort means that the upload is cancelled but the bytes are being kept in the upload folder PPOutcomeAbort PostprocessingOutcome = "abort" // PPOutcomeContinue means that the upload is moved to its final destination (eventually being marked with pp results) PPOutcomeContinue PostprocessingOutcome = "continue" )
Functions ¶
func Consume ¶
func Consume(s Consumer, group string, evs ...Unmarshaller) (<-chan Event, 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
func ConsumeAll ¶ added in v2.13.0
ConsumeAll allows consuming all events. Note that unmarshalling must be done manually in this case, therefore Event.Event will always be of type []byte
Types ¶
type BytesReceived ¶ added in v2.13.0
type BytesReceived struct { UploadID string SpaceOwner *user.UserId ExecutingUser *user.User ResourceID *provider.ResourceId Filename string Filesize uint64 URL string }
BytesReceived is emitted by the server when it received all bytes of an upload
func (BytesReceived) Unmarshal ¶ added in v2.13.0
func (BytesReceived) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type ContainerCreated ¶ added in v2.3.0
type ContainerCreated struct { SpaceOwner *user.UserId Executant *user.UserId Ref *provider.Reference Owner *user.UserId }
ContainerCreated is emitted when a directory has been created
func (ContainerCreated) Unmarshal ¶ added in v2.3.0
func (ContainerCreated) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
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 FileTouched ¶ added in v2.6.1
FileTouched is emitted when a file is uploaded
func (FileTouched) Unmarshal ¶ added in v2.6.1
func (FileTouched) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type FileUploaded ¶ added in v2.1.0
type FileUploaded struct { SpaceOwner *user.UserId Executant *user.UserId Ref *provider.Reference Owner *user.UserId }
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
type FileVersionRestored struct { SpaceOwner *user.UserId Executant *user.UserId Ref *provider.Reference Owner *user.UserId Key string }
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 GroupCreated ¶ added in v2.2.0
GroupCreated is emitted when a group was created
func (GroupCreated) Unmarshal ¶ added in v2.2.0
func (GroupCreated) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type GroupDeleted ¶ added in v2.2.0
GroupDeleted is emitted when a group was deleted
func (GroupDeleted) Unmarshal ¶ added in v2.2.0
func (GroupDeleted) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type GroupFeature ¶ added in v2.13.0
GroupFeature represents a group feature
type GroupFeatureChanged ¶ added in v2.13.0
type GroupFeatureChanged struct { Executant *user.UserId GroupID string Features []GroupFeature }
GroupFeatureChanged is emitted when a group feature was changed
func (GroupFeatureChanged) Unmarshal ¶ added in v2.13.0
func (GroupFeatureChanged) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill unmarshaller interface
type GroupMemberAdded ¶ added in v2.2.0
GroupMemberAdded is emitted when a user was added to a group
func (GroupMemberAdded) Unmarshal ¶ added in v2.2.0
func (GroupMemberAdded) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type GroupMemberRemoved ¶ added in v2.2.0
GroupMemberRemoved is emitted when a user was removed from a group
func (GroupMemberRemoved) Unmarshal ¶ added in v2.2.0
func (GroupMemberRemoved) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type ItemMoved ¶ added in v2.1.0
type ItemMoved struct { SpaceOwner *user.UserId Executant *user.UserId Ref *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
type ItemPurged struct { Executant *user.UserId ID *provider.ResourceId Ref *provider.Reference Owner *user.UserId }
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 { SpaceOwner *user.UserId Executant *user.UserId ID *provider.ResourceId Ref *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
type ItemTrashed struct { SpaceOwner *user.UserId Executant *user.UserId ID *provider.ResourceId Ref *provider.Reference Owner *user.UserId }
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 { Executant *user.UserId 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 { Executant *user.UserId 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
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 { Executant *user.UserId 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 PersonalDataExtracted ¶ added in v2.13.0
PersonalDataExtracted is emitted when a user data extraction is finished
func (PersonalDataExtracted) Unmarshal ¶ added in v2.13.0
func (PersonalDataExtracted) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type PostprocessingFinished ¶ added in v2.13.0
type PostprocessingFinished struct { UploadID string Filename string SpaceOwner *user.UserId ExecutingUser *user.User Result map[Postprocessingstep]interface{} // it is a map[step]Event Outcome PostprocessingOutcome }
PostprocessingFinished is emitted by *some* service which can decide that
func (PostprocessingFinished) Unmarshal ¶ added in v2.13.0
func (PostprocessingFinished) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type PostprocessingOutcome ¶ added in v2.13.0
type PostprocessingOutcome string
PostprocessingOutcome defines the result of the postprocessing
type PostprocessingStepFinished ¶ added in v2.13.0
type PostprocessingStepFinished struct { UploadID string ExecutingUser *user.User Filename string FinishedStep Postprocessingstep // name of the step Result interface{} // result information see VirusscanResult for example Error error // possible error of the step Outcome PostprocessingOutcome // some services may cause postprocessing to stop }
PostprocessingStepFinished can be issued by the server when a postprocessing step is finished
func (PostprocessingStepFinished) Unmarshal ¶ added in v2.13.0
func (PostprocessingStepFinished) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type Postprocessingstep ¶ added in v2.13.0
type Postprocessingstep string
Postprocessingstep are the available postprocessingsteps
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 ShareExpired ¶ added in v2.13.0
type ShareExpired struct { // split the protobuf Grantee oneof so we can use stdlib encoding/json }
ShareExpired is emitted when a share expires
func (ShareExpired) Unmarshal ¶ added in v2.13.0
func (ShareExpired) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type ShareRemoved ¶ added in v2.1.0
type ShareRemoved struct { // split protobuf Spec // split the protobuf Grantee oneof so we can use stdlib encoding/json }
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 { Executant *user.UserId 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 { Executant *user.UserId ID *provider.StorageSpaceId SpaceName string FinalMembers map[string]provider.ResourcePermissions Timestamp time.Time }
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 { Executant *user.UserId ID *provider.StorageSpaceId Timestamp time.Time }
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
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 SpaceMembershipExpired ¶ added in v2.13.0
type SpaceMembershipExpired struct { SpaceOwner *user.UserId SpaceID *provider.StorageSpaceId SpaceName string ExpiredAt time.Time // split the protobuf Grantee oneof so we can use stdlib encoding/json GranteeUserID *user.UserId GranteeGroupID *group.GroupId }
SpaceMembershipExpired is emitted when a space membership expires
func (SpaceMembershipExpired) Unmarshal ¶ added in v2.13.0
func (SpaceMembershipExpired) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type SpaceRenamed ¶ added in v2.1.0
type SpaceRenamed struct { Executant *user.UserId 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 SpaceShared ¶ added in v2.11.0
type SpaceShared struct {}
SpaceShared is emitted when a space is shared
func (SpaceShared) Unmarshal ¶ added in v2.11.0
func (SpaceShared) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type SpaceUnshared ¶ added in v2.12.0
type SpaceUnshared struct {}
SpaceUnshared is emitted when a space is unshared
func (SpaceUnshared) Unmarshal ¶ added in v2.12.0
func (SpaceUnshared) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type SpaceUpdated ¶ added in v2.12.0
type SpaceUpdated struct { Executant *user.UserId ID *provider.StorageSpaceId Space *provider.StorageSpace }
SpaceUpdated is emitted when a space is updated
func (SpaceUpdated) Unmarshal ¶ added in v2.12.0
func (SpaceUpdated) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type StartPostprocessingStep ¶ added in v2.13.0
type StartPostprocessingStep struct { UploadID string URL string ExecutingUser *user.User Filename string Filesize uint64 Token string // for file retrieval in after upload case ResourceID *provider.ResourceId // for file retrieval in after upload case RevaToken string // for file retrieval in after upload case StepToStart Postprocessingstep }
StartPostprocessingStep can be issued by the server to start a postprocessing step
func (StartPostprocessingStep) Unmarshal ¶ added in v2.13.0
func (StartPostprocessingStep) 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 TagsAdded ¶ added in v2.13.0
type TagsAdded struct { SpaceOwner *user.UserId Tags string Ref *provider.Reference Executant *user.UserId }
TagsAdded is emitted when a Tag has been added
type TagsRemoved ¶ added in v2.13.0
type TagsRemoved struct { SpaceOwner *user.UserId Tags string Ref *provider.Reference Executant *user.UserId }
TagsRemoved is emitted when a Tag has been added
func (TagsRemoved) Unmarshal ¶ added in v2.13.0
func (TagsRemoved) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type Unmarshaller ¶
Unmarshaller is the interface events need to fulfill
type UploadReady ¶ added in v2.13.0
type UploadReady struct { UploadID string Filename string SpaceOwner *user.UserId ExecutingUser *user.User FileRef *provider.Reference Failed bool Timestamp time.Time }
UploadReady is emitted by the storage provider when postprocessing is finished
func (UploadReady) Unmarshal ¶ added in v2.13.0
func (UploadReady) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type UserCreated ¶ added in v2.2.0
UserCreated is emitted when a user was created
func (UserCreated) Unmarshal ¶ added in v2.2.0
func (UserCreated) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type UserDeleted ¶ added in v2.2.0
UserDeleted is emitted when a user was deleted
func (UserDeleted) Unmarshal ¶ added in v2.2.0
func (UserDeleted) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type UserFeature ¶ added in v2.2.0
UserFeature represents a user feature
type UserFeatureChanged ¶ added in v2.2.0
type UserFeatureChanged struct { Executant *user.UserId UserID string Features []UserFeature }
UserFeatureChanged is emitted when a user feature was changed
func (UserFeatureChanged) Unmarshal ¶ added in v2.2.0
func (UserFeatureChanged) Unmarshal(v []byte) (interface{}, error)
Unmarshal to fulfill umarshaller interface
type VirusscanResult ¶ added in v2.13.0
type VirusscanResult struct { Infected bool Description string Scandate time.Time ResourceID *provider.ResourceId ErrorMsg string // empty when no error }
VirusscanResult is the Result of a PostprocessingStepFinished event from the antivirus
Source Files ¶
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 |
Package stream provides streaming clients used by `Consume` and `Publish` methods
|
Package stream provides streaming clients used by `Consume` and `Publish` methods |