Commit d6a281d7 authored by chiaming2000's avatar chiaming2000 Committed by GitHub
Browse files

Update README.md

Add Error Cases for the Batch Operation description.
parent 2af1e79d
Loading
Loading
Loading
Loading
+38 −8
Original line number Diff line number Diff line
@@ -1704,7 +1704,6 @@ command{
  messageType: START_BATCH
  batchID: ...
  }
  
  body {
  }
}
@@ -1713,17 +1712,17 @@ command{
**START_BATCH Response Message**

```
command: 
command { 
  header {
    connectionID: ...
    ackSequence: ...
    // The messageType should be START_BATCH_RESPONSE
    messageType: START_BATCH_RESPONSE
  }
  
  status {
    code: SUCCESS
  }
}
```

**END_BATCH Request Message**
@@ -1737,7 +1736,6 @@ Command {
    messageType: END_BATCH
    batchID: ...
  }
  
  body {
    batch {
      count: 2
@@ -1768,3 +1766,35 @@ Command{
}
```

Error Cases:

If an error is detected before received the END_BATCH command, such as received more than maximum allowed commands within a batch, the device sent an Unsolicited Status Message and closed the connection. The StatusCode is set to INVALID_REQUEST and the cause is set to the StatusMessage.

If an error is detected after received the END_BATCH command, such as encountered a version mismatch for a PUT command, the device sends a END_BATCH_RESPONSE message with status code set to INVALID_BATCH.  The failed sequence number of the command that caused the failure is set in the failedSequence field of the END_BATCH_RESPONSE message. 

If the device is LOCKed before an END BATCH is received, the device returns an Unsolicited Status Message (INVALID_REQUEST status code, Device Locked message) and the uncommitted batch is removed.  If an END BATCH is received and the batch has started processing, the batch is processed before the device is LOCKed.

If an ISE command is received before an END BATCH is received, the device sends an Unsolicited Status Message and closes the connection. The uncommitted batch is removed.

Example INVALID_BATCH response message

```
command {
  header {
    connectionID: ...
    ackSequence: ...
    messageType: END_BATCH_RESPONSE
  }
  body {
    batch {
      sequence: ...
      sequence: ...
      failedSequence: ...
    }
  }
  status {
    code: INVALID_BATCH
    statusMessage: "Version mismatch"
  }
}
```