Function
New
(ctx context.Context, logger slog.Logger, sub pubsub.Subscriber, db database.Store)
Source from the content-addressed store, hash-verified
| 40 | } |
| 41 | |
| 42 | func New(ctx context.Context, logger slog.Logger, sub pubsub.Subscriber, db database.Store) *Watcher { |
| 43 | ctx, cancel := context.WithCancel(ctx) |
| 44 | w := &Watcher{ |
| 45 | logger: logger.Named("wsconnwatcher"), |
| 46 | ctx: ctx, |
| 47 | cancel: cancel, |
| 48 | sub: sub, |
| 49 | db: db, |
| 50 | } |
| 51 | go func() { |
| 52 | <-ctx.Done() |
| 53 | w.Close() |
| 54 | }() |
| 55 | return w |
| 56 | } |
| 57 | |
| 58 | // @Summary Workspace Agent Connection Watch |
| 59 | // @ID workspace-agent-connection-watch |