Commit Graph

26 Commits

Author SHA1 Message Date
648fb22f63 multi: wrap all errors 2024-04-11 15:04:03 +02:00
beb9b2eeb8 wtclient: add DeactivateTower method
This commit adds the DeactiateTower method to the wtclient.ClientManager
interface along with its implementation. A test is also added for the
new method.
2024-02-20 14:44:09 +02:00
1ae802812c watchtower: update DeleteCommittedUpdate to delete all
This commit updates the DeleteCommittedUpdate DB method to delete all of
a given session's committed updates instead of just one at a time. The
reason for this is that in an upcoming commit, we will introduce a
"Terminal" session state - once we have deleted a committed update for a
session it should be considered "Terminal" and there is never a case
where we would only want to delete one committed update and not the
rest. So we want these two actions (deleting committed updates of a
session and setting it's status to terminal) to be atomic.
2024-02-20 08:58:45 +02:00
e800aacff4 wtclient+server: unexport and rename TowerClient
Rename and unexport the `TowerClient` struct to `client` and rename the
`TowerClientManager` interface to `ClientManager`.
2023-11-28 11:01:51 +02:00
3ea67983b5 wtclient: replay un-acked updates onto pipeline
In this commit, the bugs demonstrated in prior commits are fixed. In the
case where an session has persisted a CommittedUpdate and the tower is
being removed, the session will now replay that update on to the main
task pipeline so that it can be backed up using a different session.
2023-07-18 16:28:27 +02:00
552ef4bf81 wtclient: replay pending tasks on sessionQueue stop
This commit does a few things:
- First, it gives the sessionQueue access to the TowerClient task
  pipeline so that it can replay backup tasks onto the pipeline on Stop.
- Given that the above is done, the ForceQuit functionality of the
  sessionQueue and TowerClient can be removed.
- The bug demonstrated in a prior commit is now fixed due to the above
  changes.
2023-07-18 16:28:26 +02:00
25c4d3f1f7 wtclient: make sessionQueueSet thread safe
In preparation for an upcoming commit where multiple threads will have
access to the TowerClient sessionQueueSet, we turn it into a thread safe
struct.
2023-07-18 14:27:04 +02:00
2371bbf09a wtclient: only fetch retribution info when needed.
Only construct the retribution info at the time that the backup task is
being bound to a session.
2023-04-24 13:15:40 +02:00
530a8cae5d wtclient: lint the package
This commit fixes some lints in the wtclient package. This is done so
that upcoming logic changes are easier to parse.
2023-04-24 13:15:40 +02:00
55b53555e9 multi: improve readability of goroutine defers
This commit fixes the readability of some of the defer calls in
goroutines by making sure the defer stands out properly.
2022-11-21 13:54:24 +01:00
8a7329b988 watchtower: make use of the new AddressIterator
This commit upgrades the wtclient package to make use of the new
`AddressIterator`. It does so by first creating new `Tower` and
`ClientSession` types. The new `Tower` type has an `AddressIterator`
instead of a list of addresses. The `ClientSession` type contains a
`Tower`.
2022-10-20 15:46:52 +02:00
378478eb1a multi: fix typos and grammar issues in comments [skip ci] 2022-10-17 09:40:22 +02:00
75e5339217 watchtower: remove CommittedUpdates from ClientSession
In this commit, the new ListClientSession functional options and new
FetchSessionCommittedUpdates function are utilised in order to allow us
to completely remove the CommittedUpdates member from the ClientSession
struct.
2022-10-13 14:41:26 +02:00
1d3535582b wtclient/seseion_queue: add prefix logging 2021-01-04 08:32:34 -08:00
f97e7b9951 watchtower: use ECDH interface for watchtower session 2020-05-20 09:06:57 +02:00
b0cb110e86 watchtower: rename SessionPrivKey to SessionKeyECDH 2020-05-20 09:05:15 +02:00
3d7de2ad39 multi: remove dead code 2019-09-10 17:21:59 +02:00
76f9c9bd52 watchtower/wtclient: remove stale sessionQueue TODO
The state updates that are pending to be acked by the tower are already
loaded within newSessionQueue.
2019-07-30 15:13:17 -07:00
7f48ff6717 watchtower: fix linter errors 2019-06-28 16:10:41 -07:00
fad8932d75 watchtower/multi: fix logging in wtclient 2019-06-19 19:57:59 -07:00
2d47618055 watchtower/multi: define AltruistSessions feature bit as 0/1 2019-06-13 19:54:21 -07:00
ab4a4b77f5 watchtower/wtclient/session_queue: unify logging 2019-06-13 19:54:17 -07:00
1db9bf2fd4 watchtower/wtdb: create embedded ClientSessionBody
This commit splits out the portions of the ClientSession into an
embedded ClientSessionBody, since these fields will be serialized
together on-disk.
2019-05-23 20:47:49 -07:00
5ad9530502 watchtower/wtdb: return sorted ClientSession.CommittedUpdates
This commit replaces the map-based CommittedUpdates field with a slice.
When reading from disk, these will already be sorted by bbolt, so the
client restore the updates as presented without needing to sort them
first.

Since the key in the map variant was the sequence number, we refactor
the CommittedUpdate struct to have a sequence number and an embedded
CommittedUpdateBody (which is equivalent to the old CommittedUpdate).
The database is then expected to populate the sequence number from the
key on disk.

Since the sequence number is now directly integrated in the
CommittedUpdate struct, this allow allows us to remove the now redundant
seqNum argument from CommitUpdate.
2019-05-23 20:47:36 -07:00
8e3a8f2d01 watchtower/wtclient: fix linter issue 2019-03-20 19:36:59 -07:00
aa2b21117c watchtower/wtclient/session_queue: batch upload state updates 2019-03-15 02:32:02 -07:00