docs(ports): specify cancellation error semantics
- commit
- b6171951e808649582c8abdc725685886483362d
- author
- brice · · 2026-09-30 08:21 UTC
- committer
- brice · · 2026-09-30 14:48 UTC
- parent
- 89662fc
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
1 file · +2 -0
M internal/ports/capture.go +2 -0
| @@ -41,6 +41,7 @@ type Frame struct { | |||
| 41 | 41 | } | |
| 42 | 42 | ||
| 43 | 43 | // Source has one sequential owner; cancellation must interrupt blocked I/O. | |
| 44 | + | // Cancellation errors wrap ctx.Err(), not a custom cancellation cause. | |
| 44 | 45 | // A failed Capture invalidates its borrowed frame. Close is idempotent. | |
| 45 | 46 | type Source interface { | |
| 46 | 47 | Outputs(context.Context) ([]Output, error) | |
| @@ -68,6 +69,7 @@ type VideoSettings struct { | |||
| 68 | 69 | // Write consumes borrowed pixels before returning; it must not queue frames. | |
| 69 | 70 | // Close drains and finalizes the encoder with a bounded shutdown deadline. | |
| 70 | 71 | // Abort interrupts pending writes and is safe concurrently with Write. | |
| 72 | + | // Cancellation errors wrap ctx.Err(); unrelated failures must be preserved. | |
| 71 | 73 | // Write rejects width, height or format changes with ErrGeometryChanged. | |
| 72 | 74 | // Stride changes are allowed. Close and Abort are idempotent terminal operations; | |
| 73 | 75 | // Write after termination returns ErrClosed. Other methods have one owner. | |
| @@ -41,6 +41,7 @@ type Frame struct { | |||||
| 41 | } | 41 | } | ||
| 42 | 42 | ||||
| 43 | // Source has one sequential owner; cancellation must interrupt blocked I/O. | 43 | // Source has one sequential owner; cancellation must interrupt blocked I/O. | ||
| 44 | + | // Cancellation errors wrap ctx.Err(), not a custom cancellation cause. | |||
| 44 | // A failed Capture invalidates its borrowed frame. Close is idempotent. | 45 | // A failed Capture invalidates its borrowed frame. Close is idempotent. | ||
| 45 | type Source interface { | 46 | type Source interface { | ||
| 46 | Outputs(context.Context) ([]Output, error) | 47 | Outputs(context.Context) ([]Output, error) | ||
| @@ -68,6 +69,7 @@ type VideoSettings struct { | |||||
| 68 | // Write consumes borrowed pixels before returning; it must not queue frames. | 69 | // Write consumes borrowed pixels before returning; it must not queue frames. | ||
| 69 | // Close drains and finalizes the encoder with a bounded shutdown deadline. | 70 | // Close drains and finalizes the encoder with a bounded shutdown deadline. | ||
| 70 | // Abort interrupts pending writes and is safe concurrently with Write. | 71 | // Abort interrupts pending writes and is safe concurrently with Write. | ||
| 72 | + | // Cancellation errors wrap ctx.Err(); unrelated failures must be preserved. | |||
| 71 | // Write rejects width, height or format changes with ErrGeometryChanged. | 73 | // Write rejects width, height or format changes with ErrGeometryChanged. | ||
| 72 | // Stride changes are allowed. Close and Abort are idempotent terminal operations; | 74 | // Stride changes are allowed. Close and Abort are idempotent terminal operations; | ||
| 73 | // Write after termination returns ErrClosed. Other methods have one owner. | 75 | // Write after termination returns ErrClosed. Other methods have one owner. | ||