Skip to main content

Crate queue_core

Crate queue_core 

Source
Expand description

§flusso-queue-core

A generic work-queue abstraction for the sync pipeline — domain-agnostic, so the backend swaps without touching pipeline code.

§Quick reference

ItemRole
ProducerPublishes work items
ConsumerReceives them, one Delivery at a time
DeliveryA received item plus its AckHandle
AckHandleConfirms (or returns) a delivery — ack / nack

Generic over the payload T, so it depends on neither the source, the sink, nor the engine. Both backends drive the same engine loop: recv → process → ack.

The point of the abstraction is a swappable backend:

  • In-process tokio channels (see queue-channel) for single-node runs. Acking is a no-op there — durability comes from the source (the replication slot), and the bounded channel gives backpressure.
  • A durable broker (e.g. NATS JetStream) later, where AckHandle::ack becomes a real server acknowledgement and the queue itself is the durability boundary for the work pipeline.

ℹ️ Info — because AckHandle models the ack identically, the engine loop is unchanged whichever backend backs it; only the durability guarantee shifts.

Structs§

Delivery
A received item paired with the handle that confirms or returns it.

Enums§

QueueError
Why a queue operation failed.

Traits§

AckHandle
Confirms or returns a single delivery. Backend-specific: a no-op for in-memory channels, a server acknowledgement for a durable broker.
Consumer
Pulls work items from a queue for processing.
Producer
Publishes work items onto a queue. Cloneable backends let many producers share one queue.

Type Aliases§

Result
Result alias for queue operations.