Skip to content

feat: grpc server with queue management rpcs#5

Merged
vieiralucas merged 5 commits intomainfrom
feat/1-5-grpc-server-queue-management
Feb 11, 2026
Merged

feat: grpc server with queue management rpcs#5
vieiralucas merged 5 commits intomainfrom
feat/1-5-grpc-server-queue-management

Conversation

@vieiralucas
Copy link
Copy Markdown
Member

@vieiralucas vieiralucas commented Feb 11, 2026

Summary

  • Implement fila-server binary with tonic gRPC server serving FilaAdmin service
  • Add CreateQueue and DeleteQueue scheduler command variants with full queue lifecycle management
  • CreateQueue RPC persists to storage, returns ALREADY_EXISTS on duplicate
  • DeleteQueue RPC removes from storage, returns NOT_FOUND if missing
  • Map FilaError variants to appropriate gRPC status codes (NOT_FOUND, ALREADY_EXISTS, INVALID_ARGUMENT, INTERNAL)
  • Config file loading from fila.toml or /etc/fila/fila.toml with defaults
  • Graceful shutdown on SIGINT/SIGTERM
  • Remaining admin RPCs (SetConfig, GetConfig, GetStats, Redrive) stubbed as UNIMPLEMENTED

Test plan

  • 4 new scheduler queue management tests (create, duplicate, delete, delete nonexistent)
  • All 32 tests pass via cargo nextest run
  • cargo clippy -- -D warnings passes
  • cargo fmt --check passes

Summary by cubic

Adds a tonic gRPC server (fila-server) with CreateQueue and DeleteQueue RPCs for queue management. Validates queue config (including visibility_timeout_ms), routes commands through the scheduler, persists to storage, and shuts down cleanly on Ctrl+C or SIGTERM.

  • New Features

    • FilaAdmin with CreateQueue/DeleteQueue; validates empty names, normalizes config (ignores empty scripts, defaults visibility_timeout_ms when unset, rejects <1000 ms), and maps ALREADY_EXISTS/NOT_FOUND/INVALID_ARGUMENT; broker backpressure/unavailability map to RESOURCE_EXHAUSTED/UNAVAILABLE.
    • SchedulerCommand variants with per-command errors; persist/remove queues via storage with oneshot replies; documented single-threaded check-then-put/delete safety for uniqueness and not-found behavior.
    • Server reads config from fila.toml or /etc/fila/fila.toml, uses FILA_DATA_DIR for RocksDB, initializes tracing, and listens on the configured address (default 0.0.0.0:5555); other admin RPCs stubbed as UNIMPLEMENTED.
    • Added unit tests for scheduler queue management and admin service visibility-timeout validation.
  • Bug Fixes

    • Ensure CreateQueue sets config.name to the requested queue name.
    • Graceful shutdown signal handling (Ctrl+C, SIGTERM).

Written for commit 67eec3c. Summary will update on new commits.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 8 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="crates/fila-server/src/main.rs">

<violation number="1" location="crates/fila-server/src/main.rs:72">
P2: shutdown_signal only listens for SIGINT (ctrl_c). SIGTERM won’t trigger graceful shutdown, so systemd/docker stops can hang. Add SIGTERM handling alongside ctrl_c.</violation>
</file>

<file name="crates/fila-core/src/broker/scheduler.rs">

<violation number="1" location="crates/fila-core/src/broker/scheduler.rs:142">
P2: Validate that `config.name` matches the requested queue name (or overwrite it) before persisting, otherwise mismatched configs can be stored under the wrong queue ID.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread crates/fila-server/src/main.rs Outdated
Comment thread crates/fila-core/src/broker/scheduler.rs
@vieiralucas vieiralucas force-pushed the feat/1-4-broker-core-scheduler-loop branch from b33c66e to 792b36c Compare February 11, 2026 12:08
@vieiralucas vieiralucas force-pushed the feat/1-5-grpc-server-queue-management branch 2 times, most recently from 91da999 to 96eea1e Compare February 11, 2026 13:18
@vieiralucas vieiralucas force-pushed the feat/1-4-broker-core-scheduler-loop branch 2 times, most recently from 5ffa754 to fbbd6b0 Compare February 11, 2026 16:10
@vieiralucas vieiralucas force-pushed the feat/1-5-grpc-server-queue-management branch from 96eea1e to a20e922 Compare February 11, 2026 16:10
@vieiralucas vieiralucas force-pushed the feat/1-4-broker-core-scheduler-loop branch from fbbd6b0 to e1f40eb Compare February 11, 2026 16:11
@vieiralucas vieiralucas force-pushed the feat/1-5-grpc-server-queue-management branch 2 times, most recently from a8aefe0 to 957bfed Compare February 11, 2026 16:18
@vieiralucas vieiralucas force-pushed the feat/1-4-broker-core-scheduler-loop branch from e1f40eb to 8060632 Compare February 11, 2026 16:18
@vieiralucas vieiralucas force-pushed the feat/1-5-grpc-server-queue-management branch from 957bfed to d5a678a Compare February 11, 2026 16:21
@vieiralucas vieiralucas force-pushed the feat/1-4-broker-core-scheduler-loop branch from 8060632 to acc9695 Compare February 11, 2026 16:21
Base automatically changed from feat/1-4-broker-core-scheduler-loop to main February 11, 2026 16:22
implement fila-server binary with tonic grpc server serving the
filaadmin service. createqueue and deletequeue rpcs send commands to
the scheduler thread via crossbeam channel with oneshot reply.
includes config file loading (fila.toml), tracing init, graceful
shutdown on sigint, and error mapping from filaerror to grpc status
codes. remaining admin rpcs stubbed as unimplemented.
@vieiralucas vieiralucas force-pushed the feat/1-5-grpc-server-queue-management branch from d5a678a to b40c6e8 Compare February 11, 2026 16:23
Comment thread crates/fila-server/src/admin_service.rs Outdated
Comment thread crates/fila-core/src/broker/scheduler.rs
Comment thread crates/fila-core/src/broker/scheduler.rs
@vieiralucas vieiralucas force-pushed the feat/1-5-grpc-server-queue-management branch from d3d5314 to fc6f597 Compare February 11, 2026 21:03
@vieiralucas vieiralucas force-pushed the feat/1-5-grpc-server-queue-management branch from fc6f597 to 67eec3c Compare February 11, 2026 21:04
@vieiralucas vieiralucas merged commit 4e7e36c into main Feb 11, 2026
4 checks passed
@vieiralucas vieiralucas deleted the feat/1-5-grpc-server-queue-management branch February 11, 2026 21:11
vieiralucas added a commit that referenced this pull request Mar 18, 2026
- apply_to_broker_storage now returns Result and propagates StorageError
  instead of silently swallowing storage failures (cubic #1)
- add DeleteLeaseExpiry mutation in ack/nack replication paths to clean up
  orphaned lease expiry entries (cubic #3)
- fix no-op leased_msg_keys.retain in recovery — now properly clears
  entries for the recovering queue before rebuild (cubic #4)
- warn when create_group is called without broker_storage set (cubic #5)
- check send_command result in watch_leader_changes — only update leading
  state on success so next poll retries on failure (cubic #6, #7)
- trigger RecoverQueue on first-sight leader state to catch messages
  replicated between startup and first poll (cubic #8)
- replace catch-all _ => {} with explicit variant listing in
  apply_to_broker_storage for compiler-enforced exhaustiveness
vieiralucas added a commit that referenced this pull request Mar 18, 2026
- apply_to_broker_storage now returns Result and propagates StorageError
  instead of silently swallowing storage failures (cubic #1)
- add DeleteLeaseExpiry mutation in ack/nack replication paths to clean up
  orphaned lease expiry entries (cubic #3)
- fix no-op leased_msg_keys.retain in recovery — now properly clears
  entries for the recovering queue before rebuild (cubic #4)
- warn when create_group is called without broker_storage set (cubic #5)
- check send_command result in watch_leader_changes — only update leading
  state on success so next poll retries on failure (cubic #6, #7)
- trigger RecoverQueue on first-sight leader state to catch messages
  replicated between startup and first poll (cubic #8)
- replace catch-all _ => {} with explicit variant listing in
  apply_to_broker_storage for compiler-enforced exhaustiveness
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant