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

feat(io-engine): add persistent store transaction API #1791

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

dsharma-dc
Copy link
Contributor

This change adds API to do Compare-and-Swap operations to the persistent store via io-engine.

@dsharma-dc
Copy link
Contributor Author

bors try

bors-openebs-mayastor bot pushed a commit that referenced this pull request Dec 20, 2024
@bors-openebs-mayastor
Copy link

try

Build succeeded:

This change adds API to do Compare-and-Swap operations
to the persistent store via io-engine.

Signed-off-by: Diwakar Sharma <[email protected]>
self.0
.txn(Txn::new().when(cmps).and_then(ops_success).or_else(fops))
.await
.context(TxnErr {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we get an error on the logs which is clear as to what happened?

) -> Result<TxnResponse, StoreError> {
let fops = ops_failure.map_or(vec![], |v| v);
self.0
.txn(Txn::new().when(cmps).and_then(ops_success).or_else(fops))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this or_else doing?

async fn txn_kv<K: StoreKey>(
&mut self,
key: &K,
cmps: Vec<Compare>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need an array here? Can't we just do .when([cmp]) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants