From c601984d37221609a3c52e228c716134dd98ebb8 Mon Sep 17 00:00:00 2001 From: Ayrat Badykov Date: Thu, 24 Jun 2021 13:15:10 +0300 Subject: [PATCH] prepare to publish on crates.io --- Cargo.toml | 6 ++++-- README.md | 18 ++++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d188d03..0ced2f7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,10 +1,12 @@ [package] name = "fang" -version = "0.1.0" +version = "0.2.0" authors = ["Ayrat Badykov "] +description = "Background job processing library for Rust" +repository = "https://github.com/ayrat555/fang" edition = "2018" -description = "fang is in active development. it's published to take the name on crates.io" license = "MIT" +readme = "README.md" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/README.md b/README.md index 3e6565e..452998e 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Background job processing library for Rust. -Currently, it uses postgres to store state. But in the future, more backends will be supported. +Currently, it uses Postgres to store state. But in the future, more backends will be supported. ## Installation @@ -13,18 +13,18 @@ Currently, it uses postgres to store state. But in the future, more backends wil ```toml [dependencies] -fang = "0.1" +fang = "0.2" typetag = "0.1" serde = { version = "1.0", features = ["derive"] } ``` -2. Create `fang_tasks` table in the postgres database. The migration can be found in [the migrations directory](https://github.com/ayrat555/fang/blob/master/migrations/2021-06-05-112912_create_fang_tasks/up.sql). +2. Create `fang_tasks` table in the Postgres database. The migration can be found in [the migrations directory](https://github.com/ayrat555/fang/blob/master/migrations/2021-06-05-112912_create_fang_tasks/up.sql). ## Usage ### Defining a job -Every job should implement `fang::Runnable` trait which is used by `fang` to execut it. +Every job should implement `fang::Runnable` trait which is used by `fang` to execute it. ```rust @@ -48,7 +48,7 @@ Every job should implement `fang::Runnable` trait which is used by `fang` to exe } ``` -As you can see from the example above, trait implementation has `#[typetag::serde]` which is used to deserialize the job. +As you can see from the example above, the trait implementation has `#[typetag::serde]` attribute which is used to deserialize the job. ### Enqueuing a job @@ -67,9 +67,9 @@ Postgres::enqueue_task(&Job { number: 10 }).unwrap(); ### Starting workers -Every worker is executed in a separate thread. In case of panic, they are always restarted. +Every worker runs in a separate thread. In case of panic, they are always restarted. -Use `WorkerPool::new` to start workers. It accepts two parameters - the number of workers and the prefix for worker thread name. +Use `WorkerPool` to start workers. It accepts two parameters - the number of workers and the prefix for the worker thread name. ```rust @@ -81,8 +81,10 @@ WorkerPool::new(10, "sync".to_string()).start(); ## Potential/future features * Extendable/new backends - * Workers for specific types of tasks. Currently, each workers execute all types of tasks + * Workers for specific types of tasks. Currently, each worker execute all types of tasks * Configurable db records retention. Currently, fang doesn't remove tasks from the db. + * Retries + * Scheduled tasks ## Contributing