HomePhabricator
Diffusion Comm 0c7d9d47f568

[services] Backup - Rust lib - Add terminate

Description

[services] Backup - Rust lib - Add terminate

Summary:
Depends on D4869

Adding terminating function in rust to be called from the c++.

The goal here is to:

  • spawn a thread in rust that will listen on a thread-safe queue (initialize)
  • schedule some data on this queue (process)
  • gracefully exit the thread and release all resources (terminate)

Later on, in the spawned thread, we will connect to the blob service through the gRPC, but first things first.

I'm probably going to remove all logging before landing, I'm leaving it as is for now.

Test Plan:
In the c++ code:

#include "rust_lib/src/lib.rs.h"
// ...
extern "C" {
void rust_initialize();
void rust_process(const char *data);
void rust_terminate();
}
// ...
std::cout << "CALLING RUST CODE" << std::endl;
rust_initialize();
rust_process("aaa");
rust_process("bbbbb");
rust_process("cccccccccc");
rust_terminate();
std::cout << "CALLED RUST CODE" << std::endl;

Reviewers: tomek, varun, max, jon

Reviewed By: tomek, varun

Subscribers: ashoat, tomek, atul, abosh

Differential Revision: https://phab.comm.dev/D4870

Details

Provenance
karolAuthored on Aug 29 2022, 6:57 AM
Reviewer
tomek
Differential Revision
D4870: [services] Backup - Rust lib - Add terminate
Parents
rCOMMe80a6b5e41db: [services] Backup - Rust lib - Add process
Branches
Unknown
Tags
Unknown