You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This task (milestone M2) lets the public receiver helpers run against a database that the caller names. The helpers are buffer validation and the two counter (FSIC) functions.
Background & Motivation
The archive receives records the same way that a network server does. It validates incoming buffers, computes its counters, and updates its counters after dequeue. These helpers are public, and hosts call some of them. Thus each helper needs an optional database parameter. If a caller gives no database, the helper keeps the current behavior.
Each helper takes db=None. If the caller gives no handle, the helper uses the routed default handle, so existing callers see no change. If the caller gives a handle, all queries and writes in the helper go to that database.
The dequeue function from #366 passes its handle to the counter update.
Deliverables & Contracts
The task delivers an optional db parameter on these helpers:
With a handle pinned to default2, buffer validation creates Buffer and RecordMaxCounterBuffer rows in default2 and updates records_transferred.
With a handle pinned to default2, the counter update writes DatabaseMaxCounter rows in default2.
On an empty default2, the counter calculation for a receiver in v2 format returns an empty result with sub and super keys.
No test above makes a query to default.
Callers that give no handle see today's behavior.
The characterization suite passes without edits.
Technical Pointers & Architecture
Target Components: morango/sync/utils.py:72 (validate_and_create_buffer_data), morango/models/core.py:655 (update_fsics), :727 (calculate_filter_specific_instance_counters), and the queries at :690-705, :735, and :775.
Tradeoffs & Alternatives Considered: Private functions take a required handle. Public helpers take an optional handle, so that host code keeps working.
Metadata
Complexity: Medium
Target Branch: release-v0.9.x
AI Usage
Drafted with Claude (Claude Code) from the approved design spec and implementation plan. The author reviewed the requirements, and the code references were checked against the release-v0.9.x codebase.
Overview
This task (milestone M2) lets the public receiver helpers run against a database that the caller names. The helpers are buffer validation and the two counter (FSIC) functions.
Background & Motivation
The archive receives records the same way that a network server does. It validates incoming buffers, computes its counters, and updates its counters after dequeue. These helpers are public, and hosts call some of them. Thus each helper needs an optional database parameter. If a caller gives no database, the helper keeps the current behavior.
Design: spec. Plan: implementation plan, Task 6.
Description & Expected Outcomes
Each helper takes
db=None. If the caller gives no handle, the helper uses the routed default handle, so existing callers see no change. If the caller gives a handle, all queries and writes in the helper go to that database.The dequeue function from #366 passes its handle to the counter update.
Deliverables & Contracts
The task delivers an optional
dbparameter on these helpers:validate_and_create_buffer_data.DatabaseMaxCounter.update_fsics.DatabaseMaxCounter.calculate_filter_specific_instance_counters.Acceptance Criteria
default2, buffer validation createsBufferandRecordMaxCounterBufferrows indefault2and updatesrecords_transferred.default2, the counter update writesDatabaseMaxCounterrows indefault2.default2, the counter calculation for a receiver in v2 format returns an empty result withsubandsuperkeys.default.Technical Pointers & Architecture
morango/sync/utils.py:72(validate_and_create_buffer_data),morango/models/core.py:655(update_fsics),:727(calculate_filter_specific_instance_counters), and the queries at:690-705,:735, and:775.SyncDatabasefrom Explicit database handle for sync database access #365.Notes & Tradeoffs
Metadata
AI Usage
Drafted with Claude (Claude Code) from the approved design spec and implementation plan. The author reviewed the requirements, and the code references were checked against the
release-v0.9.xcodebase.