aboutsummaryrefslogtreecommitdiff
path: root/jsonrpc/src
diff options
context:
space:
mode:
authorhozan23 <hozan23@karyontech.net>2024-05-28 00:26:59 +0200
committerhozan23 <hozan23@karyontech.net>2024-05-28 00:26:59 +0200
commit9341e695d0e387927804716b60945912cba686dd (patch)
treecd6389124e3295931d621a7a68837bde74ff9d95 /jsonrpc/src
parent8afb4d30750840f66d9f97c2c54a893d3934c45e (diff)
jsonrpc: move `SubscriptionID` to message.rs
Diffstat (limited to 'jsonrpc/src')
-rw-r--r--jsonrpc/src/client/mod.rs5
-rw-r--r--jsonrpc/src/lib.rs2
-rw-r--r--jsonrpc/src/message.rs4
-rw-r--r--jsonrpc/src/server/channel.rs3
4 files changed, 8 insertions, 6 deletions
diff --git a/jsonrpc/src/client/mod.rs b/jsonrpc/src/client/mod.rs
index 0666ee0..05479f9 100644
--- a/jsonrpc/src/client/mod.rs
+++ b/jsonrpc/src/client/mod.rs
@@ -13,7 +13,10 @@ use karyon_core::{
};
use karyon_net::Conn;
-use crate::{message, Error, Result, SubscriptionID};
+use crate::{
+ message::{self, SubscriptionID},
+ Error, Result,
+};
const CHANNEL_CAP: usize = 10;
diff --git a/jsonrpc/src/lib.rs b/jsonrpc/src/lib.rs
index 14840fa..b7b632e 100644
--- a/jsonrpc/src/lib.rs
+++ b/jsonrpc/src/lib.rs
@@ -10,7 +10,7 @@ pub use client::{builder::ClientBuilder, Client};
pub use error::{Error, Result};
pub use server::{
builder::ServerBuilder,
- channel::{ArcChannel, Channel, Subscription, SubscriptionID},
+ channel::{ArcChannel, Channel, Subscription},
pubsub_service::{PubSubRPCMethod, PubSubRPCService},
service::{RPCMethod, RPCService},
Server,
diff --git a/jsonrpc/src/message.rs b/jsonrpc/src/message.rs
index 34d6235..1f296cd 100644
--- a/jsonrpc/src/message.rs
+++ b/jsonrpc/src/message.rs
@@ -1,7 +1,5 @@
use serde::{Deserialize, Serialize};
-use crate::SubscriptionID;
-
pub type ID = u64;
pub const JSONRPC_VERSION: &str = "2.0";
@@ -21,6 +19,8 @@ pub const INVALID_PARAMS_ERROR_CODE: i32 = -32602;
/// Internal error: Internal JSON-RPC error.
pub const INTERNAL_ERROR_CODE: i32 = -32603;
+pub type SubscriptionID = u32;
+
#[derive(Debug, Serialize, Deserialize)]
pub struct Request {
pub jsonrpc: String,
diff --git a/jsonrpc/src/server/channel.rs b/jsonrpc/src/server/channel.rs
index f14c1dd..efcd344 100644
--- a/jsonrpc/src/server/channel.rs
+++ b/jsonrpc/src/server/channel.rs
@@ -2,9 +2,8 @@ use std::sync::Arc;
use karyon_core::{async_runtime::lock::Mutex, util::random_32};
-use crate::{Error, Result};
+use crate::{message::SubscriptionID, Error, Result};
-pub type SubscriptionID = u32;
pub type ArcChannel = Arc<Channel>;
pub(crate) struct NewNotification {