-
Notifications
You must be signed in to change notification settings - Fork 161
/
emptydriver.go
91 lines (71 loc) · 2.05 KB
/
emptydriver.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
82
83
84
85
86
87
88
89
90
91
// Copyright (c) 2019-2020 Zededa, Inc.
// SPDX-License-Identifier: Apache-2.0
package pubsub
// Enable testing of pubsub when no actual work is needed.
// EmptyDriver struct
type EmptyDriver struct{}
// Publisher function
func (e *EmptyDriver) Publisher(global bool, name, topic string, persistent bool, updaterList *Updaters, restarted Restarted, differ Differ) (DriverPublisher, error) {
return &EmptyDriverPublisher{}, nil
}
// Subscriber function
func (e *EmptyDriver) Subscriber(global bool, name, topic string, persistent bool, C chan Change) (DriverSubscriber, error) {
return &EmptyDriverSubscriber{}, nil
}
// DefaultName function
func (e *EmptyDriver) DefaultName() string {
return "empty"
}
// EmptyDriverPublisher struct
type EmptyDriverPublisher struct{}
// Start function
func (e *EmptyDriverPublisher) Start() error {
return nil
}
// Load function
func (e *EmptyDriverPublisher) Load() (map[string][]byte, int, error) {
return make(map[string][]byte), 0, nil
}
// CheckMaxSize function
func (e *EmptyDriverPublisher) CheckMaxSize(key string, val []byte) error {
return nil
}
// Publish function
func (e *EmptyDriverPublisher) Publish(key string, item []byte) error {
return nil
}
// Unpublish function
func (e *EmptyDriverPublisher) Unpublish(key string) error {
return nil
}
// Restart function
func (e *EmptyDriverPublisher) Restart(restartCounter int) error {
return nil
}
// Stop function
func (e *EmptyDriverPublisher) Stop() error {
return nil
}
// LargeDirName where to put large fields
func (e *EmptyDriverPublisher) LargeDirName() string {
return "/tmp"
}
// EmptyDriverSubscriber struct
type EmptyDriverSubscriber struct{}
// Start function
func (e *EmptyDriverSubscriber) Start() error {
return nil
}
// Load function
func (e *EmptyDriverSubscriber) Load() (map[string][]byte, int, error) {
res := make(map[string][]byte)
return res, 0, nil
}
// Stop function
func (e *EmptyDriverSubscriber) Stop() error {
return nil
}
// LargeDirName where to put large fields
func (e *EmptyDriverSubscriber) LargeDirName() string {
return "/tmp"
}