summaryrefslogtreecommitdiff
path: root/libnetwork/drvregistry
diff options
context:
space:
mode:
authorJana Radhakrishnan <mrjana@docker.com>2016-04-18 19:55:39 -0700
committerJana Radhakrishnan <mrjana@docker.com>2016-04-18 19:55:39 -0700
commit6fb69f0816bfb08733bc3336453c4903c58f6700 (patch)
treec2e935bd734c2c1c7b2838962eaba7f69d469aa4 /libnetwork/drvregistry
parent6522930d90df47918c83ee92e312c7ab035d4de3 (diff)
downloaddocker-6fb69f0816bfb08733bc3336453c4903c58f6700.tar.gz
Add driver api enhancements for gossip
With the introduction of a driver generic gossip in libnetwork it is not necessary for drivers to run their own gossip protocol (like what overlay driver is doing currently) but instead rely on the gossip instance run centrally in libnetwork. In order to achieve this, certain enhancements to driver api are needed. This api aims to provide these enhancements. The new api provides a way for drivers to register interest on table names of their choice by returning a list of table names of interest as a response to CreateNetwork. By doing that they will get notified if a CRUD operation happened on the tables of their interest, via the newly added EventNotify call. Drivers themselves can add entries to any table during a Join call by invoking AddTableEntry method any number of times during the Join call. These entries lifetime is the same as the endpoint itself. As soon as the container leaves the endpoint, those entries added by driver during that endpoint's Join call will be automatically removed by libnetwork. This action may trigger notification of such deletion to all driver instances in the cluster who have registered interest in that table's notification. Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
Diffstat (limited to 'libnetwork/drvregistry')
-rw-r--r--libnetwork/drvregistry/drvregistry_test.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/libnetwork/drvregistry/drvregistry_test.go b/libnetwork/drvregistry/drvregistry_test.go
index bcadad26be..0b77b6fecb 100644
--- a/libnetwork/drvregistry/drvregistry_test.go
+++ b/libnetwork/drvregistry/drvregistry_test.go
@@ -25,7 +25,7 @@ func mockDriverInit(reg driverapi.DriverCallback, opt map[string]interface{}) er
return reg.RegisterDriver(mockDriverName, &md, driverapi.Capability{DataScope: datastore.LocalScope})
}
-func (m *mockDriver) CreateNetwork(nid string, options map[string]interface{}, ipV4Data, ipV6Data []driverapi.IPAMData) error {
+func (m *mockDriver) CreateNetwork(nid string, options map[string]interface{}, nInfo driverapi.NetworkInfo, ipV4Data, ipV6Data []driverapi.IPAMData) error {
return nil
}
@@ -81,6 +81,9 @@ func (m *mockDriver) NetworkFree(id string) error {
return nil
}
+func (m *mockDriver) EventNotify(etype driverapi.EventType, nid, tableName, key string, value []byte) {
+}
+
func getNew(t *testing.T) *DrvRegistry {
reg, err := New(nil, nil, nil, nil)
if err != nil {