Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/do not consume profile #872

Merged
merged 2 commits into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions aries_vcx/src/core/profile/mixed_breed_profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,31 +49,31 @@ impl MixedBreedProfile {

#[async_trait]
impl Profile for MixedBreedProfile {
fn inject_indy_ledger_read(self: Arc<Self>) -> Arc<dyn IndyLedgerRead> {
fn inject_indy_ledger_read(&self) -> Arc<dyn IndyLedgerRead> {
Arc::clone(&self.indy_ledger_read)
}

fn inject_indy_ledger_write(self: Arc<Self>) -> Arc<dyn IndyLedgerWrite> {
fn inject_indy_ledger_write(&self) -> Arc<dyn IndyLedgerWrite> {
Arc::clone(&self.indy_ledger_write)
}

fn inject_anoncreds(self: Arc<Self>) -> Arc<dyn BaseAnonCreds> {
fn inject_anoncreds(&self) -> Arc<dyn BaseAnonCreds> {
Arc::clone(&self.anoncreds)
}

fn inject_anoncreds_ledger_read(self: Arc<Self>) -> Arc<dyn AnoncredsLedgerRead> {
fn inject_anoncreds_ledger_read(&self) -> Arc<dyn AnoncredsLedgerRead> {
Arc::clone(&self.anoncreds_ledger_read)
}

fn inject_anoncreds_ledger_write(self: Arc<Self>) -> Arc<dyn AnoncredsLedgerWrite> {
fn inject_anoncreds_ledger_write(&self) -> Arc<dyn AnoncredsLedgerWrite> {
Arc::clone(&self.anoncreds_ledger_write)
}

fn inject_wallet(&self) -> Arc<dyn BaseWallet> {
Arc::clone(&self.wallet)
}

fn update_taa_configuration(self: Arc<Self>, _taa_options: TxnAuthrAgrmtOptions) -> VcxResult<()> {
fn update_taa_configuration(&self, _taa_options: TxnAuthrAgrmtOptions) -> VcxResult<()> {
Err(AriesVcxError::from_msg(
AriesVcxErrorKind::ActionNotSupported,
format!("update_taa_configuration no implemented for MixedBreedProfile"),
Expand Down
12 changes: 6 additions & 6 deletions aries_vcx/src/core/profile/modular_libs_profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,31 +98,31 @@ impl ModularLibsProfile {

#[async_trait]
impl Profile for ModularLibsProfile {
fn inject_indy_ledger_read(self: Arc<Self>) -> Arc<dyn IndyLedgerRead> {
fn inject_indy_ledger_read(&self) -> Arc<dyn IndyLedgerRead> {
Arc::clone(&self.indy_ledger_read)
}

fn inject_indy_ledger_write(self: Arc<Self>) -> Arc<dyn IndyLedgerWrite> {
fn inject_indy_ledger_write(&self) -> Arc<dyn IndyLedgerWrite> {
Arc::clone(&self.indy_ledger_write)
}

fn inject_anoncreds(self: Arc<Self>) -> Arc<dyn BaseAnonCreds> {
fn inject_anoncreds(&self) -> Arc<dyn BaseAnonCreds> {
Arc::clone(&self.anoncreds)
}

fn inject_anoncreds_ledger_read(self: Arc<Self>) -> Arc<dyn AnoncredsLedgerRead> {
fn inject_anoncreds_ledger_read(&self) -> Arc<dyn AnoncredsLedgerRead> {
Arc::clone(&self.anoncreds_ledger_read)
}

fn inject_anoncreds_ledger_write(self: Arc<Self>) -> Arc<dyn AnoncredsLedgerWrite> {
fn inject_anoncreds_ledger_write(&self) -> Arc<dyn AnoncredsLedgerWrite> {
Arc::clone(&self.anoncreds_ledger_write)
}

fn inject_wallet(&self) -> Arc<dyn BaseWallet> {
Arc::clone(&self.wallet)
}

fn update_taa_configuration(self: Arc<Self>, taa_options: TxnAuthrAgrmtOptions) -> VcxResult<()> {
fn update_taa_configuration(&self, taa_options: TxnAuthrAgrmtOptions) -> VcxResult<()> {
self.taa_configurator
.set_txn_author_agreement_options(taa_options)
.map_err(|e| e.into())
Expand Down
12 changes: 6 additions & 6 deletions aries_vcx/src/core/profile/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ use async_trait::async_trait;

#[async_trait]
pub trait Profile: std::fmt::Debug + Send + Sync {
fn inject_indy_ledger_read(self: Arc<Self>) -> Arc<dyn IndyLedgerRead>;
fn inject_indy_ledger_read(&self) -> Arc<dyn IndyLedgerRead>;

fn inject_indy_ledger_write(self: Arc<Self>) -> Arc<dyn IndyLedgerWrite>;
fn inject_indy_ledger_write(&self) -> Arc<dyn IndyLedgerWrite>;

fn inject_anoncreds(self: Arc<Self>) -> Arc<dyn BaseAnonCreds>;
fn inject_anoncreds(&self) -> Arc<dyn BaseAnonCreds>;

fn inject_anoncreds_ledger_read(self: Arc<Self>) -> Arc<dyn AnoncredsLedgerRead>;
fn inject_anoncreds_ledger_read(&self) -> Arc<dyn AnoncredsLedgerRead>;

fn inject_anoncreds_ledger_write(self: Arc<Self>) -> Arc<dyn AnoncredsLedgerWrite>;
fn inject_anoncreds_ledger_write(&self) -> Arc<dyn AnoncredsLedgerWrite>;

fn inject_wallet(&self) -> Arc<dyn BaseWallet>;

fn update_taa_configuration(self: Arc<Self>, taa_options: TxnAuthrAgrmtOptions) -> VcxResult<()>;
fn update_taa_configuration(&self, taa_options: TxnAuthrAgrmtOptions) -> VcxResult<()>;
}
12 changes: 6 additions & 6 deletions aries_vcx/src/core/profile/vdr_proxy_profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,31 +78,31 @@ impl VdrProxyProfile {

#[async_trait]
impl Profile for VdrProxyProfile {
fn inject_indy_ledger_read(self: Arc<Self>) -> Arc<dyn IndyLedgerRead> {
fn inject_indy_ledger_read(&self) -> Arc<dyn IndyLedgerRead> {
Arc::clone(&self.indy_ledger_read)
}

fn inject_indy_ledger_write(self: Arc<Self>) -> Arc<dyn IndyLedgerWrite> {
fn inject_indy_ledger_write(&self) -> Arc<dyn IndyLedgerWrite> {
Arc::clone(&self.indy_ledger_write)
}

fn inject_anoncreds(self: Arc<Self>) -> Arc<dyn BaseAnonCreds> {
fn inject_anoncreds(&self) -> Arc<dyn BaseAnonCreds> {
Arc::clone(&self.anoncreds)
}

fn inject_anoncreds_ledger_read(self: Arc<Self>) -> Arc<dyn AnoncredsLedgerRead> {
fn inject_anoncreds_ledger_read(&self) -> Arc<dyn AnoncredsLedgerRead> {
Arc::clone(&self.anoncreds_ledger_read)
}

fn inject_anoncreds_ledger_write(self: Arc<Self>) -> Arc<dyn AnoncredsLedgerWrite> {
fn inject_anoncreds_ledger_write(&self) -> Arc<dyn AnoncredsLedgerWrite> {
Arc::clone(&self.anoncreds_ledger_write)
}

fn inject_wallet(&self) -> Arc<dyn BaseWallet> {
Arc::clone(&self.wallet)
}

fn update_taa_configuration(self: Arc<Self>, taa_options: TxnAuthrAgrmtOptions) -> VcxResult<()> {
fn update_taa_configuration(&self, taa_options: TxnAuthrAgrmtOptions) -> VcxResult<()> {
self.taa_configurator
.set_txn_author_agreement_options(taa_options)
.map_err(|e| e.into())
Expand Down
12 changes: 6 additions & 6 deletions aries_vcx/src/core/profile/vdrtools_profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,31 +43,31 @@ impl VdrtoolsProfile {

#[async_trait]
impl Profile for VdrtoolsProfile {
fn inject_indy_ledger_read(self: Arc<Self>) -> Arc<dyn IndyLedgerRead> {
fn inject_indy_ledger_read(&self) -> Arc<dyn IndyLedgerRead> {
Arc::clone(&self.indy_ledger_read)
}

fn inject_indy_ledger_write(self: Arc<Self>) -> Arc<dyn IndyLedgerWrite> {
fn inject_indy_ledger_write(&self) -> Arc<dyn IndyLedgerWrite> {
Arc::clone(&self.indy_ledger_write)
}

fn inject_anoncreds(self: Arc<Self>) -> Arc<dyn BaseAnonCreds> {
fn inject_anoncreds(&self) -> Arc<dyn BaseAnonCreds> {
Arc::clone(&self.anoncreds)
}

fn inject_anoncreds_ledger_read(self: Arc<Self>) -> Arc<dyn AnoncredsLedgerRead> {
fn inject_anoncreds_ledger_read(&self) -> Arc<dyn AnoncredsLedgerRead> {
Arc::clone(&self.anoncreds_ledger_read)
}

fn inject_anoncreds_ledger_write(self: Arc<Self>) -> Arc<dyn AnoncredsLedgerWrite> {
fn inject_anoncreds_ledger_write(&self) -> Arc<dyn AnoncredsLedgerWrite> {
Arc::clone(&self.anoncreds_ledger_write)
}

fn inject_wallet(&self) -> Arc<dyn BaseWallet> {
Arc::clone(&self.wallet)
}

fn update_taa_configuration(self: Arc<Self>, _taa_options: TxnAuthrAgrmtOptions) -> VcxResult<()> {
fn update_taa_configuration(&self, _taa_options: TxnAuthrAgrmtOptions) -> VcxResult<()> {
Err(AriesVcxError::from_msg(
AriesVcxErrorKind::ActionNotSupported,
format!("update_taa_configuration no implemented for VdrtoolsProfile"),
Expand Down
12 changes: 6 additions & 6 deletions aries_vcx/src/utils/mockdata/profile/mock_profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,31 @@ pub struct MockProfile;

#[async_trait]
impl Profile for MockProfile {
fn inject_indy_ledger_read(self: Arc<Self>) -> Arc<dyn IndyLedgerRead> {
fn inject_indy_ledger_read(&self) -> Arc<dyn IndyLedgerRead> {
Arc::new(MockLedger {})
}

fn inject_indy_ledger_write(self: Arc<Self>) -> Arc<dyn IndyLedgerWrite> {
fn inject_indy_ledger_write(&self) -> Arc<dyn IndyLedgerWrite> {
Arc::new(MockLedger {})
}

fn inject_anoncreds(self: Arc<Self>) -> Arc<dyn BaseAnonCreds> {
fn inject_anoncreds(&self) -> Arc<dyn BaseAnonCreds> {
Arc::new(MockAnoncreds {})
}

fn inject_anoncreds_ledger_read(self: Arc<Self>) -> Arc<dyn AnoncredsLedgerRead> {
fn inject_anoncreds_ledger_read(&self) -> Arc<dyn AnoncredsLedgerRead> {
Arc::new(MockLedger {})
}

fn inject_anoncreds_ledger_write(self: Arc<Self>) -> Arc<dyn AnoncredsLedgerWrite> {
fn inject_anoncreds_ledger_write(&self) -> Arc<dyn AnoncredsLedgerWrite> {
Arc::new(MockLedger {})
}

fn inject_wallet(&self) -> Arc<dyn BaseWallet> {
Arc::new(MockWallet {})
}

fn update_taa_configuration(self: Arc<Self>, _taa_options: TxnAuthrAgrmtOptions) -> VcxResult<()> {
fn update_taa_configuration(&self, _taa_options: TxnAuthrAgrmtOptions) -> VcxResult<()> {
error!("update_taa_configuration not implemented for MockProfile");
Ok(())
}
Expand Down