info.rs

Overview

The info.rs file defines a data structure representing server information in a GraphQL API context. This structure encapsulates various server metrics such as version, timestamps, latencies related to blocks, messages, and transactions, as well as configuration details like batch size and endpoint alternatives. The primary purpose is to provide clients with detailed status and metadata about the server's state and performance.

Structs

Info

A GraphQL SimpleObject struct designed to expose server information fields to API clients. It uses camelCase naming for GraphQL fields via the #[graphql(rename_fields = "camelCase")] attribute.

Fields

Implementation Details

Usage Example

use info::Info;

let server_info = Info::default();
println!("Server version: {:?}", server_info.version);
println!("Current time (ms): {:?}", server_info.time);

This struct is typically returned in GraphQL queries to provide clients with the server's current status and performance metrics.

Interaction with Other Modules

Diagram

classDiagram
class Info {
+version: Option<String>
+time: Option<f64>
+blocks_latency: Option<f64>
+messages_latency: Option<f64>
+transactions_latency: Option<f64>
+latency: Option<f64>
+last_block_time: Option<f64>
+endpoints: Option<Vec<Option<String>>>
+chain_order_boundary: Option<String>
+remp_enabled: Option<bool>
+batch_size: Option<u16>
+default()
}

This diagram illustrates the Info struct with all its fields and the default constructor.

Notes on Implementation