Rename zrpc to rpc

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
This commit is contained in:
Nathan Sobo 2021-10-04 13:28:00 -06:00
parent fdfed3d7db
commit d5b60ad124
26 changed files with 62 additions and 66 deletions

View file

@ -21,7 +21,7 @@ similar = "1.3"
smallvec = { version = "1.6", features = ["union"] }
sum_tree = { path = "../sum_tree" }
tree-sitter = "0.19.5"
zrpc = { path = "../zrpc" }
rpc = { path = "../rpc" }
[dev-dependencies]
rand = "0.8.3"

View file

@ -43,7 +43,7 @@ use std::{
use sum_tree::{self, Bias, FilterCursor, SumTree};
pub use syntax_theme::SyntaxTheme;
use tree_sitter::{InputEdit, Parser, QueryCursor};
use zrpc::proto;
use rpc::proto;
pub trait File {
fn worktree_id(&self) -> usize;

View file

@ -5,4 +5,4 @@ edition = "2018"
[dependencies]
smallvec = { version = "1.6", features = ["union"] }
zrpc = { path = "../zrpc" }
rpc = { path = "../rpc" }

View file

@ -61,8 +61,8 @@ impl<'a> AddAssign<&'a Local> for Local {
#[derive(Clone, Default, Hash, Eq, PartialEq)]
pub struct Global(SmallVec<[Local; 3]>);
impl From<Vec<zrpc::proto::VectorClockEntry>> for Global {
fn from(message: Vec<zrpc::proto::VectorClockEntry>) -> Self {
impl From<Vec<rpc::proto::VectorClockEntry>> for Global {
fn from(message: Vec<rpc::proto::VectorClockEntry>) -> Self {
let mut version = Self::new();
for entry in message {
version.observe(Local {
@ -74,11 +74,11 @@ impl From<Vec<zrpc::proto::VectorClockEntry>> for Global {
}
}
impl<'a> From<&'a Global> for Vec<zrpc::proto::VectorClockEntry> {
impl<'a> From<&'a Global> for Vec<rpc::proto::VectorClockEntry> {
fn from(version: &'a Global) -> Self {
version
.iter()
.map(|entry| zrpc::proto::VectorClockEntry {
.map(|entry| rpc::proto::VectorClockEntry {
replica_id: entry.replica_id as u32,
timestamp: entry.value,
})

View file

@ -1,7 +1,7 @@
[package]
description = "Shared logic for communication between the Zed app and the zed.dev server"
edition = "2018"
name = "zrpc"
name = "rpc"
version = "0.1.0"
[features]

View file

@ -21,4 +21,4 @@ surf = "2.2"
thiserror = "1.0.29"
tiny_http = "0.8"
util = { path = "../util" }
zrpc = { path = "../zrpc" }
rpc = { path = "../rpc" }

View file

@ -12,6 +12,7 @@ use lazy_static::lazy_static;
use parking_lot::RwLock;
use postage::{prelude::Stream, watch};
use rand::prelude::*;
use rpc::proto::{AnyTypedEnvelope, EntityMessage, EnvelopedMessage, RequestMessage};
use std::{
any::TypeId,
collections::HashMap,
@ -24,11 +25,8 @@ use std::{
use surf::Url;
use thiserror::Error;
use util::ResultExt;
pub use zrpc::{proto, ConnectionId, PeerId, TypedEnvelope};
use zrpc::{
proto::{AnyTypedEnvelope, EntityMessage, EnvelopedMessage, RequestMessage},
Connection, Peer, Receipt,
};
pub use rpc::*;
lazy_static! {
static ref ZED_SERVER_URL: String =
@ -506,7 +504,7 @@ impl Client {
"Authorization",
format!("{} {}", credentials.user_id, credentials.access_token),
)
.header("X-Zed-Protocol-Version", zrpc::PROTOCOL_VERSION);
.header("X-Zed-Protocol-Version", rpc::PROTOCOL_VERSION);
cx.background().spawn(async move {
if let Some(host) = ZED_SERVER_URL.strip_prefix("https://") {
let stream = smol::net::TcpStream::connect(host).await?;
@ -536,7 +534,7 @@ impl Client {
// zed server to encrypt the user's access token, so that it can'be intercepted by
// any other app running on the user's device.
let (public_key, private_key) =
zrpc::auth::keypair().expect("failed to generate keypair for auth");
rpc::auth::keypair().expect("failed to generate keypair for auth");
let public_key_string =
String::try_from(public_key).expect("failed to serialize public key for auth");

View file

@ -5,11 +5,11 @@ use super::Client;
use gpui::TestAppContext;
use parking_lot::Mutex;
use postage::{mpsc, prelude::Stream};
use rpc::{proto, ConnectionId, Peer, Receipt, TypedEnvelope};
use std::sync::{
atomic::{AtomicBool, AtomicUsize},
Arc,
};
use zrpc::{proto, ConnectionId, Peer, Receipt, TypedEnvelope};
pub struct FakeServer {
peer: Arc<Peer>,

View file

@ -41,7 +41,7 @@ tide = "0.16.0"
tide-compress = "0.9.0"
time = "0.2"
toml = "0.5.8"
zrpc = { path = "../zrpc" }
rpc = { path = "../rpc" }
[dependencies.async-sqlx-session]
version = "0.3.0"

View file

@ -19,7 +19,7 @@ use serde::{Deserialize, Serialize};
use std::{borrow::Cow, convert::TryFrom, sync::Arc};
use surf::{StatusCode, Url};
use tide::{log, Error, Server};
use zrpc::auth as zed_auth;
use rpc::auth as zed_auth;
static CURRENT_GITHUB_USER: &'static str = "current_github_user";
static GITHUB_AUTH_URL: &'static str = "https://github.com/login/oauth/authorize";

View file

@ -26,7 +26,7 @@ use std::sync::Arc;
use surf::http::cookies::SameSite;
use tide::{log, sessions::SessionMiddleware};
use tide_compress::CompressMiddleware;
use zrpc::Peer;
use rpc::Peer;
type Request = tide::Request<Arc<AppState>>;

View file

@ -27,7 +27,7 @@ use tide::{
Request, Response,
};
use time::OffsetDateTime;
use zrpc::{
use rpc::{
proto::{self, AnyTypedEnvelope, EnvelopedMessage},
Connection, ConnectionId, Peer, TypedEnvelope,
};
@ -897,7 +897,7 @@ pub fn add_routes(app: &mut tide::Server<Arc<AppState>>, rpc: &Arc<Peer>) {
.header("X-Zed-Protocol-Version")
.and_then(|v| v.as_str().parse().ok());
if !upgrade_requested || client_protocol_version != Some(zrpc::PROTOCOL_VERSION) {
if !upgrade_requested || client_protocol_version != Some(rpc::PROTOCOL_VERSION) {
return Ok(Response::new(StatusCode::UpgradeRequired));
}
@ -988,7 +988,7 @@ mod tests {
workspace::Workspace,
worktree::Worktree,
};
use zrpc::Peer;
use rpc::Peer;
#[gpui::test]
async fn test_share_worktree(mut cx_a: TestAppContext, mut cx_b: TestAppContext) {

View file

@ -1,7 +1,7 @@
use crate::db::{ChannelId, UserId};
use anyhow::anyhow;
use std::collections::{hash_map, HashMap, HashSet};
use zrpc::{proto, ConnectionId};
use rpc::{proto, ConnectionId};
#[derive(Default)]
pub struct Store {

View file

@ -28,11 +28,11 @@ smol = "1.2.5"
sum_tree = { path = "../sum_tree" }
util = { path = "../util" }
toml = "0.5"
zrpc = { path = "../zrpc" }
rpc = { path = "../rpc" }
[dev-dependencies]
rand = "0.8.3"
rpc_client = { path = "../rpc_client", features = ["test-support"] }
tempdir = { version = "0.3.7" }
util = { path = "../util", features = ["test-support"] }
zrpc = { path = "../zrpc", features = ["test-support"] }
rpc = { path = "../rpc", features = ["test-support"] }

View file

@ -19,7 +19,7 @@ use postage::{
prelude::{Sink as _, Stream as _},
watch,
};
use rpc_client as rpc;
use rpc_client::{self as rpc, proto, PeerId, TypedEnvelope};
use serde::Deserialize;
use smol::channel::{self, Sender};
use std::{
@ -41,7 +41,6 @@ use std::{
use sum_tree::Bias;
use sum_tree::{self, Edit, SeekTarget, SumTree};
use util::TryFutureExt;
use zrpc::{proto, PeerId, TypedEnvelope};
lazy_static! {
static ref GITIGNORE: &'static OsStr = OsStr::new(".gitignore");

View file

@ -20,7 +20,7 @@ test-support = [
"rpc_client/test-support",
"tempdir",
"worktree/test-support",
"zrpc/test-support",
"rpc/test-support",
]
[dependencies]
@ -71,7 +71,7 @@ tree-sitter-rust = "0.19.0"
url = "2.2"
util = { path = "../util" }
worktree = { path = "../worktree" }
zrpc = { path = "../zrpc" }
rpc = { path = "../rpc" }
[dev-dependencies]
cargo-bundle = "0.5.0"
@ -84,7 +84,7 @@ gpui = { path = "../gpui", features = ["test-support"] }
rpc_client = { path = "../rpc_client", features = ["test-support"] }
util = { path = "../util", features = ["test-support"] }
worktree = { path = "../worktree", features = ["test-support"] }
zrpc = { path = "../zrpc", features = ["test-support"] }
rpc = { path = "../rpc", features = ["test-support"] }
[package.metadata.bundle]
icon = ["app-icon@2x.png", "app-icon.png"]

View file

@ -5,7 +5,11 @@ use gpui::{
};
use postage::prelude::Stream;
use rand::prelude::*;
use rpc_client as rpc;
use rpc_client::{
self as rpc,
proto::{self, ChannelMessageSent},
TypedEnvelope,
};
use std::{
collections::{HashMap, HashSet},
mem,
@ -15,10 +19,6 @@ use std::{
use sum_tree::{self, Bias, SumTree};
use time::OffsetDateTime;
use util::{post_inc, TryFutureExt};
use zrpc::{
proto::{self, ChannelMessageSent},
TypedEnvelope,
};
pub struct ChannelList {
available_channels: Option<Vec<ChannelDetails>>,

View file

@ -3,13 +3,12 @@ use anyhow::{anyhow, Context, Result};
use futures::future;
use gpui::{AsyncAppContext, Entity, ImageData, ModelContext, ModelHandle, Task};
use postage::{prelude::Stream, sink::Sink, watch};
use rpc_client as rpc;
use rpc_client::{self as rpc, proto, TypedEnvelope};
use std::{
collections::{HashMap, HashSet},
sync::Arc,
};
use util::TryFutureExt as _;
use zrpc::{proto, TypedEnvelope};
#[derive(Debug)]
pub struct User {