Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This article explains how to encode and send data on the wire.
Frame protocol for sending chunks
The request/response payload is broken into frames to send the chunks. Each frame has a header that declares its frame type, extended header size, payload size, and extended header. All binary structures must be provided in big-endian byte order.
Frame type
Four frame types are supported:
MessageJSON– Must be the first frame; contains request or response-body structured data serialized via JSON.Chunk– Contains the full binary content for a given chunk.ChunkIdis stored in the extended header field, and chunk data bytes are stored in the frame payload.- Frame Extended Header – Used for additional data for
ChunkandChunkRangeframes. - Frame Payload – The frame payload is all the data in binary format.
- Frame Extended Header – Used for additional data for
ChunkRange- Contains the partial binary content for a chunk.ChunkId,offset,length, andFlagsare stored in the extended header field, and chunk data bytes are stored in the frame payload.EndFrame– Must be the last frame; indicates the end of the request payload.
The table lists all frame types and expected values for the fields:
| FrameType Name | FrameType | ExtendedHeader Size | Payload Size | Extended Header Contents | Extended Header Encoding | Frame Payload |
|---|---|---|---|---|---|---|
MessageJSON |
2 | 0 | 64-bit integer | Empty | N/A | Structured data applicable to that request or response |
Chunk |
3 | 16 | 64-bit integer | ChunkId (128-bit spooky hash) |
Raw bytes | All chunk data bytes |
ChunkRange |
4 | 36 | 64-bit integer |
|
Raw bytes (all numbers in big-endian byte order) | Chunk range bytes |
EndFrame |
1 | 0 | 0 | Empty | N/A | Empty |
ChunkRange extended header: This data is laid out in bytes as detailed in the preceding table. For the Flags field, these are the only valid values (for the 32-bit unsigned integer) currently:
- 0 - Indicates a
ChunkRangebetween the chunk. - 1 – Indicates the
ChunkRange, which includes the end of the chunk.
Upload request stream example for zip archive file
Upload request stream example for non-zip archive file
Sample PutChunkedFile MessageJSON for a non-zip archive file:
{
"ContentProperties": [],
"Signatures": [
{
"StreamId": "MainContent",
"ChunkingScheme": "FullFile",
"ChunkSignatures": [
{
"ChunkId": "P4oXyRH4V/AHALoD7GZ9Yw==",
"Length": 199999
}
]
},
{
"StreamId": "Alternate",
"ChunkingScheme": "FullFile",
"ChunkSignatures": [
{
"ChunkId": "YKWPmdVdMY14qK003yTMXg==",
"Length": 2999
}
]
}
],
"UploadSessionTokenToCommit": null
}
GetChunks response stream example for zip archive file:
Note
The MessageJSON for all the requests and responses are encoded by using JSON.
Next steps
Learn about Multi-request file uploads.