Skip to main content

Crate simploxide_ffi_core

Crate simploxide_ffi_core 

Source
Expand description

A fully asynchrouns raw SimpleX client backed by the SimpleX FFI bindings(see simploxide_sxcrt_sys for setup instructions) that provides:

  1. Multi-instance support: run many SimpleX-Chat instances from a single process. Each instance is fully isolated and all are served by a single shared worker thread with fair round-robin scheduling and per-instance execution caps to prevent starvation.

  2. Complete asynchonisity: futures created by the same instance of a client are fully independent from each other. The event queue receives events independently from client actions.

  3. Graceful shutdown with strong guarantees:

    • All commands enqueued before RawClient::disconnect are guaranteed to execute and return their responses.

    • All commands enqueued after RawClient::disconnect are guaranteed to return CallError::Failure without being executed.

    • You will receive events for as long as the chat instance is active. After disconnect the remaining buffered events are delivered and then the event queue closes.


Current implementation heavily depends on tokio runtime and won’t work with other executors.

Modules§

default

Structs§

DbOpts
Database options for a SimpleX chat instance.
DefaultUser
The SimpleX user profile used to initialise the chat instance.
RawClient
A lightweight cheaply clonable client for sending raw requests(SimpleX commands) and receiving raw responses(JSON objects).
RawEventQueue
An event queue that buffers incoming SimpleX events independently of client activity.
SimplexVersion
Parses SimpleX version numbers in the form MAJOR.MINOR.PATCH.HOTFIX.
WorkerConfig
Configuration for the shared FFI worker thread.

Enums§

CallError
InitError
MigrationConfirmation
VersionError
Error returned by RawClient::version.

Functions§

init
Open a SimpleX database with default WorkerConfig and start receiving events.
init_with_config
Open a SimpleX database and start receiving events.

Type Aliases§

Command
Event
EventReceiver
Response
Result