Skip to content

Feat/snapshot registry 976#1031

Open
Miracle656 wants to merge 3 commits intodotandev:mainfrom
Miracle656:feat/snapshot-registry-976
Open

Feat/snapshot registry 976#1031
Miracle656 wants to merge 3 commits intodotandev:mainfrom
Miracle656:feat/snapshot-registry-976

Conversation

@Miracle656
Copy link
Copy Markdown
Contributor

================================================================================
TITLE:

feat(debug): Add SnapshotRegistry Interface - Issue #976

================================================================================
DESCRIPTION:

Overview

Implements a centralized SnapshotRegistry interface in internal/debug for storing and retrieving snapshots fetched
during a session, decoupling UI components from storage implementation.

Changes

Core Implementation

  • SnapshotRegistry: New interface defined in internal/debug/registry.go

    • Add(id string, snap *snapshot.Snapshot) — stores a snapshot by ID
    • Get(id string) (*snapshot.Snapshot, bool) — retrieves a snapshot by ID
    • ListIDs() []string — returns all stored IDs in insertion order
    • Clear() — removes all snapshots from the registry
  • snapshotRegistry: Private in-memory implementation of the interface

    • sync.RWMutex for safe concurrent access
    • Insertion-order preserved via a separate ordering slice
    • Overwrites existing entry on duplicate ID without changing order
  • Factory Function: NewSnapshotRegistry() returns a ready-to-use registry

    • Returns the interface type, keeping the implementation private
    • Zero dependencies beyond internal/snapshot

Security Properties

  • No key material or sensitive data stored
  • Concurrent-safe via read/write mutex
  • No external I/O — purely in-memory

Related Issues

Closes #976

Type of Change

  • New feature
  • Bug fix
  • Breaking change
  • Documentation update

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Interface is clean and well-documented
  • Decouples UI from storage implementation
  • No new linting issues
  • Changes verified locally

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 27, 2026

@Miracle656 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@dotandev
Copy link
Copy Markdown
Owner

dotandev commented Apr 3, 2026

fix ci and conflicts.

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.

[TIME-TRAVEL] [FEAT] Create SnapshotRegistry interface in internal/debug

2 participants