Skip to content

Commit acedcd5

Browse files
committed
rename ResponseBody::Single to ResponseBody::Bytes
1 parent a1e6add commit acedcd5

1 file changed

Lines changed: 16 additions & 10 deletions

File tree

sdk/cosmos/azure_data_cosmos_driver/docs/FEED_OPERATIONS_SPEC.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,9 +1508,10 @@ impl CosmosDriver {
15081508
### 10.2 CosmosResponse Changes
15091509

15101510
`CosmosResponse` gains an optional continuation token, and its `body` field becomes a
1511-
`ResponseBody` enum to support both single-document responses (point operations) and
1512-
multi-document responses (feed operations) without forcing every caller to parse a feed
1513-
envelope:
1511+
`ResponseBody` enum to support both unparsed response bodies (point operations and
1512+
single-page feeds the driver passes through verbatim) and pre-parsed item lists
1513+
(feeds the driver had to aggregate or whose envelopes it had to crack open),
1514+
without forcing every caller to parse a feed envelope:
15141515

15151516
```rust
15161517
/// The body of a Cosmos DB response.
@@ -1523,16 +1524,21 @@ pub enum ResponseBody {
15231524
/// No body (e.g., 204 No Content).
15241525
None,
15251526

1526-
/// A single document body — raw serialized bytes.
1527-
/// Used for point operations (read, create, upsert, replace) and for
1528-
/// resource reads (database, container).
1529-
Single(Vec<u8>),
1527+
/// A response body the driver did not need to parse — raw serialized bytes.
1528+
/// Used for any operation where the driver passes the server response through
1529+
/// verbatim. Depending on the operation, the caller (the SDK) knows whether
1530+
/// these bytes represent a single item (point reads, create/upsert/replace,
1531+
/// resource reads like database/container) or a page of feed data (feed
1532+
/// operations whose envelope the driver did not need to crack open).
1533+
Bytes(Vec<u8>),
15301534

15311535
/// A list of document bodies — one entry per item, each entry being
15321536
/// the raw serialized bytes of one item.
1533-
/// Used for feed operations (ReadAll, future query/read-many).
1534-
/// The driver parses the response envelope to split items into a
1535-
/// `Vec<Vec<u8>>` but does not deserialize the items themselves.
1537+
/// Used for feed operations (ReadAll, future query/read-many) when the
1538+
/// driver had to aggregate results across partitions or otherwise parse
1539+
/// the feed envelope. Exists so the driver does not have to re-serialize
1540+
/// the parsed items just to hand them back to the SDK. The driver does
1541+
/// not deserialize the items themselves.
15361542
Items(Vec<Vec<u8>>),
15371543
}
15381544

0 commit comments

Comments
 (0)