Dust SDK — reactive global map client.
Summary
Functions
Returns the WebSocket URL for Dust's hosted cloud service at dustlayer.io.
Coordinated distributed cache-fill — compute fun once across the fleet and
share the result.
Functions
Returns the WebSocket URL for Dust's hosted cloud service at dustlayer.io.
Use as the :url option when starting the supervisor against cloud:
{Dust, stores: ["acme/site"], url: Dust.cloud_url(), token: token, cache: ...}
See Dust.SyncEngine.on/4.
Coordinated distributed cache-fill — compute fun once across the fleet and
share the result.
Returns {:ok, %Dust.Flight{}} or {:error, reason}.
fun receives the held %Dust.Lease{} (or nil on the degraded
:run_local path) and MUST return:
{:publish, value}— storevalueatkeyand return it.valuemust be a small pointer (put the bytes in S3/your DB). Publish a definitive negative (e.g. a genuinely empty result) so the freshness window holds and you don't recompute — classification is domain-specific (an empty page may be definitive; a 404 that will appear later is transient).{:abort, reason}— release the lease, publish nothing, return{:error, reason}. Use this for transient failures so they aren't cached. Prefer{:abort, _}over raising for expected/transient errors: it releases the lease immediately (waiters re-elect at once), whereas a raisedfunonly frees the lease whenlease_ttlexpires (the heartbeat dies with the caller). Inside an Oban worker especially, abort cleanly rather than raise.
Options:
:fresh?—nil(default) = presence mode (key exists ⇒ fresh; for done-forever results). A(value -> boolean)predicate = freshness mode (the value carries its own timestamp; refill when the predicate says so).:lease_ttl— max in-flight fill time before the lease is stealable (default 30s; the lease is heartbeat-renewed whilefunruns).:wait_timeout— max a follower waits for the winner (defaultlease_ttl + 5s).:on_unavailable—:run_local(default; runfununcoordinated, never block — possible duplicate work,coordinated?: false) or:error.:lock_key— the lease key (default a reserved sibling ofkey).
At-least-once, not exactly-once. fun must be idempotent.
See Dust.SyncEngine.on/4.