Skip to content

Commit 0fa9998

Browse files
committed
Update comments for watchtower interface methods
1 parent 485f615 commit 0fa9998

File tree

1 file changed

+29
-11
lines changed

1 file changed

+29
-11
lines changed

wtclient_client.go

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,40 @@ import (
1313
type WatchtowerClientClient interface {
1414
ServiceClient[wtclientrpc.WatchtowerClientClient]
1515

16+
// AddTower adds a new watchtower reachable at the given address and
17+
// considers it for new sessions. If the watchtower already exists, then
18+
// any new addresses included will be considered when dialing it for
19+
// session negotiations and backups.
1620
AddTower(ctx context.Context, pubkey []byte, address string) error
1721

18-
// Sets the given tower's status to inactive so that it's not considered
19-
// for session negotiation. Returns a human readable status string.
22+
// DeactivateTower sets the given tower's status to inactive so that it
23+
// is not considered for session negotiation. Its sessions will also not
24+
// be used while the tower is inactive.
2025
DeactivateTower(ctx context.Context, pubkey []byte) (string, error)
2126

27+
// GetTowerInfo gets information about a watchtower that corresponds to the
28+
// given pubkey. The `includeSessions` flag controls whether session information is
29+
// included. The `excludeExhaustedSessions` controls whether exhausted sessions
30+
// are included in the response.
2231
GetTowerInfo(ctx context.Context, pubkey []byte, includeSessions,
2332
excludeExhaustedSessions bool) (*wtclientrpc.Tower, error)
2433

34+
// ListTowers gets information about all registered watchtowers. The
35+
// `includeSessions` and `excludeExhaustedSessions` flags serve the same function as
36+
// in the `GetTowerInfo` method.
2537
ListTowers(ctx context.Context, includeSessions,
2638
excludeExhaustedSessions bool) ([]*wtclientrpc.Tower, error)
2739

40+
// Policy returns the active watchtower client policy configuration.
2841
Policy(ctx context.Context, policyType wtclientrpc.PolicyType) (*PolicyResponse, error)
2942

43+
// RemoveTower removes a watchtower from being considered for future session
44+
// negotiations and from being used for any subsequent backups until it's added
45+
// again. If an address is provided, then this RPC only serves as a way of
46+
// removing the address from the watchtower instead.
3047
RemoveTower(ctx context.Context, pubkey []byte, address string) error
3148

49+
// Stats returns the in-memory statistics of the client since startup.
3250
Stats(ctx context.Context) (*StatsResponse, error)
3351

3452
// Terminates the given session and marks it to not be used for backups
@@ -83,10 +101,10 @@ func (m *wtClientClient) RawClientWithMacAuth(
83101
return m.wtClientMac.WithMacaroonAuth(parentCtx), m.timeout, m.client
84102
}
85103

86-
// AddTower adds a new watchtower reachable at the given address and considers
87-
// it for new sessions. If the watchtower already exists, then any new addresses
88-
// included will be considered when dialing it for session negotiations and
89-
// backups.
104+
// AddTower adds a new watchtower reachable at the given address and
105+
// considers it for new sessions. If the watchtower already exists, then
106+
// any new addresses included will be considered when dialing it for
107+
// session negotiations and backups.
90108
func (m *wtClientClient) AddTower(ctx context.Context, pubkey []byte, address string) error {
91109
rpcCtx, cancel := context.WithTimeout(ctx, m.timeout)
92110
defer cancel()
@@ -105,9 +123,9 @@ func (m *wtClientClient) AddTower(ctx context.Context, pubkey []byte, address st
105123
return nil
106124
}
107125

108-
// DeactivateTower sets the given tower's status to inactive so that it is not
109-
// considered for session negotiation. Its sessions will also not be used while
110-
// the tower is inactive.
126+
// DeactivateTower sets the given tower's status to inactive so that it
127+
// is not considered for session negotiation. Its sessions will also not
128+
// be used while the tower is inactive.
111129
func (m *wtClientClient) DeactivateTower(ctx context.Context, pubkey []byte) (string, error) {
112130
rpcCtx, cancel := context.WithTimeout(ctx, m.timeout)
113131
defer cancel()
@@ -226,8 +244,8 @@ func (m *wtClientClient) Stats(ctx context.Context) (*StatsResponse, error) {
226244
}, nil
227245
}
228246

229-
// Terminate terminates the given session and marks it as terminal so that it is
230-
// not used for backups anymore.
247+
// Terminates the given session and marks it to not be used for backups
248+
// anymore. Returns a human readable status string.
231249
func (m *wtClientClient) TerminateSession(ctx context.Context, sessionId []byte) (string, error) {
232250
rpcCtx, cancel := context.WithTimeout(ctx, m.timeout)
233251
defer cancel()

0 commit comments

Comments
 (0)