reifydb_core/interface/
version.rs

1// Copyright (c) reifydb.com 2025
2// This file is licensed under the AGPL-3.0-or-later, see license.md file
3
4use std::fmt;
5
6/// Type of system component
7#[derive(Clone, Debug)]
8pub enum ComponentType {
9	/// Main database package
10	Package,
11	/// Core library module
12	Module,
13	/// Runtime subsystem
14	Subsystem,
15	/// Build information
16	Build,
17}
18
19impl fmt::Display for ComponentType {
20	fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
21		match self {
22			ComponentType::Package => write!(f, "package"),
23			ComponentType::Module => write!(f, "module"),
24			ComponentType::Subsystem => write!(f, "subsystem"),
25			ComponentType::Build => write!(f, "build"),
26		}
27	}
28}
29
30/// Represents version information for a system component
31#[derive(Clone, Debug)]
32pub struct SystemVersion {
33	/// Name of the component
34	pub name: String,
35	/// Version string (semantic version, git hash, etc.)
36	pub version: String,
37	/// Human-readable description of the component
38	pub description: String,
39	/// Type of component
40	pub r#type: ComponentType,
41}
42
43/// Trait for components that provide version information
44pub trait HasVersion {
45	/// Returns the version information for this component
46	fn version(&self) -> SystemVersion;
47}