Expand description
Body Archive container file format, reader and writer.
BARC is a container file format for the storage or one to many HTTP
request/response dialog records. A fixed length, ASCII-only 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 (barc-cli crate) 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§
- Barc
File - Reference to a BARC File by
Path
, supporting up to 1 writer and N readers concurrently. - Barc
Reader - BARC file handle for read access. Each reader has its own file handle and position.
- Barc
Writer - BARC file handle for write access.
- Brotli
Compress Strategy - Strategy for Brotli compression.
- Encode
Wrapper - Wrapper holding a potentially encoding
Write
reference for the underlying BARCFile
reference. - Gzip
Compress Strategy - Strategy for gzip compression.
- NoCompress
Strategy - Strategy of no (aka
Plain
) compression. - Record
- An owned BARC record with public fields.
Enums§
- Barc
Error - Error enumeration for all barc module errors.
- Compression
- BARC record compression mode.
- Dialog
Convert Error - Error enumeration for failures when converting from a
Record
to aDialog
. - Record
Type - 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.
- V2_
MAX_ REQ_ BODY - Maximum request body size, including any CRLF terminator: 240 (1 TiB) - 1.
Traits§
- Compress
Strategy - Strategies for BARC record compression encoding on write.
- Meta
Recorded - Access to BARC
Record
compatible objects by reference, extendingRecorded
with meta-headers and a record type.
Functions§
- hname_
meta_ method - Meta
HeaderName
for the HTTP method used in the request, e.g. “GET”, “POST”, etc. - hname_
meta_ res_ decoded - Meta
HeaderName
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”. - hname_
meta_ res_ status - Meta
HeaderName
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. - hname_
meta_ res_ version - Meta
HeaderName
for the response version, e.g. “HTTP/1.1”, “HTTP/2.0”, etc. - hname_
meta_ url - Meta
HeaderName
for the complete URL used in the request. - write_
body - Write body to out, with optional CR+LF end padding, and return the length
written. This is primarily an implementation detail of
BarcWriter
, but is made public for its general diagnostic utility. - 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
BarcWriter
, but is made public for its general diagnostic utility.
Type Aliases§
- Flaw
- Conveniently compact type alias for dyn Trait
std::error::Error
.