From 7f90028590126274f3ba2b8dabaf62aba48d5de3 Mon Sep 17 00:00:00 2001 From: Jono Wenger <jono@elixxir.io> Date: Thu, 18 Feb 2021 11:47:20 -0800 Subject: [PATCH] Remove reception storage from single.NewManager --- cmd/single.go | 2 +- single/manager.go | 6 +++++- single/manager_test.go | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cmd/single.go b/cmd/single.go index e9fbc5dca..e3c2ad639 100644 --- a/cmd/single.go +++ b/cmd/single.go @@ -72,7 +72,7 @@ var singleCmd = &cobra.Command{ waitUntilConnected(connected) // Make single-use manager and start receiving process - singleMng := single.NewManager(client, client.GetStorage().Reception()) + singleMng := single.NewManager(client) // Register the callback callbackChan := make(chan responseCallbackChan) diff --git a/single/manager.go b/single/manager.go index d24c88fdd..cbf21d952 100644 --- a/single/manager.go +++ b/single/manager.go @@ -50,7 +50,11 @@ type Manager struct { } // NewManager creates a new single-use communication manager. -func NewManager(client *api.Client, reception *reception.Store) *Manager { +func NewManager(client *api.Client) *Manager { + return newManager(client, client.GetStorage().Reception()) +} + +func newManager(client *api.Client, reception *reception.Store) *Manager { return &Manager{ client: client, store: client.GetStorage(), diff --git a/single/manager_test.go b/single/manager_test.go index c7f94b101..d2dcfa4be 100644 --- a/single/manager_test.go +++ b/single/manager_test.go @@ -39,13 +39,13 @@ import ( ) // Happy path. -func TestNewManager(t *testing.T) { +func Test_newManager(t *testing.T) { client := &api.Client{} e := &Manager{ client: client, p: newPending(), } - m := NewManager(client, reception.NewStore(versioned.NewKV(make(ekv.Memstore)))) + m := newManager(client, &reception.Store{}) if e.client != m.client || e.store != m.store || e.net != m.net || e.rng != m.rng || !reflect.DeepEqual(e.p, m.p) { -- GitLab