Shared reader for chunks of queued buffers

未关闭
#368 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
68/100
Issue 类型
重构
描述清晰度
描述清楚
活跃度
活跃
技术栈
django, postgresql, python
领域
backend, database

调研方向

First check the dependency in #365, then read morango/sync/operations.py:1480-1521 and the BufferSerializer pattern in morango/api/serializers.py. Verify the characterization suite from #363 and #364, including the offset, ordering, and rmcb_list requirements. Done means the network push preserves behavior and tox -e postgres passes without test edits.

由索引模型根据 Issue 内容生成。

描述

DEV: backend P0 - critical TAG: tech update / debt

Overview

This task (milestone M2) moves the code that reads one chunk of queued buffers out of the network push operation. The result is one reader that the shared push operation uses for every connection type.

Background & Motivation

A push reads queued buffers in chunks and sends each chunk to the peer. Today this read is inside NetworkPushTransferOperation, and it uses the default database. The shared push operation in #374 needs the same read for network and disk peers.

Design: spec. Plan: implementation plan, Task 7.

Description & Expected Outcomes

A private function returns the serialized buffers of one transfer session for an offset and a chunk size. It orders the buffers by primary key, and each item includes its record max counter list. The function reads from the database handle that the caller gives. The network push operation uses this function with the context database.

Deliverables & Contracts

The task delivers:

  • _serialize_buffer_chunk(transfer_session, offset, chunk_size, db), with db required.
  • A network push operation that uses this function, with no change in behavior.
Acceptance Criteria
  • With 5 buffers, an offset of 2, and a chunk size of 2, the function returns the 3rd and 4th buffers by primary key.
  • Each returned item has an rmcb_list.
  • The characterization suite passes without edits.

Technical Pointers & Architecture

  • Target Components: morango/sync/operations.py:1480-1521 (NetworkPushTransferOperation.handle).
  • Related Patterns: BufferSerializer in morango/api/serializers.py.
  • Data Model & Schema Considerations: None.
  • Resilience & Failure Modes: None.

Notes & Tradeoffs

  • Dependencies: Blocked by: #365 (Explicit database handle for sync database access). Blocks: #374.
  • Testing Requirements: This is a refactor. The characterization suite from #363 and #364 must pass without edits. Run tox -e postgres at the end of milestone M2.

Metadata

  • Complexity: Low
  • 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.

主要语言
Python
星标
15
派生
27
平均合并
6 天 44 分钟
30 天内合并 PR
13

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

learningequality/morango 的其他 Issue

查看 learningequality/morango 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。