-
Notifications
You must be signed in to change notification settings - Fork 0
/
queue.go
60 lines (50 loc) · 1.28 KB
/
queue.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
package notificationqueue
import "github.com/herb-go/notification"
//Queue notification deliver queue
type Queue interface {
//PopChan return execution chan
PopChan() (<-chan *Execution, error)
//Push push notification to queue
Push(*notification.Notification) error
//Remove remove notification by given id
Remove(nid string) error
//Start start queue
Start() error
//Stop stop queue
Stop() error
//AttachTo attach queue to notifier
AttachTo(*Notifier) error
//Detach detach queue.
Detach() error
}
//NopQueue struct
type NopQueue struct {
}
//PopChan return execution chan
func (*NopQueue) PopChan() (<-chan *Execution, error) {
return nil, ErrQueueDriverRequired
}
//Push push notification to queue
func (*NopQueue) Push(*notification.Notification) error {
return ErrQueueDriverRequired
}
//Remove remove notification by given id
func (*NopQueue) Remove(nid string) error {
return ErrQueueDriverRequired
}
//Start start queue
func (*NopQueue) Start() error {
return ErrQueueDriverRequired
}
//Stop stop queue
func (*NopQueue) Stop() error {
return ErrQueueDriverRequired
}
//AttachTo attach queue to notifier
func (*NopQueue) AttachTo(*Notifier) error {
return ErrQueueDriverRequired
}
//Detach detach queue.
func (*NopQueue) Detach() error {
return ErrQueueDriverRequired
}