forked from contiv/vpp
/
plugin_api_kvdbproxy.go
24 lines (19 loc) · 1.09 KB
/
plugin_api_kvdbproxy.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
package kvdbproxy
import (
"github.com/golang/protobuf/proto"
"github.com/ligato/cn-infra/datasync"
)
// Proxy forwards calls to a kvdbsync plugin. It allows to filter changeEvents that come from the plugin.
type Proxy interface {
// AddIgnoreEntry adds the entry into ignore list. The first change event matching the given key and operation
// is skipped. Once the event is skipped the entry is removed from the list.
AddIgnoreEntry(key string, op datasync.PutDel)
// Watch forwards the subscription request to the injected kvdbsync plugin. The change events
// are filtered based on the plugin ignore list. The resync events are untouched.
Watch(resyncName string, changeChan chan datasync.ChangeEvent,
resyncChan chan datasync.ResyncEvent, keyPrefixes ...string) (datasync.WatchRegistration, error)
// Put puts data into a datastore using the injected kvdbsync plugin.
Put(key string, data proto.Message, opts ...datasync.PutOption) error
// Delete deletes data from a datastore using the injected kvdbsync plugin.
Delete(key string, opts ...datasync.DelOption) (existed bool, err error)
}