Module body_image::barc [−][src]
Body Archive container file format, reader and writer.
BARC is a minimal container file format for the storage or one to many
HTTP request/response dialog records. A fixed length ASCII-limited record
head specifies lengths of a subsequent series of request and response
header blocks and bodies which are stored as raw (unencoded) bytes. When
not using the internal compression feature, the format is easily human
readable. With compression, the barc
CLI tool can be used to view
records.
See some sample files in source sample/*.barc.
Other features:
-
An additional meta-headers block provides more recording details and can also be used to store application-specific values.
-
Sequential or random-access reads by record offset (which could be stored in an external index or database).
-
Single-writer sessions are guaranteed safe with N concurrent readers (in or out of process).
-
Optional per-record gzip or Brotli compression (headers and bodies)
Structs
BarcFile |
Reference to a BARC File by |
BarcReader |
BARC file handle for read access. Each reader has its own file handle and position. |
BarcWriter |
BARC file handle for write access. |
BrotliCompressStrategy |
Strategy for Brotli compression. Will not compress if a minimum length estimate is not reached. |
GzipCompressStrategy |
Strategy for gzip compression. Will not compress if a minimum length estimate is not reached. |
NoCompressStrategy |
Strategy of no (aka |
Record |
An owned BARC record with public fields. |
Enums
BarcError |
Error enumeration for all barc module errors. This may be extended in the future, so exhaustive matching is gently discouraged with an unused variant. |
Compression |
BARC record compression mode. |
DialogConvertError |
Error enumeration for failures when converting from a |
EncodeWrapper |
Wrapper holding a potentially encoding |
RecordType |
BARC record type. |
Constants
V2_HEAD_SIZE |
Fixed record head size including CRLF terminator: 54 Bytes |
V2_MAX_HBLOCK |
Maximum header (meta, request, response) block size, including any CRLF terminator: 220 (1 MiB) - 1. |
V2_MAX_RECORD |
Maximum total record length, excluding the record head: 248 (256 TiB) - 1. Note: this exceeds the file or partition size limits of many file-systems. |
V2_MAX_REQ_BODY |
Maximum request body size, including any CRLF terminator: 240 (1 TiB) - 1. |
Statics
META_METHOD |
[ Deprecated ] Meta header name bytes for the HTTP method used in the request, e.g. "GET", "POST", etc. |
META_RES_DECODED |
[ Deprecated ] Meta header name bytes for a list of content or transfer encodings decoded for the current response body. The value is in HTTP content-encoding header format, e.g. "chunked, gzip". |
META_RES_STATUS |
[ Deprecated ] Meta header name bytes for the response numeric status code, SPACE, and then a standardized reason phrase, e.g. "200 OK". The later is intended only for human readers. |
META_RES_VERSION |
[ Deprecated ] Meta header name bytes for the response version, e.g. "HTTP/1.1", "HTTP/2.0", etc. |
META_URL |
[ Deprecated ] Meta header name bytes for the complete URL used in the request. |
Traits
CompressStrategy |
Strategies for BARC record compression encoding on write. |
MetaRecorded |
Access to BARC |
Functions
hname_meta_method |
Meta |
hname_meta_res_decoded |
Meta |
hname_meta_res_status |
Meta |
hname_meta_res_version |
Meta |
hname_meta_url |
Meta |
write_body |
Write body to out, with optional CR+LF end padding, and return the length
written. This is primarily an implementation detail of |
write_headers |
Write header block to out, with optional CR+LF end padding, and return the
length written. This is primarily an implementation detail of |