watchtower: extend client db to filter sessions for a specific tower
This currently takes O(N) time as there does not exist an index of active client sessions for each watchtower within the client's database. This index is likely to be added in the future.
This commit is contained in:
5 files changed
+111
-29
No files matched your search
@@ -206,7 +206,7 @@ func New(config *Config) (*TowerClient, error) {
|
||||
// use any of these session if their policies match the current policy
|
||||
// of the client, otherwise they will be ignored and new sessions will
|
||||
// be requested.
|
||||
sessions, err := cfg.DB.ListClientSessions()
|
||||
sessions, err := cfg.DB.ListClientSessions(nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -38,8 +38,10 @@ type DB interface {
|
||||
|
||||
// ListClientSessions returns all sessions that have not yet been
|
||||
// exhausted. This is used on startup to find any sessions which may
|
||||
// still be able to accept state updates.
|
||||
ListClientSessions() (map[wtdb.SessionID]*wtdb.ClientSession, error)
|
||||
// still be able to accept state updates. An optional tower ID can be
|
||||
// used to filter out any client sessions in the response that do not
|
||||
// correspond to this tower.
|
||||
ListClientSessions(*wtdb.TowerID) (map[wtdb.SessionID]*wtdb.ClientSession, error)
|
||||
|
||||
// FetchChanSummaries loads a mapping from all registered channels to
|
||||
// their channel summaries.
|
||||
|
||||
Reference in new issue
Block a user