Skip to content

Commit 3240339

Browse files
committed
Refactor: rename ttrpc::ttrpc to ttrpc::proto
ttrpc::ttrpc is ambiguous, rename and make it clear. Fixes: #130 Signed-off-by: Tim Zhang <[email protected]>
1 parent 6f304a4 commit 3240339

File tree

13 files changed

+15
-15
lines changed

13 files changed

+15
-15
lines changed

example/async-server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use log::LevelFilter;
1515
use protocols::r#async::{agent, agent_ttrpc, health, health_ttrpc, types};
1616
use ttrpc::asynchronous::Server;
1717
use ttrpc::error::{Error, Result};
18-
use ttrpc::ttrpc::{Code, Status};
18+
use ttrpc::proto::{Code, Status};
1919

2020
use async_trait::async_trait;
2121
use tokio::signal::unix::{signal, SignalKind};

example/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use std::thread;
2323

2424
use protocols::sync::{agent, agent_ttrpc, health, health_ttrpc, types};
2525
use ttrpc::error::{Error, Result};
26-
use ttrpc::ttrpc::{Code, Status};
26+
use ttrpc::proto::{Code, Status};
2727
use ttrpc::Server;
2828

2929
struct HealthService;

src/asynchronous/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::sync::{Arc, Mutex};
1111

1212
use crate::common::{client_connect, MESSAGE_TYPE_RESPONSE};
1313
use crate::error::{Error, Result};
14-
use crate::ttrpc::{Code, Request, Response};
14+
use crate::proto::{Code, Request, Response};
1515

1616
use crate::asynchronous::stream::{receive, to_req_buf};
1717
use crate::r#async::utils;

src/asynchronous/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ use crate::asynchronous::unix_incoming::UnixIncoming;
1616
use crate::common::{self, Domain, MESSAGE_TYPE_REQUEST};
1717
use crate::context;
1818
use crate::error::{get_status, Error, Result};
19+
use crate::proto::{Code, Status};
1920
use crate::r#async::{MethodHandler, TtrpcContext};
20-
use crate::ttrpc::{Code, Status};
2121
use crate::MessageHeader;
2222
use futures::stream::Stream;
2323
use futures::StreamExt as _;

src/asynchronous/stream.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use byteorder::{BigEndian, ByteOrder};
77

88
use crate::common::{MESSAGE_HEADER_LENGTH, MESSAGE_LENGTH_MAX, MESSAGE_TYPE_RESPONSE};
99
use crate::error::{get_rpc_status, sock_error_msg, Error, Result};
10+
use crate::proto::{Code, Response, Status};
1011
use crate::r#async::utils;
11-
use crate::ttrpc::{Code, Response, Status};
1212
use crate::MessageHeader;
1313
use protobuf::Message;
1414
use tokio::io::AsyncReadExt;

src/asynchronous/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
use crate::common::{MessageHeader, MESSAGE_TYPE_REQUEST, MESSAGE_TYPE_RESPONSE};
77
use crate::error::{get_status, Result};
8-
use crate::ttrpc::{Code, Request, Status};
8+
use crate::proto::{Code, Request, Status};
99
use async_trait::async_trait;
1010
use protobuf::{CodedInputStream, Message};
1111
use std::collections::HashMap;

src/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// SPDX-License-Identifier: Apache-2.0
44
//
55

6-
use crate::ttrpc::KeyValue;
6+
use crate::proto::KeyValue;
77
use std::collections::HashMap;
88

99
#[derive(Clone, Default, Debug)]
@@ -78,7 +78,7 @@ pub fn to_pb(kvs: HashMap<String, Vec<String>>) -> protobuf::RepeatedField<KeyVa
7878
#[cfg(test)]
7979
mod tests {
8080
use crate::context;
81-
use crate::ttrpc::KeyValue;
81+
use crate::proto::KeyValue;
8282

8383
#[test]
8484
fn test_metadata() {

src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
//! Error and Result of ttrpc and relevant functions, macros.
1616
17-
use crate::ttrpc::{Code, Status};
17+
use crate::proto::{Code, Status};
1818
use std::result;
1919
use thiserror::Error;
2020

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ mod common;
5252
mod compiled {
5353
include!(concat!(env!("OUT_DIR"), "/mod.rs"));
5454
}
55-
pub use compiled::ttrpc;
55+
pub use compiled::ttrpc as proto;
5656

5757
pub mod context;
5858

@@ -61,7 +61,7 @@ pub use crate::common::MessageHeader;
6161
#[doc(inline)]
6262
pub use crate::error::{get_status, Error, Result};
6363
#[doc(inline)]
64-
pub use crate::ttrpc::{Code, Request, Response, Status};
64+
pub use proto::{Code, Request, Response, Status};
6565

6666
cfg_sync! {
6767
pub mod sync;

src/sync/channel.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use std::os::unix::io::RawFd;
1818

1919
use crate::common::{MESSAGE_HEADER_LENGTH, MESSAGE_LENGTH_MAX};
2020
use crate::error::{get_rpc_status, sock_error_msg, Error, Result};
21-
use crate::ttrpc::Code;
21+
use crate::proto::Code;
2222
use crate::MessageHeader;
2323

2424
fn retryable(e: nix::Error) -> bool {

0 commit comments

Comments
 (0)