Skip to content

Conversation

@luckfamousa
Copy link

Summary

This PR introduces a plugin system that allows external implementations of DICOMweb services (QIDO-RS, WADO-RS, STOW-RS) via dynamically loaded shared libraries.

Key Changes

  • New dicom-rst-plugin-api crate: Defines FFI-safe plugin traits using abi_stable for C ABI compatibility across Rust compiler versions
  • Plugin loading infrastructure: PluginRegistry in src/backend/plugin/ manages loading and AET bindings
  • Service adapters: Bridge FFI types to internal service traits (PluginQidoAdapter, PluginWadoAdapter, PluginStowAdapter)
  • Configuration support: Plugins configured in config.yaml with path, AETs, and custom settings
  • Example plugin: Demonstrates implementing all three plugin traits
  • Documentation: CLAUDE.md updated with plugin development guide

Plugin Traits

Trait Service Methods
QidoPlugin QIDO-RS search(), health_check()
WadoPlugin WADO-RS retrieve(), render(), metadata(), health_check()
StowPlugin STOW-RS store(), health_check()

Configuration Example

plugins:
  - path: "/path/to/libcustom_plugin.so"
    aets:
      - CUSTOM_PACS
    settings:
      database_url: "postgres://localhost/dicom"

Feature Flag

The plugin system is behind the plugins feature flag:

cargo build --features plugins

Test plan

  • Build with cargo build --features plugins
  • Build example plugin with cargo build -p dicom-rst-example-plugin --release
  • Verify plugin loading at startup
  • Test AET routing to plugin vs built-in backends

🤖 Generated with Claude Code

This adds a plugin system that allows external implementations of
QIDO-RS, WADO-RS, and STOW-RS services via dynamically loaded
shared libraries.

Key changes:
- New `dicom-rst-plugin-api` crate defining FFI-safe plugin traits
- Plugin loading infrastructure in `src/backend/plugin/`
- Service adapters bridging FFI types to internal service traits
- Plugin configuration support in config.yaml
- Example plugin demonstrating the plugin interface
- CLAUDE.md documentation for plugin development

The plugin system uses `abi_stable` for C ABI compatibility across
Rust compiler versions, and `async-ffi` for async operations across
the FFI boundary.

Plugins are configured per-AET and take priority over built-in
backends when a matching AET is found.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
luckfamousa and others added 3 commits December 27, 2025 22:10
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The #[sabi_trait] macro generates impl blocks inside const items which
triggers this warning. This is a known issue with the macro and cannot
be fixed in user code. Suppressing it also fixes the SARIF validation
error caused by duplicate relatedLocations in the clippy output.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The clippy-sarif tool can produce SARIF files with duplicate entries in
relatedLocations arrays, which causes the CodeQL upload action to fail.
This adds a jq step to deduplicate the arrays before uploading.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

clippy found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

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.

3 participants