Rust Object Storage Plugin

41 views
Skip to first unread message

Andrew Webber

unread,
Nov 21, 2022, 4:14:46 PM (6 days ago) Nov 21
to Orthanc Users
Hello everyone,

finally got round to finding some spare side-project time and wanted to share this showcase for anyone interested.

The sample shows change notifications and implements S3 storage as a "StorageArea". Integration is performed using the C/C++ SDK.


Apologies in advance if the README is lacking. 

kind regards,

Andrew

orthanc_s3.png

Sébastien Jodogne

unread,
Nov 23, 2022, 12:51:06 PM (4 days ago) Nov 23
to Orthanc Users
Dear Andrew,

This is a great achievement! Thanks for sharing!

I have just indexed your plugin in the Orthanc Book:

I would look forward to a talk about this topic at the next edition of the Orthanc conference ;-)

Regards,
Sébastien-

Tran Phong

unread,
Nov 25, 2022, 5:00:43 AM (3 days ago) Nov 25
to Orthanc Users
Hi Andrew,
That's very interesting. May I ask that the RUST code is binded into the C++ order it is compiled to native lib which is compatible with C++ ? 

Andrew Webber

unread,
Nov 25, 2022, 6:25:03 AM (3 days ago) Nov 25
to Orthanc Users
Hi tdpar...,

The Rust code must first be complied to a system dynamic library
  • --crate-type=cdylib, #![crate_type = "cdylib"] - A dynamic system library will be produced. This is used when compiling a dynamic library to be loaded from another language. This output type will create *.so files on Linux, *.dylib files on macOS, and *.dll files on Windows.

The Rust code is actually loaded dynamically into memory by Orthanc via the plugin architecture.

The Rust plugin only needs to be compiled with a C runtime version that matches the same C runtime version used by the Orthanc installation.

For example on an ubuntu machine:
ldd --version
ldd (Ubuntu GLIBC 2.31-0ubuntu9.9) 2.31

On an Arch Linux machine:
ldd --version
ldd (GNU libc) 2.36

kind regards,

Andrew

Walco van Loon

unread,
Nov 25, 2022, 7:01:23 AM (3 days ago) Nov 25
to Orthanc Users
Hi Andrew,

Thanks for sharing! I had attempted a simple plugin before, but Rust FFI is not for the uninitiated, I learned quite a lot when checking out your code.
Am I correct in assuming the bindgen approach could be extended into a base library that would allow others to create pure (safe) Rust plugins?

Regards
Walco

On Monday, November 21, 2022 at 10:14:46 PM UTC+1 andrew...@googlemail.com wrote:

Andrew Webber

unread,
Nov 26, 2022, 4:17:11 PM (yesterday) Nov 26
to Orthanc Users
Hi Walco,

I updated the sample to use a public dependency which contains the pre-generated bindings.

This should hopefully make plugin development easier for you.

As shown below one can simply add this dependency.

[dependencies]
orthanc-plugin-bindings = "0.1"

kind regards,

Andrew
Reply all
Reply to author
Forward
0 new messages