{"id":18976310,"url":"https://github.com/quickwit-oss/witty-actors","last_synced_at":"2025-04-19T17:12:50.661Z","repository":{"id":171126835,"uuid":"647488736","full_name":"quickwit-oss/witty-actors","owner":"quickwit-oss","description":null,"archived":false,"fork":false,"pushed_at":"2023-10-18T10:16:05.000Z","size":81,"stargazers_count":5,"open_issues_count":3,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T10:43:32.339Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/quickwit-oss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-30T22:30:32.000Z","updated_at":"2025-01-14T01:17:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"473b5bf0-978d-40dd-b918-a34234e96e98","html_url":"https://github.com/quickwit-oss/witty-actors","commit_stats":null,"previous_names":["valyagolev/witty-actors"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quickwit-oss%2Fwitty-actors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quickwit-oss%2Fwitty-actors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quickwit-oss%2Fwitty-actors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quickwit-oss%2Fwitty-actors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/quickwit-oss","download_url":"https://codeload.github.com/quickwit-oss/witty-actors/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249228271,"owners_count":21233852,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T15:23:31.137Z","updated_at":"2025-04-16T10:31:37.844Z","avatar_url":"https://github.com/quickwit-oss.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"Forked from https://github.com/quickwit-oss/quickwit/blob/83041f78a21072df091f6d945cc1b5859cf72326/quickwit/quickwit-common/ .\n\nProbably will be maintained in the future.\n\nDocs: https://docs.rs/witty-actors\n\n# Quickwit actors\n\nYet another actor crate for rust.\nThis crate exists specifically to answer quickwit needs.\nThe API may change in the future.\n\n## Objective\n\n- Producing easy-to-reason with code: Quickwit's indexing pipeline is complex as it is.\n- Easy to test actors.\n- Control over the runtime.\n\n## Non-objective\n\n- High number of message throughput. Most of message exchanged in quickwit\n  are \"large\". For instance, it can hold a temp directory with gigabytes worth of data.\n  The actor dealing with the highest number of messages are the indexer and sources.\n  One message then typically holds a batch of records.\n\n# Features\n\n- Actor message box\n- The framework is meant to run asynchronous actors by default, but it can also run actors that are blocking for long amount of time. The message handler methods are technically asynchronous in both case, but the `Actor::runner` method makes it possible to run an actor with blocking code on a dedicated thread.\n- A scheduler actor that makes it possible to mock simulate time.\n\n# Example\n\n```rust\nuse std::time::Duration;\nuse async_trait::async_trait;\nuse quickwit_actors::{Handler, Actor, Universe, ActorContext, ActorExitStatus, Mailbox};\n\n#[derive(Default)]\nstruct PingReceiver;\n\nimpl Actor for PingReceiver {\n    type ObservableState = ();\n    fn observable_state(\u0026self) -\u003e Self::ObservableState {}\n}\n\n#[async_trait]\nimpl Handler\u003cPing\u003e for PingReceiver {\n    type Reply = String;\n    async fn handle(\n        \u0026mut self,\n        _msg: Ping,\n        _ctx: \u0026ActorContext\u003cSelf\u003e,\n    ) -\u003e Result\u003cString, ActorExitStatus\u003e {\n        Ok(\"Pong\".to_string())\n    }\n}\n\nstruct PingSender {\n    peer: Mailbox\u003cPingReceiver\u003e,\n}\n\n#[derive(Debug)]\nstruct Loop;\n\n#[derive(Debug)]\nstruct Ping;\n\n#[async_trait]\nimpl Actor for PingSender {\n    type ObservableState = ();\n    fn observable_state(\u0026self) -\u003e Self::ObservableState {}\n\n    async fn initialize(\u0026mut self, ctx: \u0026ActorContext\u003cSelf\u003e) -\u003e Result\u003c(),ActorExitStatus\u003e {\n        ctx.send_self_message(Loop).await?;\n        Ok(())\n    }\n}\n\n#[async_trait]\nimpl Handler\u003cLoop\u003e for PingSender {\n    type Reply = ();\n\n    async fn handle(\n        \u0026mut self,\n        _: Loop,\n        ctx: \u0026ActorContext\u003cSelf\u003e,\n    ) -\u003e Result\u003c(), ActorExitStatus\u003e {\n        let reply_msg = ctx.ask(\u0026self.peer, Ping).await.unwrap();\n        println!(\"{reply_msg}\");\n        ctx.schedule_self_msg(Duration::from_secs(1), Loop).await;\n        Ok(())\n    }\n}\n\n#[tokio::main]\nasync fn main() {\n    let universe = Universe::new();\n\n    let (recv_mailbox, _) =\n        universe.spawn_actor(PingReceiver::default()).spawn();\n\n    let ping_sender = PingSender { peer: recv_mailbox };\n    let (_, ping_sender_handler) = universe.spawn_actor(ping_sender).spawn();\n\n    ping_sender_handler.join().await;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquickwit-oss%2Fwitty-actors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquickwit-oss%2Fwitty-actors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquickwit-oss%2Fwitty-actors/lists"}