Skip to content

refactor: redesign basic query templates as RESTful resources with pagination - #46

Merged
codeasier merged 1 commit into
mainfrom
feat/restful-basic-query-templates
Apr 18, 2026
Merged

codeasier merged 1 commit into
mainfrom
feat/restful-basic-query-templates

Conversation

@codeasier

Copy link
Copy Markdown
Owner

Summary

  • Replace 4 specialized basic templates (active_blocks, blocks_by_size, events_by_action, memory_timeline) with 3 RESTful-style resource templates (block, event, allocation)
  • All three templates now support offset parameter for pagination
  • block: all fields support equality; size/allocEventId/freeEventId additionally support range; removes state filter; address output type changed from hex to int
  • event: all fields support equality; id additionally supports range
  • allocation: returns only (id, allocated, active, reserved) for timeline charts; removes action parameter and column

Test plan

  • pytest -v passes (225 passed, 1 pre-existing unrelated failure)
  • pt-snap query --list shows the 3 new basic templates
  • pt-snap query --template-use block --device 0 --min_size 1048576 --limit 10 works
  • pt-snap query --template-use event --device 0 --action 4 --limit 50 --offset 10 works
  • pt-snap query --template-use allocation --device 0 --min_id 0 --max_id 1000 works
  • README and docs reflect new template names and usage

Closes #45

…gination

Replace 4 specialized templates (active_blocks, blocks_by_size,
events_by_action, memory_timeline) with 3 generic resource-style
templates (block, event, allocation):

- block: all fields support equality; size/allocEventId/freeEventId
  additionally support range (min_*/max_*); removes state filter;
  address output type changed from hex to int
- event: all fields support equality; id additionally supports range;
  includes offset for pagination
- allocation: returns (id, allocated, active, reserved) for timeline
  charts; removes action parameter and column; includes offset

All three templates now support offset parameter alongside limit.

Closes #45
@codeasier
codeasier force-pushed the feat/restful-basic-query-templates branch from 295acbb to e3a977e Compare April 18, 2026 14:20

@codeasier codeasier left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@codeasier
codeasier merged commit bc93247 into main Apr 18, 2026
5 checks passed
@codeasier
codeasier deleted the feat/restful-basic-query-templates branch April 18, 2026 14:22
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.

[FEATURE] RESTful 风格通用基础查询模板重构,支持分页和字段过滤改进

1 participant