rs-plugin-common-interfaces 0.46.0

Common description for plugin creation
Documentation
use serde::{Deserialize, Serialize};

/// Where a background embedding pass over one library stands.
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq)]
#[serde(rename_all = "camelCase")]
pub enum EmbeddingPassState {
    /// Sent before the model is loaded and, the first time, downloaded.
    Started,
    /// Sent after each media.
    Running,
    Completed,
    /// Left because the library was paused; resuming starts a new pass.
    Paused,
    /// Left because embeddings were turned off for the library, or it was removed.
    Stopped,
    /// Left early after too many failures in a row; a later pass carries on.
    Interrupted,
    /// Could not run, for example because the model cannot be loaded.
    Failed,
}

/// Payload of the `embedding_progress` event. A pass sends `started` once, `running`
/// after each media, then exactly one of `completed`, `paused`, `stopped`,
/// `interrupted` or `failed`.
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct EmbeddingProgressMessage {
    pub library: String,
    pub state: EmbeddingPassState,
    pub embedder: String,
    /// Medias tried so far in this pass.
    pub processed: u64,
    /// Of which embedded; the others failed.
    pub embedded: u64,
    /// Medias this pass covers: those pending when it started, kept in step with
    /// uploads and deletions since. Never below `processed`.
    pub total: u64,
}