Skip to content

Commit

Permalink
refactor: rename
Browse files Browse the repository at this point in the history
  • Loading branch information
Frando committed May 17, 2024
1 parent e85513e commit ca139d7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions iroh/src/client/authors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use iroh_docs::{Author, AuthorId};
use quic_rpc::{RpcClient, ServiceConnection};

use crate::rpc_protocol::{
AuthorCreateRequest, AuthorDefaultRequest, AuthorDeleteRequest, AuthorExportRequest,
AuthorCreateRequest, AuthorGetDefaultRequest, AuthorDeleteRequest, AuthorExportRequest,
AuthorImportRequest, AuthorListRequest, RpcService,
};

Expand Down Expand Up @@ -41,7 +41,7 @@ where
/// The default author can neither be changed nor deleted. If you need more semantics around
/// authors than a single author per node, use [`Self::create`].
pub async fn default(&self) -> Result<AuthorId> {
let res = self.rpc.rpc(AuthorDefaultRequest).await?;
let res = self.rpc.rpc(AuthorGetDefaultRequest).await?;
Ok(res.author_id)
}

Expand Down
6 changes: 3 additions & 3 deletions iroh/src/docs_engine/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use tokio_stream::StreamExt;

use crate::client::docs::ShareMode;
use crate::rpc_protocol::{
AuthorDefaultRequest, AuthorDefaultResponse, AuthorDeleteRequest, AuthorDeleteResponse,
AuthorGetDefaultRequest, AuthorGetDefaultResponse, AuthorDeleteRequest, AuthorDeleteResponse,
AuthorExportRequest, AuthorExportResponse, AuthorImportRequest, AuthorImportResponse,
DocGetSyncPeersRequest, DocGetSyncPeersResponse,
};
Expand Down Expand Up @@ -45,8 +45,8 @@ impl Engine {
})
}

pub fn author_default(&self, _req: AuthorDefaultRequest) -> AuthorDefaultResponse {
AuthorDefaultResponse {
pub fn author_default(&self, _req: AuthorGetDefaultRequest) -> AuthorGetDefaultResponse {
AuthorGetDefaultResponse {
author_id: self.default_author,
}
}
Expand Down
2 changes: 1 addition & 1 deletion iroh/src/node/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ impl<D: BaoStore> Handler<D> {
})
.await
}
AuthorDefault(msg) => {
AuthorGetDefault(msg) => {
chan.rpc(msg, handler, |handler, req| async move {
handler.inner.sync.author_default(req)
})
Expand Down
14 changes: 7 additions & 7 deletions iroh/src/rpc_protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,15 +439,15 @@ pub struct AuthorCreateResponse {

/// Get the default author.
#[derive(Serialize, Deserialize, Debug)]
pub struct AuthorDefaultRequest;
pub struct AuthorGetDefaultRequest;

impl RpcMsg<RpcService> for AuthorDefaultRequest {
type Response = AuthorDefaultResponse;
impl RpcMsg<RpcService> for AuthorGetDefaultRequest {
type Response = AuthorGetDefaultResponse;
}

/// Response for [`AuthorDefaultRequest`]
/// Response for [`AuthorGetDefaultRequest`]
#[derive(Serialize, Deserialize, Debug)]
pub struct AuthorDefaultResponse {
pub struct AuthorGetDefaultResponse {
/// The id of the author
pub author_id: AuthorId,
}
Expand Down Expand Up @@ -1081,7 +1081,7 @@ pub enum Request {

AuthorList(AuthorListRequest),
AuthorCreate(AuthorCreateRequest),
AuthorDefault(AuthorDefaultRequest),
AuthorGetDefault(AuthorGetDefaultRequest),
AuthorImport(AuthorImportRequest),
AuthorExport(AuthorExportRequest),
AuthorDelete(AuthorDeleteRequest),
Expand Down Expand Up @@ -1142,7 +1142,7 @@ pub enum Response {

AuthorList(RpcResult<AuthorListResponse>),
AuthorCreate(RpcResult<AuthorCreateResponse>),
AuthorDefault(AuthorDefaultResponse),
AuthorGetDefault(AuthorGetDefaultResponse),
AuthorImport(RpcResult<AuthorImportResponse>),
AuthorExport(RpcResult<AuthorExportResponse>),
AuthorDelete(RpcResult<AuthorDeleteResponse>),
Expand Down

0 comments on commit ca139d7

Please sign in to comment.