Skip to main content

reifydb_core/interface/catalog/
change.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2026 ReifyDB
3
4use reifydb_value::Result;
5
6use crate::{
7	interface::catalog::{
8		authentication::Authentication,
9		binding::Binding,
10		column_snapshot::ColumnSnapshot,
11		config::Config,
12		dictionary::Dictionary,
13		flow::{Flow, FlowEdge, FlowNode, FlowNodeId},
14		handler::Handler,
15		identity::{GrantedRole, Identity, Role},
16		key::PrimaryKey,
17		migration::{Migration, MigrationEvent},
18		namespace::Namespace,
19		policy::Policy,
20		procedure::Procedure,
21		ringbuffer::RingBuffer,
22		series::Series,
23		shape::ShapeId,
24		sink::Sink,
25		source::Source,
26		sumtype::SumType,
27		table::Table,
28		test::Test,
29		view::View,
30	},
31	row::{OperatorSettings, RowSettings},
32};
33
34pub trait CatalogTrackConfigChangeOperations {
35	fn track_config_set(&mut self, pre: Config, post: Config) -> Result<()>;
36}
37
38pub trait CatalogTrackTableChangeOperations {
39	fn track_table_created(&mut self, table: Table) -> Result<()>;
40
41	fn track_table_updated(&mut self, pre: Table, post: Table) -> Result<()>;
42
43	fn track_table_deleted(&mut self, table: Table) -> Result<()>;
44}
45
46pub trait CatalogTrackNamespaceChangeOperations {
47	fn track_namespace_created(&mut self, namespace: Namespace) -> Result<()>;
48
49	fn track_namespace_updated(&mut self, pre: Namespace, post: Namespace) -> Result<()>;
50
51	fn track_namespace_deleted(&mut self, namespace: Namespace) -> Result<()>;
52}
53
54pub trait CatalogTrackFlowChangeOperations {
55	fn track_flow_created(&mut self, flow: Flow) -> Result<()>;
56
57	fn track_flow_updated(&mut self, pre: Flow, post: Flow) -> Result<()>;
58
59	fn track_flow_deleted(&mut self, flow: Flow) -> Result<()>;
60}
61
62pub trait CatalogTrackPrimaryKeyChangeOperations {
63	fn track_primary_key_created(&mut self, shape: ShapeId, primary_key: PrimaryKey) -> Result<()>;
64
65	fn track_primary_key_deleted(&mut self, shape: ShapeId, primary_key: PrimaryKey) -> Result<()>;
66}
67
68pub trait CatalogTrackFlowNodeChangeOperations {
69	fn track_flow_node_created(&mut self, node: FlowNode) -> Result<()>;
70
71	fn track_flow_node_deleted(&mut self, node: FlowNode) -> Result<()>;
72}
73
74pub trait CatalogTrackFlowEdgeChangeOperations {
75	fn track_flow_edge_created(&mut self, edge: FlowEdge) -> Result<()>;
76
77	fn track_flow_edge_deleted(&mut self, edge: FlowEdge) -> Result<()>;
78}
79
80pub trait CatalogTrackViewChangeOperations {
81	fn track_view_created(&mut self, view: View) -> Result<()>;
82
83	fn track_view_updated(&mut self, pre: View, post: View) -> Result<()>;
84
85	fn track_view_deleted(&mut self, view: View) -> Result<()>;
86}
87
88pub trait CatalogTrackDictionaryChangeOperations {
89	fn track_dictionary_created(&mut self, dictionary: Dictionary) -> Result<()>;
90
91	fn track_dictionary_updated(&mut self, pre: Dictionary, post: Dictionary) -> Result<()>;
92
93	fn track_dictionary_deleted(&mut self, dictionary: Dictionary) -> Result<()>;
94}
95
96pub trait CatalogTrackColumnSnapshotChangeOperations {
97	fn track_column_snapshot_created(&mut self, snapshot: ColumnSnapshot) -> Result<()>;
98
99	fn track_column_snapshot_updated(&mut self, pre: ColumnSnapshot, post: ColumnSnapshot) -> Result<()>;
100
101	fn track_column_snapshot_deleted(&mut self, snapshot: ColumnSnapshot) -> Result<()>;
102}
103
104pub trait CatalogTrackSeriesChangeOperations {
105	fn track_series_created(&mut self, series: Series) -> Result<()>;
106
107	fn track_series_updated(&mut self, pre: Series, post: Series) -> Result<()>;
108
109	fn track_series_deleted(&mut self, series: Series) -> Result<()>;
110}
111
112pub trait CatalogTrackRingBufferChangeOperations {
113	fn track_ringbuffer_created(&mut self, ringbuffer: RingBuffer) -> Result<()>;
114
115	fn track_ringbuffer_updated(&mut self, pre: RingBuffer, post: RingBuffer) -> Result<()>;
116
117	fn track_ringbuffer_deleted(&mut self, ringbuffer: RingBuffer) -> Result<()>;
118}
119
120pub trait CatalogTrackSumTypeChangeOperations {
121	fn track_sumtype_created(&mut self, sumtype: SumType) -> Result<()>;
122
123	fn track_sumtype_updated(&mut self, pre: SumType, post: SumType) -> Result<()>;
124
125	fn track_sumtype_deleted(&mut self, sumtype: SumType) -> Result<()>;
126}
127
128pub trait CatalogTrackProcedureChangeOperations {
129	fn track_procedure_created(&mut self, procedure: Procedure) -> Result<()>;
130
131	fn track_procedure_updated(&mut self, pre: Procedure, post: Procedure) -> Result<()>;
132
133	fn track_procedure_deleted(&mut self, procedure: Procedure) -> Result<()>;
134}
135
136pub trait CatalogTrackTestChangeOperations {
137	fn track_test_created(&mut self, test: Test) -> Result<()>;
138
139	fn track_test_deleted(&mut self, test: Test) -> Result<()>;
140}
141
142pub trait CatalogTrackHandlerChangeOperations {
143	fn track_handler_created(&mut self, handler: Handler) -> Result<()>;
144
145	fn track_handler_deleted(&mut self, handler: Handler) -> Result<()>;
146}
147
148pub trait CatalogTrackIdentityChangeOperations {
149	fn track_identity_created(&mut self, identity: Identity) -> Result<()>;
150
151	fn track_identity_updated(&mut self, pre: Identity, post: Identity) -> Result<()>;
152
153	fn track_identity_deleted(&mut self, identity: Identity) -> Result<()>;
154}
155
156pub trait CatalogTrackRoleChangeOperations {
157	fn track_role_created(&mut self, role: Role) -> Result<()>;
158
159	fn track_role_updated(&mut self, pre: Role, post: Role) -> Result<()>;
160
161	fn track_role_deleted(&mut self, role: Role) -> Result<()>;
162}
163
164pub trait CatalogTrackGrantedRoleChangeOperations {
165	fn track_granted_role_created(&mut self, granted_role: GrantedRole) -> Result<()>;
166
167	fn track_granted_role_deleted(&mut self, granted_role: GrantedRole) -> Result<()>;
168}
169
170pub trait CatalogTrackPolicyChangeOperations {
171	fn track_policy_created(&mut self, policy: Policy) -> Result<()>;
172
173	fn track_policy_updated(&mut self, pre: Policy, post: Policy) -> Result<()>;
174
175	fn track_policy_deleted(&mut self, policy: Policy) -> Result<()>;
176}
177
178pub trait CatalogTrackMigrationChangeOperations {
179	fn track_migration_created(&mut self, migration: Migration) -> Result<()>;
180
181	fn track_migration_deleted(&mut self, migration: Migration) -> Result<()>;
182}
183
184pub trait CatalogTrackMigrationEventChangeOperations {
185	fn track_migration_event_created(&mut self, event: MigrationEvent) -> Result<()>;
186}
187
188pub trait CatalogTrackAuthenticationChangeOperations {
189	fn track_authentication_created(&mut self, auth: Authentication) -> Result<()>;
190
191	fn track_authentication_deleted(&mut self, auth: Authentication) -> Result<()>;
192}
193
194pub trait CatalogTrackSourceChangeOperations {
195	fn track_source_created(&mut self, source: Source) -> Result<()>;
196
197	fn track_source_deleted(&mut self, source: Source) -> Result<()>;
198}
199
200pub trait CatalogTrackBindingChangeOperations {
201	fn track_binding_created(&mut self, binding: Binding) -> Result<()>;
202
203	fn track_binding_deleted(&mut self, binding: Binding) -> Result<()>;
204}
205
206pub trait CatalogTrackSinkChangeOperations {
207	fn track_sink_created(&mut self, sink: Sink) -> Result<()>;
208
209	fn track_sink_deleted(&mut self, sink: Sink) -> Result<()>;
210}
211
212pub trait CatalogTrackRowSettingsChangeOperations {
213	fn track_row_settings_created(&mut self, shape: ShapeId, settings: RowSettings) -> Result<()>;
214
215	fn track_row_settings_updated(&mut self, shape: ShapeId, pre: RowSettings, post: RowSettings) -> Result<()>;
216
217	fn track_row_settings_deleted(&mut self, shape: ShapeId, settings: RowSettings) -> Result<()>;
218}
219
220pub trait CatalogTrackOperatorSettingsChangeOperations {
221	fn track_operator_settings_created(&mut self, operator: FlowNodeId, settings: OperatorSettings) -> Result<()>;
222
223	fn track_operator_settings_updated(
224		&mut self,
225		operator: FlowNodeId,
226		pre: OperatorSettings,
227		post: OperatorSettings,
228	) -> Result<()>;
229
230	fn track_operator_settings_deleted(&mut self, operator: FlowNodeId, settings: OperatorSettings) -> Result<()>;
231}
232
233pub trait CatalogTrackChangeOperations:
234	CatalogTrackBindingChangeOperations
235	+ CatalogTrackColumnSnapshotChangeOperations
236	+ CatalogTrackDictionaryChangeOperations
237	+ CatalogTrackFlowChangeOperations
238	+ CatalogTrackPrimaryKeyChangeOperations
239	+ CatalogTrackFlowNodeChangeOperations
240	+ CatalogTrackFlowEdgeChangeOperations
241	+ CatalogTrackHandlerChangeOperations
242	+ CatalogTrackMigrationChangeOperations
243	+ CatalogTrackMigrationEventChangeOperations
244	+ CatalogTrackNamespaceChangeOperations
245	+ CatalogTrackProcedureChangeOperations
246	+ CatalogTrackRingBufferChangeOperations
247	+ CatalogTrackRoleChangeOperations
248	+ CatalogTrackPolicyChangeOperations
249	+ CatalogTrackSeriesChangeOperations
250	+ CatalogTrackSinkChangeOperations
251	+ CatalogTrackSourceChangeOperations
252	+ CatalogTrackSumTypeChangeOperations
253	+ CatalogTrackTableChangeOperations
254	+ CatalogTrackTestChangeOperations
255	+ CatalogTrackAuthenticationChangeOperations
256	+ CatalogTrackIdentityChangeOperations
257	+ CatalogTrackGrantedRoleChangeOperations
258	+ CatalogTrackViewChangeOperations
259	+ CatalogTrackConfigChangeOperations
260	+ CatalogTrackRowSettingsChangeOperations
261	+ CatalogTrackOperatorSettingsChangeOperations
262{
263}