Skip to main content

reifydb_core/interface/catalog/
change.rs

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