From e42eb4774494625b4f86fbb6e20fc771c9f7a3b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Fri, 15 May 2020 09:27:13 +0100 Subject: [PATCH] decaying tags: support removal and closure. (#151) --- core/connmgr/decay.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/core/connmgr/decay.go b/core/connmgr/decay.go index eea64f6d7e..2ff135a871 100644 --- a/core/connmgr/decay.go +++ b/core/connmgr/decay.go @@ -70,6 +70,23 @@ type DecayingTag interface { // will be applied asynchronously, and a non-nil error indicates a fault // when queuing. Bump(peer peer.ID, delta int) error + + // Remove removes a decaying tag from a peer. The removal will be applied + // asynchronously, and a non-nil error indicates a fault when queuing. + Remove(peer peer.ID) error + + // Close closes a decaying tag. The Decayer will stop tracking this tag, + // and the state of all peers in the Connection Manager holding this tag + // will be updated. + // + // The deletion is performed asynchronously. + // + // Once deleted, a tag should not be used, and further calls to Bump/Remove + // will error. + // + // Duplicate calls to Remove will not return errors, but a failure to queue + // the first actual removal, will (e.g. when the system is backlogged). + Close() error } // DecayingValue represents a value for a decaying tag.