Refactor documentation

Signed-off-by: Shubham Sharma <shubhash@microsoft.com>
This commit is contained in:
Shubham Sharma 2022-02-21 15:54:25 +05:30
parent 487e8bc089
commit a056a30e93
1 changed files with 3 additions and 11 deletions

View File

@ -342,22 +342,14 @@ func (s *SQLServer) Features() []state.Feature {
}
// Multi performs multiple updates on a Sql server store.
// From the transaction request, only the most recent operation per key is applied.
// Other operations are redundant, and therefore safe to remove. For example,
//
// Input transaction:
// upsert k1 v1 // redundant
// delete k1
// delete k2 // redundant
// upsert k2 v2
// Output transaction:
// delete k1
// upsert k2 v2
func (s *SQLServer) Multi(request *state.TransactionalStateRequest) error {
keyMap := make(map[string]struct{})
var sets []state.SetRequest
var deletes []state.DeleteRequest
// The order of unique key requests does not matter in an atomic transaction.
// Only the latest operation for any unique key is selected for execution.
// The other operations are redundant, and hence ignored.
for i := len(request.Operations) - 1; i >= 0; i-- {
req := request.Operations[i]
switch req.Operation {