Skip to main content

inferadb_ledger_proto/
lib.rs

1//! Protobuf types and conversions for InferaDB Ledger.
2//!
3//! This crate provides:
4//! - Generated protobuf types and gRPC service traits ([`proto`])
5//! - Bidirectional conversions between domain types and proto types ([`convert`])
6//!
7//! # Architecture
8//!
9//! Extracted from the `raft` crate so that consumers needing only wire-format
10//! types (e.g., the SDK) can avoid pulling in Raft consensus internals.
11
12#![deny(unsafe_code)]
13// gRPC services return tonic::Status (176 bytes) - standard practice for gRPC error handling
14#![allow(clippy::result_large_err)]
15
16/// Generated protobuf types and service traits.
17pub mod proto {
18    #![allow(clippy::all)]
19    #![allow(missing_docs)]
20
21    // Use pre-generated code when proto files aren't available (crates.io)
22    #[cfg(use_pregenerated_proto)]
23    include!("generated/ledger.v1.rs");
24
25    // Use build-time generated code in development
26    #[cfg(not(use_pregenerated_proto))]
27    tonic::include_proto!("ledger.v1");
28}
29
30/// Serialized `FileDescriptorSet` for gRPC reflection.
31///
32/// Embedded at compile time from the prost-generated descriptor binary.
33/// When building from source, this is generated by the build script.
34/// When using pre-generated code (crates.io), this is bundled from `src/generated/`.
35#[cfg(not(use_pregenerated_proto))]
36pub const FILE_DESCRIPTOR_SET: &[u8] = tonic::include_file_descriptor_set!("ledger_v1_descriptor");
37
38/// Serialized `FileDescriptorSet` for gRPC reflection (pre-generated for crates.io).
39#[cfg(use_pregenerated_proto)]
40pub const FILE_DESCRIPTOR_SET: &[u8] = include_bytes!("generated/ledger_v1_descriptor.bin");
41
42/// Bidirectional conversions between domain and protobuf types.
43pub mod convert;