Split task from serai-processor-primitives into serai-task

This commit is contained in:
Luke Parker
2024-12-19 10:07:24 -05:00
parent 066aa9eda4
commit 147a6e43d0
11 changed files with 60 additions and 1 deletions

View File

@@ -30,4 +30,5 @@ jobs:
-p patchable-async-sleep \ -p patchable-async-sleep \
-p serai-db \ -p serai-db \
-p serai-env \ -p serai-env \
-p serai-task \
-p simple-request -p simple-request

View File

@@ -24,6 +24,7 @@ jobs:
cargo msrv verify --manifest-path common/std-shims/Cargo.toml cargo msrv verify --manifest-path common/std-shims/Cargo.toml
cargo msrv verify --manifest-path common/env/Cargo.toml cargo msrv verify --manifest-path common/env/Cargo.toml
cargo msrv verify --manifest-path common/db/Cargo.toml cargo msrv verify --manifest-path common/db/Cargo.toml
cargo msrv verify --manifest-path common/task/Cargo.toml
cargo msrv verify --manifest-path common/request/Cargo.toml cargo msrv verify --manifest-path common/request/Cargo.toml
cargo msrv verify --manifest-path common/patchable-async-sleep/Cargo.toml cargo msrv verify --manifest-path common/patchable-async-sleep/Cargo.toml

9
Cargo.lock generated
View File

@@ -8922,6 +8922,7 @@ dependencies = [
"parity-scale-codec", "parity-scale-codec",
"serai-coins-primitives", "serai-coins-primitives",
"serai-primitives", "serai-primitives",
"serai-task",
"tokio", "tokio",
] ]
@@ -9150,6 +9151,14 @@ dependencies = [
"zeroize", "zeroize",
] ]
[[package]]
name = "serai-task"
version = "0.1.0"
dependencies = [
"log",
"tokio",
]
[[package]] [[package]]
name = "serai-validator-sets-pallet" name = "serai-validator-sets-pallet"
version = "0.1.0" version = "0.1.0"

View File

@@ -20,6 +20,7 @@ members = [
"common/patchable-async-sleep", "common/patchable-async-sleep",
"common/db", "common/db",
"common/env", "common/env",
"common/task",
"common/request", "common/request",
"crypto/transcript", "crypto/transcript",

22
common/task/Cargo.toml Normal file
View File

@@ -0,0 +1,22 @@
[package]
name = "serai-task"
version = "0.1.0"
description = "A task schema for Serai services"
license = "AGPL-3.0-only"
repository = "https://github.com/serai-dex/serai/tree/develop/common/task"
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
keywords = []
edition = "2021"
publish = false
rust-version = "1.75"
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
[lints]
workspace = true
[dependencies]
log = { version = "0.4", default-features = false, features = ["std"] }
tokio = { version = "1", default-features = false, features = ["macros", "sync", "time"] }

15
common/task/LICENSE Normal file
View File

@@ -0,0 +1,15 @@
AGPL-3.0-only license
Copyright (c) 2022-2024 Luke Parker
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License Version 3 as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

3
common/task/README.md Normal file
View File

@@ -0,0 +1,3 @@
# Task
A schema to define tasks to be run ad infinitum.

View File

@@ -1,3 +1,7 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![doc = include_str!("../README.md")]
#![deny(missing_docs)]
use core::{future::Future, time::Duration}; use core::{future::Future, time::Duration};
use std::sync::Arc; use std::sync::Arc;

View File

@@ -41,6 +41,7 @@ allow = [
exceptions = [ exceptions = [
{ allow = ["AGPL-3.0"], name = "serai-env" }, { allow = ["AGPL-3.0"], name = "serai-env" },
{ allow = ["AGPL-3.0"], name = "serai-task" },
{ allow = ["AGPL-3.0"], name = "ethereum-schnorr-contract" }, { allow = ["AGPL-3.0"], name = "ethereum-schnorr-contract" },
{ allow = ["AGPL-3.0"], name = "serai-ethereum-relayer" }, { allow = ["AGPL-3.0"], name = "serai-ethereum-relayer" },

View File

@@ -28,3 +28,5 @@ borsh = { version = "1", default-features = false, features = ["std", "derive",
log = { version = "0.4", default-features = false, features = ["std"] } log = { version = "0.4", default-features = false, features = ["std"] }
tokio = { version = "1", default-features = false, features = ["macros", "sync", "time"] } tokio = { version = "1", default-features = false, features = ["macros", "sync", "time"] }
serai-task = { path = "../../common/task", default-features = false }

View File

@@ -10,7 +10,7 @@ use scale::{Encode, Decode};
use borsh::{BorshSerialize, BorshDeserialize}; use borsh::{BorshSerialize, BorshDeserialize};
/// A module for task-related structs and functionality. /// A module for task-related structs and functionality.
pub mod task; pub use serai_task as task;
mod output; mod output;
pub use output::*; pub use output::*;