Skip to content

feat(p2p): implement local lookup cache in batched_async_contains#2

Open
jooho-XCENA wants to merge 1 commit into
devfrom
feat/p2p-local-lookup-cache
Open

feat(p2p): implement local lookup cache in batched_async_contains#2
jooho-XCENA wants to merge 1 commit into
devfrom
feat/p2p-local-lookup-cache

Conversation

@jooho-XCENA

Copy link
Copy Markdown
Owner

Summary

  • Implement Tier 1 local lookup cache to skip controller round-trip for previously resolved hashes
  • Update local_lookup_cache after Tier 2 controller lookup succeeds (per-hash granularity)
  • Add reactive invalidation: clear stale cache entries when peer connection fails, then fall through to Tier 2

Details

batched_async_contains had two TODOs for implementing a local lookup cache. This PR:

  1. Checks local_lookup_cache before hitting the controller (Tier 1), counting consecutive hashes on the same peer (prefix-match semantics matching controller logic)
  2. Populates the cache after successful Tier 2 lookups
  3. On peer connection failure, removes all cache entries for that peer and falls through to Tier 2

Test plan

  • Verify P2P integration tests pass
  • Validate Tier 1 cache hit path with repeated lookups
  • Validate reactive invalidation when peer goes down

- Add Tier 1 local lookup cache to skip controller round-trip for
  previously resolved hashes (per-hash, prefix-match semantics)
- Update local_lookup_cache after Tier 2 controller lookup succeeds
- Add reactive invalidation: clear stale cache entries when peer
  connection fails, then fall through to Tier 2
@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had activity within 60 days. It will be automatically closed if no further activity occurs within 30 days.

@github-actions github-actions Bot added the stale label May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant