-
Notifications
You must be signed in to change notification settings - Fork 43
/
events.go
81 lines (65 loc) · 1.61 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
80
81
package events
import (
"os"
)
// 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 {
Path string
Bucket string
Info os.FileInfo
Type FileEventType
}
func NewFileEvent(path, bucket string, eventType FileEventType, info os.FileInfo) FileEvent {
return FileEvent{
Path: path,
Bucket: bucket,
Type: eventType,
Info: info,
}
}
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
}