-
Notifications
You must be signed in to change notification settings - Fork 43
/
events.go
79 lines (63 loc) · 1.66 KB
/
events.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package events
import "github.com/FleekHQ/space-daemon/core/space/domain"
// These file defines events that daemon can propagate through all layers
type FileEventType string
const (
FileAdded FileEventType = "FileAdded"
FileDeleted FileEventType = "FileDeleted"
FileUpdated FileEventType = "FileUpdated"
FileBackupInProgress FileEventType = "FileBackupInProgress"
FileBackupReady FileEventType = "FileBackupReady"
FileRestored FileEventType = "FileRestored"
FileRestoring FileEventType = "FileRestoring"
FolderAdded FileEventType = "FolderAdded"
FolderDeleted FileEventType = "FolderDeleted"
// NOTE: not sure if this needs to be specific to rename or copy
FolderUpdated FileEventType = "FolderUpdated"
)
type FileEvent struct {
Info domain.FileInfo
Type FileEventType
Bucket string
DbID string
}
func NewFileEvent(info domain.FileInfo, eventType FileEventType, bucket, dbID string) FileEvent {
return FileEvent{
Info: info,
Type: eventType,
Bucket: bucket,
DbID: dbID,
}
}
type TextileEvent struct {
BucketName string
}
func NewTextileEvent(bucketname string) TextileEvent {
return TextileEvent{
BucketName: bucketname,
}
}
type InvitationStatus int
const (
Pending InvitationStatus = 0
Accepted
Rejected
)
type NotificationType int
const (
InvitationType NotificationType = 0
)
type Invitation struct {
InviterPublicKey string
InvitationID string
Status InvitationStatus
ItemPaths []string
}
type NotificationEvent struct {
Subject string
Body string
RelatedObject interface{}
Type NotificationType
CreatedAt int64
ReadAt int64
}