docs: clarify in-memory client contracts
This commit is contained in:
@@ -137,10 +137,12 @@ func newClient(options ...ClientOption) (*Client, error) {
|
||||
}
|
||||
|
||||
// WithAuthDataChanged configures synchronous persistence for in-memory auth updates.
|
||||
// The callback runs under the client's internal login serialization. It must not
|
||||
// call Client methods other than AuthData or acquire a lock that may be held by any
|
||||
// goroutine calling Client. Callers must not call Client while holding a lock that
|
||||
// the callback may acquire. Returning an error leaves authentication unchanged.
|
||||
// The callback runs under the client's internal login serialization and must not
|
||||
// use Client directly or indirectly, including by waiting for a goroutine, future,
|
||||
// channel, or hook whose completion may call Client. It should perform only bounded,
|
||||
// standalone persistence and return. The callback and Client callers must obey lock
|
||||
// ordering: neither may hold a lock needed by the other. Returning an error leaves
|
||||
// authentication unchanged.
|
||||
func WithAuthDataChanged(callback func(AuthData) error) ClientOption {
|
||||
return func(client *Client) error {
|
||||
if callback == nil {
|
||||
|
||||
Reference in New Issue
Block a user