Skip to content

Commit

Permalink
Rename ActorRequest::request_name -> endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippGackstatter committed Mar 7, 2022
1 parent 2de73ec commit be49946
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions identity-actor/src/actor/actor.rs
Expand Up @@ -195,7 +195,7 @@ impl Actor {
command: REQ,
) -> Result<()> {
self
.send_named_message(peer, &command.request_name(), thread_id, command)
.send_named_message(peer, &command.endpoint(), thread_id, command)
.await
}

Expand Down Expand Up @@ -245,7 +245,7 @@ impl Actor {
message: REQ,
) -> Result<REQ::Response> {
self
.send_named_request(peer, message.request_name().as_ref(), message)
.send_named_request(peer, message.endpoint().as_ref(), message)
.await
}

Expand Down Expand Up @@ -290,7 +290,7 @@ impl Actor {
peer: PeerId,
input: REQ,
) -> Result<REQ> {
let mut endpoint = Endpoint::new(input.request_name())?;
let mut endpoint = Endpoint::new(input.endpoint())?;
endpoint.is_hook = true;

if self.handlers().contains_key(&endpoint) {
Expand Down
2 changes: 1 addition & 1 deletion identity-actor/src/actor/actor_request.rs
Expand Up @@ -54,7 +54,7 @@ pub(crate) mod private {
pub trait ActorRequest<T: SyncMode>: Debug + Serialize + DeserializeOwned + Send + 'static {
type Response: Debug + Serialize + DeserializeOwned + 'static;

fn request_name<'cow>(&self) -> Cow<'cow, str>;
fn endpoint<'cow>(&self) -> Cow<'cow, str>;

fn request_mode(&self) -> RequestMode {
T::request_mode()
Expand Down
4 changes: 2 additions & 2 deletions identity-actor/src/didcomm/message.rs
Expand Up @@ -53,7 +53,7 @@ where
{
type Response = ();

fn request_name<'cow>(&self) -> std::borrow::Cow<'cow, str> {
self.body.request_name()
fn endpoint<'cow>(&self) -> std::borrow::Cow<'cow, str> {
self.body.endpoint()
}
}
8 changes: 4 additions & 4 deletions identity-actor/src/didcomm/presentation.rs
Expand Up @@ -116,7 +116,7 @@ pub struct PresentationRequest([u8; 2]);

impl ActorRequest<Asynchronous> for PresentationRequest {
type Response = ();
fn request_name<'cow>(&self) -> std::borrow::Cow<'cow, str> {
fn endpoint<'cow>(&self) -> std::borrow::Cow<'cow, str> {
Cow::Borrowed("didcomm/presentation_request")
}
}
Expand All @@ -126,7 +126,7 @@ pub struct PresentationOffer([u8; 3]);

impl ActorRequest<Asynchronous> for PresentationOffer {
type Response = ();
fn request_name<'cow>(&self) -> std::borrow::Cow<'cow, str> {
fn endpoint<'cow>(&self) -> std::borrow::Cow<'cow, str> {
Cow::Borrowed("didcomm/presentation_offer")
}
}
Expand All @@ -136,7 +136,7 @@ pub struct Presentation([u8; 4]);

impl ActorRequest<Asynchronous> for Presentation {
type Response = ();
fn request_name<'cow>(&self) -> std::borrow::Cow<'cow, str> {
fn endpoint<'cow>(&self) -> std::borrow::Cow<'cow, str> {
Cow::Borrowed("didcomm/presentation")
}
}
Expand All @@ -146,7 +146,7 @@ pub struct PresentationResult([u8; 5]);

impl ActorRequest<Asynchronous> for PresentationResult {
type Response = ();
fn request_name<'cow>(&self) -> std::borrow::Cow<'cow, str> {
fn endpoint<'cow>(&self) -> std::borrow::Cow<'cow, str> {
Cow::Borrowed("didcomm/presentation_result")
}
}
6 changes: 3 additions & 3 deletions identity-actor/src/remote_account/requests.rs
Expand Up @@ -20,7 +20,7 @@ pub struct IdentityCreate(pub IdentitySetup);
impl ActorRequest<Synchronous> for IdentityCreate {
type Response = Result<IotaDocument, RemoteAccountError>;

fn request_name<'cow>(&self) -> std::borrow::Cow<'cow, str> {
fn endpoint<'cow>(&self) -> std::borrow::Cow<'cow, str> {
Cow::Borrowed("remote_account/create")
}
}
Expand All @@ -31,7 +31,7 @@ pub struct IdentityList;
impl ActorRequest<Synchronous> for IdentityList {
type Response = Vec<IotaDID>;

fn request_name<'cow>(&self) -> std::borrow::Cow<'cow, str> {
fn endpoint<'cow>(&self) -> std::borrow::Cow<'cow, str> {
Cow::Borrowed("remote_account/list")
}
}
Expand All @@ -42,7 +42,7 @@ pub struct IdentityGet(pub IotaDID);
impl ActorRequest<Synchronous> for IdentityGet {
type Response = Result<IotaDocument, RemoteAccountError>;

fn request_name<'cow>(&self) -> std::borrow::Cow<'cow, str> {
fn endpoint<'cow>(&self) -> std::borrow::Cow<'cow, str> {
Cow::Borrowed("remote_account/get")
}
}
8 changes: 4 additions & 4 deletions identity-actor/src/tests/actor.rs
Expand Up @@ -52,7 +52,7 @@ async fn test_unknown_request_or_thread_returns_error() -> crate::Result<()> {
impl ActorRequest<Asynchronous> for AsyncDummy {
type Response = ();

fn request_name<'cow>(&self) -> std::borrow::Cow<'cow, str> {
fn endpoint<'cow>(&self) -> std::borrow::Cow<'cow, str> {
std::borrow::Cow::Borrowed("unknown/thread")
}
}
Expand All @@ -79,7 +79,7 @@ async fn test_actors_can_communicate_bidirectionally() -> crate::Result<()> {
impl ActorRequest<Synchronous> for Dummy {
type Response = ();

fn request_name<'cow>(&self) -> std::borrow::Cow<'cow, str> {
fn endpoint<'cow>(&self) -> std::borrow::Cow<'cow, str> {
std::borrow::Cow::Borrowed("request/test")
}
}
Expand Down Expand Up @@ -142,7 +142,7 @@ async fn test_actor_handler_is_invoked() -> crate::Result<()> {
impl ActorRequest<Synchronous> for Dummy {
type Response = ();

fn request_name<'cow>(&self) -> std::borrow::Cow<'cow, str> {
fn endpoint<'cow>(&self) -> std::borrow::Cow<'cow, str> {
std::borrow::Cow::Borrowed("request/test")
}
}
Expand Down Expand Up @@ -194,7 +194,7 @@ async fn test_synchronous_handler_invocation() -> crate::Result<()> {
impl ActorRequest<Synchronous> for MessageRequest {
type Response = MessageResponse;

fn request_name<'cow>(&self) -> std::borrow::Cow<'cow, str> {
fn endpoint<'cow>(&self) -> std::borrow::Cow<'cow, str> {
std::borrow::Cow::Borrowed("test/message")
}
}
Expand Down

0 comments on commit be49946

Please sign in to comment.