c_mcai_worker_sdk

Crates.ioc_mcai_worker_sdk
lib.rsc_mcai_worker_sdk
version1.0.0-rc1
sourcesrc
created_at2020-11-03 09:35:54.838354
updated_at2021-02-10 09:13:58.345484
descriptionAMQP Worker to listen and provide trait to process message
homepagehttps://github.com/media-cloud-ai/mcai_worker_sdk
repositoryhttps://github.com/media-cloud-ai/mcai_worker_sdk
max_upload_size
id308213
size133,358
Marc-Antoine ARNAUD (MarcAntoine-Arnaud)

documentation

https://docs.rs/py_mcai_worker_sdk

README

C/C++ binding for Rust AMQP Worker

Based on rs_amqp_worker.

Build Status Coverage Status

Build

To build the rust application

cargo build

To build the provided worker example

gcc -c -Wall -Werror -fpic worker.cpp
gcc -shared -o libworker.so worker.o

Test

To run the unit tests, you must build the provided worker example (see the Build section above).

cargo test

Usage

This worker uses Rust FFI to load a C/C++ Shared Object library, and to execute it. The C/C++ worker must implement some functions to be correctly bound:

  • char* get_name(): to retrieve the worker name
  • char* get_short_description(): to retrieve a short description of the worker
  • char* get_description(): to describe the worker purpose
  • char* get_version(): to retrieve the worker version
  • unsigned int get_parameters_size(): to return the number of parameter, before calling...
  • void get_parameters(Parameter*) : to fill the allocated pointer with the worker parameters
  • int process(void*, char* (*)(void*, const char*), void* ()(void*, unsigned char), void* (*)(const char*, const char*), const char**, const char***): to execute the worker process

For more details, see the provided worker.cpp example.

Set the WORKER_LIBRARY_FILE environment variable to specify the path of your C/C++ worker shared-library. Otherwise, the libworker.so file will be loaded by default.

Commit count: 555

cargo fmt