feat(ctrader-openapi): length-delimited protobuf codec

CTraderCodec implements tokio_util Decoder+Encoder with 4-byte BE length
prefix framing. Handles partial frames, multiple frames in buffer, and
rejects oversized frames (16 MiB max). 5 unit tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jgrusewski
2026-02-22 15:35:20 +01:00
parent 43edbeaa36
commit b2a3447fd8
3 changed files with 215 additions and 0 deletions

View File

@@ -60,6 +60,16 @@ pub enum CTraderError {
/// Symbol not found in the cached symbol list.
#[error("unknown symbol: {0}")]
UnknownSymbol(String),
/// I/O error (required by `tokio_util::codec`).
#[error("io error: {0}")]
Io(String),
}
impl From<std::io::Error> for CTraderError {
fn from(e: std::io::Error) -> Self {
Self::Io(e.to_string())
}
}
/// Rate-limit bucket categories.