watchtower: add PreEvaluateFilterFn callback

In this commit, a PreEvaluateFilterFn option is added to the
wtdb.ClientSessionListCfg and it is used instead of a separate
ClientSessionFilterFn parameter. This neatens quiet a few function
signatures.
This commit is contained in:
Elle Mouton committed 2023-03-20 20:14:01 +02:00
1 parent c4c1f1ac92
commit 7bc86ca42e
6 files changed
+61 -57

No files matched your search

+3 -5
View File
@@ -870,7 +870,7 @@ func (h *testHarness) relevantSessions(chanID uint64) []wtdb.SessionID {
},
)
_, err := h.clientDB.ListClientSessions(nil, nil, collectSessions)
_, err := h.clientDB.ListClientSessions(nil, collectSessions)
require.NoError(h.t, err)
return sessionIDs
@@ -1969,7 +1969,7 @@ var clientTests = []clientTest{
// Also make a note of the total number of sessions the
// client has.
sessions, err := h.clientDB.ListClientSessions(nil, nil)
sessions, err := h.clientDB.ListClientSessions(nil)
require.NoError(h.t, err)
require.Len(h.t, sessions, 4)
@@ -1981,9 +1981,7 @@ var clientTests = []clientTest{
// marked as closable. The server should also no longer
// have these sessions in its DB.
err = wait.Predicate(func() bool {
sess, err := h.clientDB.ListClientSessions(
nil, nil,
)
sess, err := h.clientDB.ListClientSessions(nil)
require.NoError(h.t, err)
cs, err := h.clientDB.ListClosableSessions()