Creates a new ShardCoordinator instance
Durable Object state provided by Cloudflare runtime
Atomically decrements the key count for a specific shard and updates the last modified timestamp. Used when primary keys are removed or moved from a shard. Prevents negative counts.
The shard binding name to decrement
Promise that resolves when the count is updated
Handles HTTP requests to the Durable Object
Main entry point for all HTTP requests to the ShardCoordinator. Routes requests based on method and path to appropriate handler functions.
Supported endpoints:
The incoming HTTP request
Promise resolving to HTTP response
Atomically increments the key count for a specific shard and updates the last modified timestamp. Used when new primary keys are assigned to a shard.
The shard binding name to increment
Promise that resolves when the count is updated
Durable Object for coordinating shard allocation and maintaining statistics
The ShardCoordinator is a Cloudflare Durable Object that provides centralized coordination for shard allocation across multiple D1 databases. It maintains state about available shards, allocation strategies, and usage statistics.
Key responsibilities:
Example