-
Notifications
You must be signed in to change notification settings - Fork 111
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
base: develop
Are you sure you want to change the base?
Conversation
bors try |
tryBuild 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]>
526bdf3
to
5fda89d
Compare
self.0 | ||
.txn(Txn::new().when(cmps).and_then(ops_success).or_else(fops)) | ||
.await | ||
.context(TxnErr { |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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>, |
There was a problem hiding this comment.
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]) ?
This change adds API to do Compare-and-Swap operations to the persistent store via io-engine.