mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 06:00:46 -05:00
Replace the unbounded fixed thread pool with a bounded worker queue, sized by floci.services.cloudcontrol.create-worker-threads (default 4) and create-queue-capacity (default 64). These are Floci limits, not AWS quotas. A new CreateResource past them is refused with ThrottlingException, HTTP 400, which is the status the Cloud Control API reference gives it on CreateResource and in Common Errors. The pending token is dropped so it is not left unfulfillable. Startup replay of persisted CREATE requests does not apply that bound. When the worker queue is full, an already-accepted request is parked and handed to the executor by a daemon drainer once a slot frees, instead of blocking the request that constructs Cloud Control until a provisioning task finishes. Shutdown interrupts the drainer; parked requests stay persisted and replay on the next start. A create that fails while Cloud Control is shutting down is no longer recorded as FAILED. Shutdown interrupts in-flight provisioning, so the failure is the shutdown's: the request stays IN_PROGRESS and replays on the next start, like the queued and parked ones. Worker threads are now numbered. Narrow the persisted-state parse catch so a submission failure is no longer misreported as invalid JSON. Document the limit and both settings.
3.7 KiB
3.7 KiB
Cloud Control API
Protocol: JSON 1.1 (X-Amz-Target: CloudApiService.*)
Endpoint: POST http://localhost:4566/
Cloud Control provides a uniform CRUD(L) surface over CloudFormation resource types
(AWS::S3::Bucket, AWS::EC2::Instance, ...) instead of a bespoke API per service.
Floci's emulator reuses the same resource provisioner CloudFormation stacks call, so a
resource behaves consistently whether it's provisioned by a stack or directly through
Cloud Control.
Supported Operations
| Operation | Description |
|---|---|
CreateResource |
Provision a resource of the given TypeName from a DesiredState JSON document |
DeleteResource |
Delete a resource by TypeName and Identifier |
GetResource |
Read a resource's current properties by TypeName and Identifier |
ListResources |
List resources of a TypeName |
GetResourceRequestStatus |
Poll a CreateResource/DeleteResource request by its token |
Behavior
- Asynchronous create/delete:
CreateResourcereturns anIN_PROGRESSProgressEventand a request token immediately; provisioning runs in the background. PollGetResourceRequestStatuswith the token until the status isSUCCESSorFAILED.DeleteResourceis synchronous (deletes are fast enough not to need polling) but still returns aProgressEventfor API-shape consistency. - Create backpressure: creates run on 4 workers with room for 64 more queued, both
set in Configuration. This is a Floci limit, not an AWS quota. A
CreateResourcebeyond that fails withThrottlingException(HTTP 400) and no request token; the AWS SDKs retry it automatically. Outsidememorystorage mode, creates stillIN_PROGRESSwhen Floci stopped are replayed on the next start, even past that limit. ListResources/GetResourcetype coverage: the read side listsAWS::S3::Bucket,AWS::EC2::VPC,AWS::EC2::Subnet,AWS::EC2::SecurityGroup,AWS::EC2::Instance,AWS::EC2::LaunchTemplate,AWS::IAM::Role,AWS::IAM::User, andAWS::IAM::InstanceProfile.CreateResourceaccepts any type the underlying CloudFormation resource provisioner supports (the same set stacks can provision), which is broader than the read side. A resource created through Cloud Control but outside the read-side type list is still readable viaGetResource, from create-time state, but will not appear inListResources.ListResourceson an unlisted type:TypeNamevalues outside the list above fail withUnsupportedActionException(HTTP 400) instead of returning an emptyResourceDescriptions. This applies to any type Floci does not enumerate on the read side, whether or not the type is real in AWS, since Floci has no CloudFormation type registry to tell the two apart.- Delete needs create-time state: types whose delete depends on attributes
captured at create time (currently
AWS::EKS::NodegroupandAWS::IAM::Policy, plus anyCustom::*/AWS::CloudFormation::CustomResource) failDeleteResourcewith a clear error if that state isn't held, rather than reportingSUCCESSover a resource that's still there. - No account context: Cloud Control requests don't carry an account id; Floci uses
its default test account (
000000000000) for all resources.
Configuration
| Variable | Default | Description |
|---|---|---|
FLOCI_SERVICES_CLOUDCONTROL_ENABLED |
true |
Enable or disable the service |
FLOCI_SERVICES_CLOUDCONTROL_CREATE_WORKER_THREADS |
4 |
Threads that run CreateResource provisioning |
FLOCI_SERVICES_CLOUDCONTROL_CREATE_QUEUE_CAPACITY |
64 |
Creates that may wait for a free thread; past that a new CreateResource fails with ThrottlingException |