Skip to content

sds: Implement logic for tracking sent messages #2229

@adklempner

Description

@adklempner

Implement logic for sending and delivering messages.

Key implementation tasks:

  1. Create message preparation function that:

    • Increments and assigns Lamport timestamp for the channel
    • Extracts recent message IDs from local log for causal history
    • Gets current serialized Bloom filter state
    • Generates unique message ID
    • Assembles complete Message object
  2. Implement outgoing message handling:

    • Add message to unacknowledged outgoing buffer for channel
    • Track message state for acknowledgment/retry
    • Handle buffer size limits and cleanup
    • Maintain message ordering guarantees
  3. Add broadcast mechanism that:

    • Supports multiple transport methods
    • Handles serialization of Message object
    • Provides proper error handling
    • Includes retry logic for failed sends
    • Supports test environment simulation
  4. Implement message delivery logic:

    • Update local Lamport timestamp based on received message timestamp
    • Sort messages by Lamport timestamp
    • Break timestamp ties using messageID comparison
    • Insert messages into local log maintaining order
    • Trigger delivery callbacks/events
    • Handle delivery of buffered messages when dependencies are met
  5. Create test infrastructure:

    • Mock transport layer
    • Verify message preparation correctness
    • Test causal history extraction
    • Validate Lamport timestamp behavior
    • Confirm proper buffer management
    • Test message ordering and delivery sequences
    • Verify tie-breaking behavior

The implementation should maintain causal ordering guarantees while being resilient to network issues and message delivery failures.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions