Skip to main content

objectstore_server/
batch.rs

1//! Wire vocabulary of the batch endpoint: part header names and part names.
2//!
3//! The batch endpoint accepts two `multipart/form-data` layouts and answers in the layout of the
4//! request (see [`BatchFormat`](crate::extractors::batch::BatchFormat)):
5//!
6//! - The **header layout** carries each operation in one part and its kind, key, index, status
7//!   and metadata in part headers. Clients include [`HEADER_BATCH_OPERATION_KEY`] and
8//!   [`HEADER_BATCH_OPERATION_KIND`] on each request part; the server echoes all three, including
9//!   [`HEADER_BATCH_OPERATION_INDEX`], on each response part so clients can correlate results
10//!   with their original operations.
11//! - The **JSON layout** carries each operation in a JSON part named by its index (`"0"`, `"1"`,
12//!   …) plus a payload part named `"<i>.payload"` (`"0.payload"`) for inserts and successful
13//!   gets. Parts carry no headers besides `Content-Disposition` and `Content-Type`.
14
15/// Zero-based position of this operation within the batch, set by the server on response parts.
16///
17/// Clients use this to match each response part back to its corresponding request operation.
18pub const HEADER_BATCH_OPERATION_INDEX: &str = "x-sn-batch-operation-index";
19
20/// Object key for this batch operation, required on request parts.
21///
22/// The key is escaped with [`encode_header_value`](objectstore_types::headers::encode_header_value)
23/// so that keys containing characters a header value cannot carry — non-ASCII in particular — still
24/// survive the transport.
25pub const HEADER_BATCH_OPERATION_KEY: &str = "x-sn-batch-operation-key";
26
27/// Operation kind for this batch part: `"get"`, `"head"`, `"insert"`, or `"delete"`.
28pub const HEADER_BATCH_OPERATION_KIND: &str = "x-sn-batch-operation-kind";