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

api: nested txns #7857

Closed
heyitsanthony opened this issue May 2, 2017 · 0 comments
Closed

api: nested txns #7857

heyitsanthony opened this issue May 2, 2017 · 0 comments
Assignees
Milestone

Comments

@heyitsanthony
Copy link
Contributor

Certain proxies need to transactionally operate on transactions for functional correctness.

Suppose a proxy wants to guard all requests:

Txn(ctx).If(exists(proxyKey)).Then(
   OriginalTxn
).Else(
   OpGet(proxyKey)
)

However, a client issues a put/put transaction:

Txn(ctx).If(exists(x)).Then(
    OpPut("abc", "123"),
).Else(
    OpPut("def", "456"),
)

The v3 API can't handle this case because the guard txn condition can't be merged into the client transaction without changing the txn behavior. It will require an API update.

One way to add this without too much trouble is update the RequestOp and ResponseOp messages:

message RequestOp {
  // request is a union of request types accepted by a transaction.
  oneof request {
    RangeRequest request_range = 1;
    PutRequest request_put = 2; 
    DeleteRangeRequest request_delete_range = 3; 
    TxnRequest request_txn = 4;                                                                                                             
  }                                                                                                                                                           
}

message ResponseOp {
  // response is a union of response types returned by a transaction.
  oneof response { 
    RangeResponse response_range = 1;
    PutResponse response_put = 2;
    DeleteRangeResponse response_delete_range = 3;
    TxnResponse  response_txn = 4;
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant