Skip to content

Commit 2ae167a

Browse files
refactor(ts): newTransaction() -> transaction()
1 parent 055102d commit 2ae167a

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

crypto-ffi/bindings/js/src/shared/CoreCryptoInstance.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@ export class CoreCrypto extends CoreCryptoFfi {
7070
*
7171
* @returns the result of the callback will be returned from this call
7272
*/
73-
async newTransaction<R>(
73+
async transaction<R>(
7474
callback: (ctx: CoreCryptoContext) => Promise<R>
7575
): Promise<R> {
7676
let result!: R;
7777
let error: CoreCryptoError | Error | null = null;
7878
let needOuterRethrow = false;
7979
try {
80-
await super.transaction({
80+
await super.transactionFfi({
8181
execute: async (ctx: CoreCryptoFfiTypes.CoreCryptoContext) => {
8282
try {
8383
result = await callback(new CoreCryptoContext(ctx));
@@ -112,10 +112,10 @@ export class CoreCrypto extends CoreCryptoFfi {
112112
/** @internal
113113
* We're overriding this just to hide it from the docs
114114
*/
115-
async transaction(
115+
async transactionFfi(
116116
command: CoreCryptoFfiTypes.CoreCryptoCommand,
117117
asyncOpts_?: { signal: AbortSignal }
118118
): Promise<void> {
119-
return super.transaction(command, asyncOpts_);
119+
return super.transactionFfi(command, asyncOpts_);
120120
}
121121
}

crypto-ffi/src/core_crypto/command/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ impl CoreCryptoFfi {
4747
/// Ok(())
4848
/// }))?;
4949
/// ```
50-
pub async fn transaction(&self, command: Command) -> CoreCryptoResult<()> {
51-
log::info!(scope = "CoreCryptoFfi::transaction", stage = 1; "awaiting transaction semaphore");
50+
pub async fn transaction_ffi(&self, command: Command) -> CoreCryptoResult<()> {
51+
log::info!(scope = "CoreCryptoFfi::transaction_ffi", stage = 1; "awaiting transaction semaphore");
5252
let inner_context = Arc::new(self.inner.new_transaction().await?);
53-
log::info!(scope = "CoreCryptoFfi::transaction", stage = 2; "acquired semaphore; creating context");
53+
log::info!(scope = "CoreCryptoFfi::transaction_ffi", stage = 2; "acquired semaphore; creating context");
5454

5555
let context = CoreCryptoContext {
5656
inner: inner_context.clone(),
@@ -61,19 +61,19 @@ impl CoreCryptoFfi {
6161
// to reuse the code in both target contexts.
6262
let context = Arc::new(context);
6363

64-
log::info!(scope = "CoreCryptoFfi::transaction", stage = 3; "created context; executing command");
64+
log::info!(scope = "CoreCryptoFfi::transaction_ffi", stage = 3; "created context; executing command");
6565
let result = command.execute(context).await;
6666
match result {
6767
Ok(()) => {
68-
log::info!(scope = "CoreCryptoFfi::transaction", stage = 4, command_success = true; "command succeeded; committing transaction");
68+
log::info!(scope = "CoreCryptoFfi::transaction_ffi", stage = 4, command_success = true; "command succeeded; committing transaction");
6969
inner_context.finish().await?;
70-
log::info!(scope = "CoreCryptoFfi::transaction", stage = 5, command_success = true; "exiting successfully");
70+
log::info!(scope = "CoreCryptoFfi::transaction_ffi", stage = 5, command_success = true; "exiting successfully");
7171
Ok(())
7272
}
7373
Err(err) => {
74-
log::info!(scope = "CoreCryptoFfi::transaction", stage = 4, command_success = false; "command failed; aborting transaction");
74+
log::info!(scope = "CoreCryptoFfi::transaction_ffi", stage = 4, command_success = false; "command failed; aborting transaction");
7575
inner_context.abort().await?;
76-
log::info!(scope = "CoreCryptoFfi::transaction", stage = 5, command_success = false, err:err; "exiting propagating error");
76+
log::info!(scope = "CoreCryptoFfi::transaction_ffi", stage = 5, command_success = false, err:err; "exiting propagating error");
7777
Err(err)
7878
}
7979
}

0 commit comments

Comments
 (0)