From 59b3a3c8c57d87d4492821988940e20ef98281cf Mon Sep 17 00:00:00 2001 From: Martynas Pumputis Date: Tue, 7 Jun 2016 13:39:11 +0100 Subject: [PATCH] Add the Tracker interface An instance of the interface must implement the HandleUpdate method which (in the future) will be called when any change to the IPAM ring occurs. --- ipam/tracker/tracker.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 ipam/tracker/tracker.go diff --git a/ipam/tracker/tracker.go b/ipam/tracker/tracker.go new file mode 100644 index 00000000..6a9846db --- /dev/null +++ b/ipam/tracker/tracker.go @@ -0,0 +1,20 @@ +package tracker + +import ( + "github.com/weaveworks/weave/net/address" +) + +// LocalRangeTracker is an interface for tracking changes in the IPAM ring. +type LocalRangeTracker interface { + // HandleUpdate is called whenever an address ring gets updated. + // + // prevRanges corresponds to ranges which were owned by a peer before + // a change in the ring, while currRanges to the ones which are currently + // owned by the peer. + // Both slices have to be sorted in increasing order. + // Adjacent ranges within each slice might appear as separate ranges. + // + // The local parameter indicates whether the ranges belong to the peer + // by which the method is called. + HandleUpdate(prevRanges, currRanges []address.Range, local bool) error +}