8000 feat: record capture records as they arrive by tomrford · Pull Request #43 · tomrford/gocan · GitHub
[go: up one dir, main page]

Skip to content

feat: record capture records as they arrive - #43

Merged
tomrford merged 1 commit into
mainfrom
feat/capture-recorder
Aug 20, 2026
Merged

tomrford merged 1 commit into
mainfrom
feat/capture-recorder

Conversation

@tomrford
@tomrford tomrford commented Aug 19, 2026 •
Copy link
Copy Markdown
Owner

Summary

  • add a recorder task that delivers capture records to a RecordWriter from a cursor
  • expose cursor, stop, completion, and error state in the same style as cyclic tasks
  • write the initial retained window synchronously and write a final window during ordered shutdown

Contract

The task owns delivery only. The caller owns writer flushing, closing, rotation, and capture retention. Its cursor marks records accepted by the writer, not durable storage, so pruning requires a successful writer flush or commit.

To record through shutdown, stop capture producers, stop the recorder, then flush or close the writer.

Verification

  • go vet ./...
  • go test ./...
  • go test -race ./...

Note

Medium Risk
New concurrent delivery path around capture retention and writer errors; mis-timed pruning or flush relative to Cursor could drop or duplicate records in production wiring.

Overview
Adds a new recorder package with a Task that continuously hands Capture records to a gocan.RecordWriter by polling on an interval and advancing via WriteRecordsSince, without blocking appends.

Start writes the initial retained window synchronously (from a caller-chosen cursor), then runs a background loop until stop, writer error, or ErrCursorOutOfRange after capture discard (e.g. Clear). Stop is idempotent and performs one final pass so late appends are not lost. Cursor, Done, and Err mirror the cyclic task style; the cursor reflects writer acceptance, not durable storage.

Tests cover in-order recording, partial progress on initial writer failure, shutdown final window, and termination when the capture can no longer place the cursor.

Reviewed by Cursor Bugbot for commit fbf306a. Configure here.

@tomrford
tomrford force-pushed the feat/capture-recorder branch from a85ff31 to d2209e6 Compare August 19, 2026 18:44
@tomrford
tomrford merged commit caaa03c into main Aug 20, 2026
1 check passed
@tomrford
tomrford deleted the feat/capture-recorder branch August 20, 2026 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0