Skip to content

Commit 1140444

Browse files
committed
add Announce API for GossipSub message announcement
Implements a new Announce API that allows advertising messages via IHAVE without pushing them to the mesh. These messages are retained in the mcache until, at least, the specified deadline. We send the IHAVE immediately to all connected topic subscribers, whether in mesh, in gossip, in a cached fanout, or none of these active pubsub states. This enables pull-based message distribution, useful for scenarios outside of the app's critical path, such as backup availability. Subscribers can pull messages on-demand via IWANT requests. Further details: - Add Topic.Announce() method that sends IHAVE gossip to topic subscribers with expiry-based message retention - Refactor MessageCache to support dual storage model: - Sliding window for regular published messages - Time wheel for announced messages with TTL-based expiry - Add GossipSubAnnouncementMaxTTL parameter (default 60s) for sizing announcement storage - Rename MessageCache methods for clarity (Put→AppendWindow, Shift→ShiftWindow, GetGossipIDs→GossipForTopic). Add missing godocs. - Implement unified message storage with reference counting to handle messages in both window and announcement wheel - Add heartbeat cleanup for expired announcements via PruneAnns() - Add comprehensive test coverage for announcement functionality including storage, delivery, expiry, duplicates, and edge cases
1 parent ed53c17 commit 1140444

File tree

5 files changed

+882
-63
lines changed

5 files changed

+882
-63
lines changed

0 commit comments

Comments
 (0)