relay_actions/actions/identity/
view.rs1use crate::{
2 actions::Action,
3 cache::CacheManager,
4 sinks::progress::ProgressSink,
5 storage::{Identity, Storage},
6};
7use relay_lib::prelude::Address;
8
9pub struct View {
10 pub address: Address,
11}
12
13impl Action for View {
14 type Output = Identity;
15
16 fn execute(
17 &self,
18 storage: &mut Storage,
19 _cache: &mut CacheManager,
20 progress: &mut dyn ProgressSink,
21 ) -> Self::Output {
22 progress.step("Loading identity", "Loaded identity");
23
24 let identity = storage.root.get_identity(&self.address).unwrap_or_else(|| {
25 progress.abort("No identity found for the given address");
26 });
27
28 progress.done();
29 identity.clone()
30 }
31}