Skip to main content

Starfish durable offline write-queue — dedup-by-id, claim, retry, reconnect-drain, persisted per identity, framework-free

Project description

starfish-outbox

A durable, per-identity offline write-queue — the client-side complement to the server-side queuing extension.

Generic over the queued item: you own what an item is, supply its dedup id, and a send that performs the real write. The queue handles persistence (write-through to a LocalCache), dedup-by-id, single-shot claim (no double-send), attempt counting with auto-retry-then-fail, crash-safe recovery of stuck sending entries, and subscriptions. drain_outbox is connectivity-agnostic — you trigger it on whatever reconnect signal you have.

Install

pip install starfish-outbox

Usage

from starfish_outbox import OutboxQueue, drain_outbox

queue: OutboxQueue = OutboxQueue(local_cache)  # local_cache: async get_item / set_item / remove_item
await queue.hydrate(f"outbox.{user_id}")

# Enqueue a write while offline (the id is yours to thread into the eventual write):
await queue.enqueue(write_id, {"path": path, "body": body})

# Drain on reconnect:
async def send(entry):
    await client.push(entry.item["path"], entry.item["body"], base_hash_for(entry.item["path"]))

await drain_outbox(queue, send, max_attempts=5)

Mutating methods (enqueue / claim / remove / retry / …) are async because each writes through to the cache; get / pending / subscribe are synchronous. JSON-compatible on disk with the TypeScript @drakkar.software/starfish-outbox.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

starfish_outbox-3.0.0a22.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

starfish_outbox-3.0.0a22-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file starfish_outbox-3.0.0a22.tar.gz.

File metadata

  • Download URL: starfish_outbox-3.0.0a22.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for starfish_outbox-3.0.0a22.tar.gz
Algorithm Hash digest
SHA256 757a2cd4bc5890eca33930340922c5dfc48e69577e3f51ba2419aa7f96eca6a2
MD5 ae650fd378fa3b3b4e2eabb185643910
BLAKE2b-256 78b854d1cfd265fb88e101a285acd37910a6a2e7d3b3489aebb2297207396bec

See more details on using hashes here.

File details

Details for the file starfish_outbox-3.0.0a22-py3-none-any.whl.

File metadata

  • Download URL: starfish_outbox-3.0.0a22-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for starfish_outbox-3.0.0a22-py3-none-any.whl
Algorithm Hash digest
SHA256 6b4877b3f9c6c254d79e98aa4c19a4faf5f2460a3168f0ff59ff2ba873480139
MD5 3baafd4754037199ef00d2f3c981e460
BLAKE2b-256 185e76be2cfc2d53e78917ed02acec4ba625df12bbcc44d095cefa0b73879ef5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page