@@ -676,10 +676,18 @@ impl ProcessingEngineMetrics for Catalog {
676676 }
677677}
678678
679+ /// General purpose type for storing a collection of things in the catalog
680+ ///
681+ /// Each item in the repository has a unique identifier and name. The repository tracks the next
682+ /// identifier that will be used for a new resource added to the repository, with the assumption
683+ /// that identifiers are monotonically increasing unsigned integers.
679684#[ derive( Debug , Clone , Eq , PartialEq ) ]
680685pub struct Repository < I : CatalogId , R : CatalogResource > {
686+ /// Store for items in the repository
681687 pub ( crate ) repo : SerdeVecMap < I , Arc < R > > ,
688+ /// Bi-directional map of identifiers to names in the repository
682689 pub ( crate ) id_name_map : BiHashMap < I , Arc < str > > ,
690+ /// The next identifier that will be used when a new resource is added to the repository
683691 pub ( crate ) next_id : I ,
684692}
685693
@@ -821,16 +829,18 @@ impl<I: CatalogId, R: CatalogResource> Default for Repository<I, R> {
821829
822830#[ derive( Debug , Clone ) ]
823831pub struct InnerCatalog {
832+ /// A unique monotonically increasing sequence to differentiate the catalog state as it changes
833+ /// over time.
824834 pub ( crate ) sequence : CatalogSequenceNumber ,
825835 /// The `catalog_id` is the user-provided value used to prefix catalog paths on the object store
826836 pub ( crate ) catalog_id : Arc < str > ,
827837 /// The `catalog_uuid` is a unique identifier to distinguish catalog instantiations
828838 pub ( crate ) catalog_uuid : Uuid ,
839+ /// Collection of nodes in the catalog
829840 pub ( crate ) nodes : Repository < NodeId , NodeDefinition > ,
830- /// The catalog is a map of databases with their table schemas
841+ /// Collection of databases in the catalog
831842 pub ( crate ) databases : Repository < DbId , DatabaseSchema > ,
832- /// This holds all the tokens created and saved in catalog
833- /// saved in catalog snapshot
843+ /// Collection of tokens in the catalog
834844 pub ( crate ) tokens : TokenRepository ,
835845}
836846
@@ -1044,13 +1054,27 @@ impl InnerCatalog {
10441054 }
10451055}
10461056
1057+ /// The definition of a node in the catalog
10471058#[ derive( Debug , Eq , PartialEq , Clone ) ]
10481059pub struct NodeDefinition {
1060+ /// User-provided, unique name for the node
1061+ ///
1062+ /// # Note
1063+ ///
1064+ /// The naming may be a bit confusing for this. This may be more aptly named `node_name`;
1065+ /// however, it is `node_id`, because this corresponds to the user-provided `--node-id` that is
1066+ /// used to identify the node on server start. The unique and automatically generated catalog
1067+ /// identifier for the node is stored in `node_catalog_id`.
10491068 pub ( crate ) node_id : Arc < str > ,
1069+ /// Unique identifier for the node in the catalog
10501070 pub ( crate ) node_catalog_id : NodeId ,
1071+ /// A UUID generated when the node is first registered into the catalog
10511072 pub ( crate ) instance_id : Arc < str > ,
1073+ /// The mode the node is operating in
10521074 pub ( crate ) mode : Vec < NodeMode > ,
1075+ /// The number of cores this node is using
10531076 pub ( crate ) core_count : u64 ,
1077+ /// The state of the node
10541078 pub ( crate ) state : NodeState ,
10551079}
10561080
@@ -1087,18 +1111,27 @@ impl NodeDefinition {
10871111 }
10881112}
10891113
1114+ /// The state of a node in an InfluxDB 3 cluster
10901115#[ derive( Debug , Eq , PartialEq , Clone , Copy , Serialize , Deserialize ) ]
10911116pub enum NodeState {
1117+ /// A node is set to `Running` when first started and registered into the catalog
10921118 Running { registered_time_ns : i64 } ,
1119+ /// A node is set to `Stopped` during graceful shutdown
10931120 Stopped { stopped_time_ns : i64 } ,
10941121}
10951122
1123+ /// Definition of a database in the catalog
10961124#[ derive( Debug , Eq , PartialEq , Clone ) ]
10971125pub struct DatabaseSchema {
1126+ /// Unique identifier for the database
10981127 pub id : DbId ,
1128+ /// Unique user-provided name for the database
10991129 pub name : Arc < str > ,
1130+ /// Tables contained in the database
11001131 pub tables : Repository < TableId , TableDefinition > ,
1132+ /// Processing engine triggers configured on the database
11011133 pub processing_engine_triggers : Repository < TriggerId , TriggerDefinition > ,
1134+ /// Whether this database has been flagged as deleted
11021135 pub deleted : bool ,
11031136}
11041137
@@ -1525,16 +1558,32 @@ fn make_new_name_using_deleted_time(name: &str, deletion_time: Time) -> Arc<str>
15251558 ) )
15261559}
15271560
1561+ /// Definition of a table in the catalog
15281562#[ derive( Debug , Eq , PartialEq , Clone ) ]
15291563pub struct TableDefinition {
1564+ /// Unique identifier of the table in the catalog
15301565 pub table_id : TableId ,
1566+ /// User-provided unique name for the table
15311567 pub table_name : Arc < str > ,
1568+ /// The IOx/Arrow schema for the table
15321569 pub schema : Schema ,
1570+ /// Column definitions for the table
15331571 pub columns : Repository < ColumnId , ColumnDefinition > ,
1572+ /// List of column identifiers that form the series key for the table
1573+ ///
1574+ /// The series key along with the `time` column form the primary key for the table. The series
1575+ /// key is determined as the order of tags provided when the table is first created, either by
1576+ /// a write of line protocol, or by an explicit table creation.
1577+ ///
1578+ /// The series key is used as the sort order, i.e., sort key, for the table during persistence.
15341579 pub series_key : Vec < ColumnId > ,
1580+ /// The names of the columns in the table's series key
15351581 pub series_key_names : Vec < Arc < str > > ,
1582+ /// Last cache definitions for the table
15361583 pub last_caches : Repository < LastCacheId , LastCacheDefinition > ,
1584+ /// Distinct cache definitions for the table
15371585 pub distinct_caches : Repository < DistinctCacheId , DistinctCacheDefinition > ,
1586+ /// Whether this table has been set as deleted
15381587 pub deleted : bool ,
15391588}
15401589
@@ -1919,11 +1968,16 @@ impl TableUpdate for DeleteLastCacheLog {
19191968 }
19201969}
19211970
1971+ /// Definition of a column in the catalog
19221972#[ derive( Debug , Eq , PartialEq , Clone ) ]
19231973pub struct ColumnDefinition {
1974+ /// Unique identifier of the column in the catalog
19241975 pub id : ColumnId ,
1976+ /// User-provided unique name for the column
19251977 pub name : Arc < str > ,
1978+ /// Influx type of the column
19261979 pub data_type : InfluxColumnType ,
1980+ /// Whether this column can hold `NULL` values
19271981 pub nullable : bool ,
19281982}
19291983
@@ -1943,9 +1997,13 @@ impl ColumnDefinition {
19431997 }
19441998}
19451999
2000+ /// Stores tokens in the catalog. Wraps a [`Repository`] while providing additional functionality
2001+ /// needed for looking up tokens at runtime.
19462002#[ derive( Debug , Clone , Default ) ]
19472003pub ( crate ) struct TokenRepository {
2004+ /// The collection of tokens
19482005 repo : Repository < TokenId , TokenInfo > ,
2006+ /// Bi-directional map for quick lookup of tokens by their hash
19492007 hash_lookup_map : BiHashMap < TokenId , Vec < u8 > > ,
19502008}
19512009
0 commit comments