forked from ardanlabs/gotraining
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pubsub.go
38 lines (28 loc) · 883 Bytes
/
pubsub.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
// All material is licensed under the Apache License Version 2.0, January 2004
// http://www.apache.org/licenses/LICENSE-2.0
// Package pubsub simulates a package that provides publication/subscription
// type services.
package pubsub
// PubSub provides access to a queue system.
type PubSub struct {
host string
// PRETEND THERE ARE MORE FIELDS.
}
// New creates a pubsub value for use.
func New(host string) *PubSub {
ps := PubSub{
host: host,
}
// PRETEND THERE IS A SPECIFIC IMPLEMENTATION.
return &ps
}
// Publish sends the data for the specified key.
func (ps *PubSub) Publish(key string, v interface{}) error {
// PRETEND THERE IS A SPECIFIC IMPLEMENTATION.
return nil
}
// Subscribe sets up an request to receive messages for the specified key.
func (ps *PubSub) Subscribe(key string) error {
// PRETEND THERE IS A SPECIFIC IMPLEMENTATION.
return nil
}