From caee1daded52ca6fb0dba7a8464aba17ff0cc1c1 Mon Sep 17 00:00:00 2001 From: GareArc Date: Wed, 4 Sep 2024 23:51:18 -0400 Subject: [PATCH] fix: typo for checking map item existence --- internal/cluster/node.go | 2 +- internal/cluster/plugin.go | 4 ++-- internal/utils/mapping/sync.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/cluster/node.go b/internal/cluster/node.go index a653716..c14a5d5 100644 --- a/internal/cluster/node.go +++ b/internal/cluster/node.go @@ -123,7 +123,7 @@ func (c *Cluster) FetchPluginAvailableNodesByHashedId(hashed_plugin_id string) ( if err != nil { continue } - if c.nodes.Exits(node_id) { + if c.nodes.Exists(node_id) { nodes = append(nodes, node_id) } } diff --git a/internal/cluster/plugin.go b/internal/cluster/plugin.go index 68650e7..2f73ac1 100644 --- a/internal/cluster/plugin.go +++ b/internal/cluster/plugin.go @@ -28,7 +28,7 @@ func (c *Cluster) RegisterPlugin(lifetime plugin_entities.PluginRuntimeTimeLifeI return err } - if c.plugins.Exits(identity.String()) { + if c.plugins.Exists(identity.String()) { return errors.New("plugin has been registered") } @@ -123,7 +123,7 @@ func (c *Cluster) doPluginStateUpdate(lifetime *pluginLifeTime) error { state_key := c.getPluginStateKey(c.id, hash_identity) // check if the plugin has been removed - if !c.plugins.Exits(identity.String()) { + if !c.plugins.Exists(identity.String()) { // remove state err = c.removePluginState(c.id, hash_identity) if err != nil { diff --git a/internal/utils/mapping/sync.go b/internal/utils/mapping/sync.go index 3f9039a..32be425 100644 --- a/internal/utils/mapping/sync.go +++ b/internal/utils/mapping/sync.go @@ -72,7 +72,7 @@ func (m *Map[K, V]) Len() int { return int(atomic.LoadInt32(&m.len)) } -func (m *Map[K, V]) Exits(key K) bool { +func (m *Map[K, V]) Exists(key K) bool { _, ok := m.Load(key) return ok }