Skip to content

Commit 28f9cca

Browse files
committed
Renamed from gotham to Juno
1 parent d36d9ba commit 28f9cca

File tree

8 files changed

+26
-26
lines changed

8 files changed

+26
-26
lines changed

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[package]
22
authors = ["Rakshith Ravi <[email protected]>"]
33
edition = "2018"
4-
name = "gotham"
4+
name = "juno"
55
version = "0.1.0"
66
license = "MIT"
7-
description = "A helper rust library for the gotham microservices framework"
8-
homepage = "https://github.com/bytesonus/gotham-rust"
9-
repository = "https://github.com/bytesonus/gotham-rust"
7+
description = "A helper rust library for the juno microservices framework"
8+
homepage = "https://github.com/bytesonus/juno-rust"
9+
repository = "https://github.com/bytesonus/juno-rust"
1010

1111
[dependencies]
1212
async-std = "1.5.0"

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Gotham Rust
1+
# Juno Rust
22

3-
This is a library that provides you with helper methods for interfacing with the microservices framework, [gotham](https://github.com/bytesonus/gotham).
3+
This is a library that provides you with helper methods for interfacing with the microservices framework, [juno](https://github.com/bytesonus/juno).
44

55
## How to use:
66

@@ -14,12 +14,12 @@ For all other basic needs, you can get away without worrying about any of that.
1414

1515
```rust
1616
use async_std::task;
17-
use gotham::{models::Value, GothamModule};
17+
use juno::{models::Value, JunoModule};
1818
use std::{time::Duration, collections::HashMap};
1919

2020
#[async_std::main]
2121
async fn main() {
22-
let mut module = GothamModule::default("./path/to/gotham.sock");
22+
let mut module = JunoModule::default("./path/to/juno.sock");
2323
// The hashmap below is used to mark dependencies
2424
module
2525
.initialize("module-name", "1.0.0", HashMap::new())

src/gotham_module.rs renamed to src/juno_module.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ type ArcRequestList = Arc<Mutex<HashMap<String, Sender<Result<Value>>>>>;
3434
type ArcFunctionList = Arc<Mutex<HashMap<String, fn(HashMap<String, Value>) -> Value>>>;
3535
type ArcHookListenerList = Arc<Mutex<HashMap<String, Vec<fn(Value)>>>>;
3636

37-
pub struct GothamModule {
37+
pub struct JunoModule {
3838
protocol: BaseProtocol,
3939
connection: Box<dyn BaseConnection>,
4040
requests: ArcRequestList,
@@ -44,7 +44,7 @@ pub struct GothamModule {
4444
registered: bool,
4545
}
4646

47-
impl GothamModule {
47+
impl JunoModule {
4848
pub fn default(connection_path: &str) -> Self {
4949
let is_ip: std::result::Result<SocketAddr, AddrParseError> =
5050
connection_path.to_string().parse();
@@ -62,7 +62,7 @@ impl GothamModule {
6262

6363
#[cfg(target_family = "unix")]
6464
pub fn from_unix_socket(socket_path: &str) -> Self {
65-
GothamModule {
65+
JunoModule {
6666
protocol: BaseProtocol::default(),
6767
connection: Box::new(UnixSocketConnection::new(socket_path.to_string())),
6868
requests: Arc::new(Mutex::new(HashMap::new())),
@@ -74,7 +74,7 @@ impl GothamModule {
7474
}
7575

7676
pub fn from_inet_socket(host: &str, port: u16) -> Self {
77-
GothamModule {
77+
JunoModule {
7878
protocol: BaseProtocol::default(),
7979
connection: Box::new(InetSocketConnection::new(format!("{}:{}", host, port))),
8080
requests: Arc::new(Mutex::new(HashMap::new())),
@@ -86,7 +86,7 @@ impl GothamModule {
8686
}
8787

8888
pub fn new(protocol: BaseProtocol, connection: Box<dyn BaseConnection>) -> Self {
89-
GothamModule {
89+
JunoModule {
9090
protocol,
9191
connection,
9292
requests: Arc::new(Mutex::new(HashMap::new())),
@@ -267,7 +267,7 @@ async fn on_data_listener(
267267
request_id: request_id.clone(),
268268
error: match error {
269269
Error::Internal(_) => 0,
270-
Error::FromGotham(error_code) => error_code,
270+
Error::FromJuno(error_code) => error_code,
271271
},
272272
}),
273273
};
@@ -279,7 +279,7 @@ async fn on_data_listener(
279279
BaseMessage::TriggerHookRequest { .. } => {
280280
execute_hook_triggered(message, &hook_listeners).await
281281
}
282-
BaseMessage::Error { error, .. } => Err(Error::FromGotham(error)),
282+
BaseMessage::Error { error, .. } => Err(Error::FromJuno(error)),
283283
_ => Ok(Value::Null),
284284
};
285285

@@ -303,7 +303,7 @@ async fn execute_function_call(message: BaseMessage, functions: &ArcFunctionList
303303
{
304304
let functions = functions.lock().await;
305305
if !functions.contains_key(&function) {
306-
return Err(Error::FromGotham(utils::errors::UNKNOWN_FUNCTION));
306+
return Err(Error::FromJuno(utils::errors::UNKNOWN_FUNCTION));
307307
}
308308
Ok(functions[&function](arguments))
309309
} else {

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
mod gotham_module;
1+
mod juno_module;
22
mod utils;
33

44
pub mod connection;
@@ -8,5 +8,5 @@ pub mod protocol;
88
#[macro_use]
99
pub mod macros;
1010

11-
pub use gotham_module::json;
12-
pub use gotham_module::GothamModule;
11+
pub use juno_module::json;
12+
pub use juno_module::JunoModule;

src/utils/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ use std::fmt::*;
33
#[derive(Debug)]
44
pub enum Error {
55
Internal(String),
6-
FromGotham(u32),
6+
FromJuno(u32),
77
}
88

99
impl Display for Error {
1010
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
1111
match self {
1212
Error::Internal(string) => write!(f, "Module internal error: {}", string),
13-
Error::FromGotham(num) => write!(f, "Gotham error code: {}", num),
13+
Error::FromJuno(num) => write!(f, "Juno error code: {}", num),
1414
}
1515
}
1616
}

tests/connection/unix_socket_connection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use async_std::{fs::remove_file, io::Result, os::unix::net::UnixListener, prelude::*, task};
22
use futures_util::sink::SinkExt;
3-
use gotham::connection::{BaseConnection, UnixSocketConnection};
3+
use juno::connection::{BaseConnection, UnixSocketConnection};
44

55
#[test]
66
fn connection_object_should_create_successfully() {

tests/models/messages.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use gotham::models::{BaseMessage, Value};
1+
use juno::models::{BaseMessage, Value};
22
use std::collections::HashMap;
33

44
#[test]

tests/sample.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use async_std::task;
2-
use gotham::{models::Value, GothamModule};
2+
use juno::{models::Value, JunoModule};
33
use std::collections::HashMap;
44

55
#[test]
66
fn sample() {
77
let module1 = async {
8-
let mut module = GothamModule::from_unix_socket("../gotham.sock");
8+
let mut module = JunoModule::from_unix_socket("../juno.sock");
99
module
1010
.initialize("module1", "1.0.0", HashMap::new())
1111
.await
@@ -23,7 +23,7 @@ fn sample() {
2323
}
2424
};
2525
let module2 = async {
26-
let mut module = GothamModule::from_unix_socket("../gotham.sock");
26+
let mut module = JunoModule::from_unix_socket("../juno.sock");
2727
module
2828
.initialize("module2", "1.0.0", HashMap::new())
2929
.await

0 commit comments

Comments
 (0)