Skip to main content

mz_catalog_protos/
objects_v90.rs

1// Copyright Materialize, Inc. and contributors. All rights reserved.
2//
3// Use of this software is governed by the Business Source License
4// included in the LICENSE file.
5//
6// As of the Change Date specified in that file, in accordance with
7// the Business Source License, use of this software will be governed
8// by the Apache License, Version 2.0.
9
10#[cfg(any(test, feature = "proptest"))]
11use proptest_derive::Arbitrary;
12use serde::{Deserialize, Serialize};
13use serde_repr::{Deserialize_repr, Serialize_repr};
14
15#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
16#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
17pub struct ConfigKey {
18    pub key: String,
19}
20
21#[derive(
22    Clone,
23    Copy,
24    Debug,
25    PartialEq,
26    Eq,
27    PartialOrd,
28    Ord,
29    Serialize,
30    Deserialize
31)]
32#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
33pub struct ConfigValue {
34    pub value: u64,
35}
36
37#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
38#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
39pub struct SettingKey {
40    pub name: String,
41}
42
43#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
44#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
45pub struct SettingValue {
46    pub value: String,
47}
48
49#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
50#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
51pub struct IdAllocKey {
52    pub name: String,
53}
54
55#[derive(
56    Clone,
57    Copy,
58    Debug,
59    PartialEq,
60    Eq,
61    PartialOrd,
62    Ord,
63    Serialize,
64    Deserialize
65)]
66#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
67pub struct IdAllocValue {
68    pub next_id: u64,
69}
70
71#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
72#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
73pub struct GidMappingKey {
74    pub schema_name: String,
75    pub object_type: CatalogItemType,
76    pub object_name: String,
77}
78
79#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
80#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
81pub struct GidMappingValue {
82    pub catalog_id: SystemCatalogItemId,
83    pub global_id: SystemGlobalId,
84    pub fingerprint: String,
85}
86
87#[derive(
88    Clone,
89    Copy,
90    Debug,
91    PartialEq,
92    Eq,
93    PartialOrd,
94    Ord,
95    Serialize,
96    Deserialize
97)]
98#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
99pub struct ClusterKey {
100    pub id: ClusterId,
101}
102
103#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
104#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
105pub struct ClusterValue {
106    pub name: String,
107    pub owner_id: RoleId,
108    pub privileges: Vec<MzAclItem>,
109    pub config: ClusterConfig,
110}
111
112#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
113#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
114pub struct ClusterIntrospectionSourceIndexKey {
115    pub cluster_id: ClusterId,
116    pub name: String,
117}
118
119#[derive(
120    Clone,
121    Copy,
122    Debug,
123    PartialEq,
124    Eq,
125    PartialOrd,
126    Ord,
127    Serialize,
128    Deserialize
129)]
130#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
131pub struct ClusterIntrospectionSourceIndexValue {
132    pub catalog_id: IntrospectionSourceIndexCatalogItemId,
133    pub global_id: IntrospectionSourceIndexGlobalId,
134    pub oid: u32,
135}
136
137#[derive(
138    Clone,
139    Copy,
140    Debug,
141    PartialEq,
142    Eq,
143    PartialOrd,
144    Ord,
145    Serialize,
146    Deserialize
147)]
148#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
149pub struct ClusterReplicaKey {
150    pub id: ReplicaId,
151}
152
153#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
154#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
155pub struct ClusterReplicaValue {
156    pub cluster_id: ClusterId,
157    pub name: String,
158    pub config: ReplicaConfig,
159    pub owner_id: RoleId,
160}
161
162#[derive(
163    Clone,
164    Copy,
165    Debug,
166    PartialEq,
167    Eq,
168    PartialOrd,
169    Ord,
170    Serialize,
171    Deserialize
172)]
173#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
174pub struct DatabaseKey {
175    pub id: DatabaseId,
176}
177
178#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
179#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
180pub struct DatabaseValue {
181    pub name: String,
182    pub owner_id: RoleId,
183    pub privileges: Vec<MzAclItem>,
184    pub oid: u32,
185}
186
187#[derive(
188    Clone,
189    Copy,
190    Debug,
191    PartialEq,
192    Eq,
193    PartialOrd,
194    Ord,
195    Serialize,
196    Deserialize
197)]
198#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
199pub struct SchemaKey {
200    pub id: SchemaId,
201}
202
203#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
204#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
205pub struct SchemaValue {
206    pub database_id: Option<DatabaseId>,
207    pub name: String,
208    pub owner_id: RoleId,
209    pub privileges: Vec<MzAclItem>,
210    pub oid: u32,
211}
212
213#[derive(
214    Clone,
215    Copy,
216    Debug,
217    PartialEq,
218    Eq,
219    PartialOrd,
220    Ord,
221    Serialize,
222    Deserialize
223)]
224#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
225pub struct ItemKey {
226    pub gid: CatalogItemId,
227}
228
229#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
230#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
231pub struct ItemValue {
232    pub schema_id: SchemaId,
233    pub name: String,
234    pub definition: CatalogItem,
235    pub owner_id: RoleId,
236    pub privileges: Vec<MzAclItem>,
237    pub oid: u32,
238    pub global_id: GlobalId,
239    pub extra_versions: Vec<ItemVersion>,
240}
241
242#[derive(
243    Clone,
244    Copy,
245    Debug,
246    PartialEq,
247    Eq,
248    PartialOrd,
249    Ord,
250    Serialize,
251    Deserialize
252)]
253#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
254pub struct ItemVersion {
255    pub global_id: GlobalId,
256    pub version: Version,
257}
258
259#[derive(
260    Clone,
261    Copy,
262    Debug,
263    PartialEq,
264    Eq,
265    PartialOrd,
266    Ord,
267    Serialize,
268    Deserialize
269)]
270#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
271pub struct RoleKey {
272    pub id: RoleId,
273}
274
275#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
276#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
277pub struct RoleValue {
278    pub name: String,
279    pub attributes: RoleAttributes,
280    pub membership: RoleMembership,
281    pub vars: RoleVars,
282    pub oid: u32,
283}
284
285#[derive(
286    Clone,
287    Copy,
288    Debug,
289    PartialEq,
290    Eq,
291    PartialOrd,
292    Ord,
293    Serialize,
294    Deserialize
295)]
296#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
297pub struct RoleAuthKey {
298    pub id: RoleId,
299}
300
301#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
302#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
303pub struct RoleAuthValue {
304    pub password_hash: Option<String>,
305    pub updated_at: EpochMillis,
306}
307
308#[derive(
309    Clone,
310    Copy,
311    Debug,
312    PartialEq,
313    Eq,
314    PartialOrd,
315    Ord,
316    Serialize,
317    Deserialize
318)]
319#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
320pub struct NetworkPolicyKey {
321    pub id: NetworkPolicyId,
322}
323
324#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
325#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
326pub struct NetworkPolicyValue {
327    pub name: String,
328    pub rules: Vec<NetworkPolicyRule>,
329    pub owner_id: RoleId,
330    pub privileges: Vec<MzAclItem>,
331    pub oid: u32,
332}
333
334#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
335#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
336pub struct ServerConfigurationKey {
337    pub name: String,
338}
339
340#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
341#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
342pub struct ServerConfigurationValue {
343    pub value: String,
344}
345
346#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
347#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
348pub struct ClusterSystemConfigurationKey {
349    pub cluster_id: ClusterId,
350    pub name: String,
351}
352
353#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
354#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
355pub struct ClusterSystemConfigurationValue {
356    pub value: String,
357}
358
359#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
360#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
361pub struct ReplicaSystemConfigurationKey {
362    pub replica_id: ReplicaId,
363    pub name: String,
364}
365
366#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
367#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
368pub struct ReplicaSystemConfigurationValue {
369    pub value: String,
370}
371
372#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
373#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
374pub struct AuditLogKey {
375    pub event: AuditLogEvent,
376}
377
378#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
379#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
380pub enum AuditLogEvent {
381    V1(AuditLogEventV1),
382}
383
384#[derive(
385    Clone,
386    Copy,
387    Debug,
388    PartialEq,
389    Eq,
390    PartialOrd,
391    Ord,
392    Serialize,
393    Deserialize
394)]
395#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
396pub struct CommentKey {
397    pub object: CommentObject,
398    pub sub_component: Option<CommentSubComponent>,
399}
400
401#[derive(
402    Clone,
403    Copy,
404    Debug,
405    PartialEq,
406    Eq,
407    PartialOrd,
408    Ord,
409    Serialize,
410    Deserialize
411)]
412#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
413pub enum CommentObject {
414    Table(CatalogItemId),
415    View(CatalogItemId),
416    MaterializedView(CatalogItemId),
417    Source(CatalogItemId),
418    Sink(CatalogItemId),
419    Index(CatalogItemId),
420    Func(CatalogItemId),
421    Connection(CatalogItemId),
422    Type(CatalogItemId),
423    Secret(CatalogItemId),
424    Role(RoleId),
425    Database(DatabaseId),
426    Schema(ResolvedSchema),
427    Cluster(ClusterId),
428    ClusterReplica(ClusterReplicaId),
429    NetworkPolicy(NetworkPolicyId),
430}
431
432#[derive(
433    Clone,
434    Copy,
435    Debug,
436    PartialEq,
437    Eq,
438    PartialOrd,
439    Ord,
440    Serialize,
441    Deserialize
442)]
443#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
444pub enum CommentSubComponent {
445    ColumnPos(u64),
446}
447
448#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
449#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
450pub struct CommentValue {
451    pub comment: String,
452}
453
454#[derive(
455    Clone,
456    Copy,
457    Debug,
458    PartialEq,
459    Eq,
460    PartialOrd,
461    Ord,
462    Serialize,
463    Deserialize
464)]
465#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
466pub struct SourceReferencesKey {
467    pub source: CatalogItemId,
468}
469
470#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
471#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
472pub struct SourceReferencesValue {
473    pub references: Vec<SourceReference>,
474    pub updated_at: EpochMillis,
475}
476
477#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
478#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
479pub struct SourceReference {
480    pub name: String,
481    pub namespace: Option<String>,
482    pub columns: Vec<String>,
483}
484
485#[derive(
486    Clone,
487    Copy,
488    Debug,
489    PartialEq,
490    Eq,
491    PartialOrd,
492    Ord,
493    Serialize,
494    Deserialize
495)]
496#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
497pub struct StorageCollectionMetadataKey {
498    pub id: GlobalId,
499}
500
501#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
502#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
503pub struct StorageCollectionMetadataValue {
504    pub shard: String,
505}
506
507#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
508#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
509pub struct UnfinalizedShardKey {
510    pub shard: String,
511}
512
513#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
514#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
515pub struct TxnWalShardValue {
516    pub shard: String,
517}
518
519#[derive(
520    Clone,
521    Copy,
522    Debug,
523    PartialEq,
524    Eq,
525    PartialOrd,
526    Ord,
527    Serialize,
528    Deserialize
529)]
530#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
531pub struct Empty {}
532
533#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
534#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
535pub struct StringWrapper {
536    pub inner: String,
537}
538
539#[derive(
540    Clone,
541    Copy,
542    Debug,
543    PartialEq,
544    Eq,
545    PartialOrd,
546    Ord,
547    Serialize,
548    Deserialize
549)]
550#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
551pub struct Duration {
552    pub secs: u64,
553    pub nanos: u32,
554}
555
556#[derive(
557    Clone,
558    Copy,
559    Debug,
560    PartialEq,
561    Eq,
562    PartialOrd,
563    Ord,
564    Serialize,
565    Deserialize
566)]
567#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
568pub struct EpochMillis {
569    pub millis: u64,
570}
571
572#[derive(
573    Clone,
574    Copy,
575    Debug,
576    PartialEq,
577    Eq,
578    PartialOrd,
579    Ord,
580    Serialize,
581    Deserialize
582)]
583#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
584pub struct Version {
585    pub value: u64,
586}
587
588#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
589#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
590pub enum CatalogItem {
591    V1(CatalogItemV1),
592}
593
594#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
595#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
596pub struct CatalogItemV1 {
597    pub create_sql: String,
598}
599
600#[derive(
601    Clone,
602    Copy,
603    Debug,
604    PartialEq,
605    Eq,
606    PartialOrd,
607    Ord,
608    Serialize,
609    Deserialize
610)]
611#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
612pub enum CatalogItemId {
613    System(u64),
614    User(u64),
615    Transient(u64),
616    IntrospectionSourceIndex(u64),
617}
618
619#[derive(
620    Clone,
621    Copy,
622    Debug,
623    PartialEq,
624    Eq,
625    PartialOrd,
626    Ord,
627    Serialize,
628    Deserialize
629)]
630#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
631pub struct SystemCatalogItemId(pub u64);
632
633#[derive(
634    Clone,
635    Copy,
636    Debug,
637    PartialEq,
638    Eq,
639    PartialOrd,
640    Ord,
641    Serialize,
642    Deserialize
643)]
644#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
645pub struct IntrospectionSourceIndexCatalogItemId(pub u64);
646
647#[derive(
648    Clone,
649    Copy,
650    Debug,
651    PartialEq,
652    Eq,
653    PartialOrd,
654    Ord,
655    Serialize,
656    Deserialize
657)]
658#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
659pub enum GlobalId {
660    System(u64),
661    User(u64),
662    Transient(u64),
663    Explain,
664    IntrospectionSourceIndex(u64),
665}
666
667#[derive(
668    Clone,
669    Copy,
670    Debug,
671    PartialEq,
672    Eq,
673    PartialOrd,
674    Ord,
675    Serialize,
676    Deserialize
677)]
678#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
679pub struct SystemGlobalId(pub u64);
680
681#[derive(
682    Clone,
683    Copy,
684    Debug,
685    PartialEq,
686    Eq,
687    PartialOrd,
688    Ord,
689    Serialize,
690    Deserialize
691)]
692#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
693pub struct IntrospectionSourceIndexGlobalId(pub u64);
694
695#[derive(
696    Clone,
697    Copy,
698    Debug,
699    PartialEq,
700    Eq,
701    PartialOrd,
702    Ord,
703    Serialize,
704    Deserialize
705)]
706#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
707pub enum ClusterId {
708    System(u64),
709    User(u64),
710}
711
712#[derive(
713    Clone,
714    Copy,
715    Debug,
716    PartialEq,
717    Eq,
718    PartialOrd,
719    Ord,
720    Serialize,
721    Deserialize
722)]
723#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
724pub enum DatabaseId {
725    System(u64),
726    User(u64),
727}
728
729#[derive(
730    Clone,
731    Copy,
732    Debug,
733    PartialEq,
734    Eq,
735    PartialOrd,
736    Ord,
737    Serialize,
738    Deserialize
739)]
740#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
741pub enum ResolvedDatabaseSpecifier {
742    Ambient,
743    Id(DatabaseId),
744}
745
746#[derive(
747    Clone,
748    Copy,
749    Debug,
750    PartialEq,
751    Eq,
752    PartialOrd,
753    Ord,
754    Serialize,
755    Deserialize
756)]
757#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
758pub enum SchemaId {
759    System(u64),
760    User(u64),
761}
762
763#[derive(
764    Clone,
765    Copy,
766    Debug,
767    PartialEq,
768    Eq,
769    PartialOrd,
770    Ord,
771    Serialize,
772    Deserialize
773)]
774#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
775pub enum SchemaSpecifier {
776    Temporary,
777    Id(SchemaId),
778}
779
780#[derive(
781    Clone,
782    Copy,
783    Debug,
784    PartialEq,
785    Eq,
786    PartialOrd,
787    Ord,
788    Serialize,
789    Deserialize
790)]
791#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
792pub struct ResolvedSchema {
793    pub database: ResolvedDatabaseSpecifier,
794    pub schema: SchemaSpecifier,
795}
796
797#[derive(
798    Clone,
799    Copy,
800    Debug,
801    PartialEq,
802    Eq,
803    PartialOrd,
804    Ord,
805    Serialize,
806    Deserialize
807)]
808#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
809pub enum ReplicaId {
810    System(u64),
811    User(u64),
812}
813
814#[derive(
815    Clone,
816    Copy,
817    Debug,
818    PartialEq,
819    Eq,
820    PartialOrd,
821    Ord,
822    Serialize,
823    Deserialize
824)]
825#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
826pub struct ClusterReplicaId {
827    pub cluster_id: ClusterId,
828    pub replica_id: ReplicaId,
829}
830
831#[derive(
832    Clone,
833    Copy,
834    Debug,
835    PartialEq,
836    Eq,
837    PartialOrd,
838    Ord,
839    Serialize,
840    Deserialize
841)]
842#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
843pub enum NetworkPolicyId {
844    System(u64),
845    User(u64),
846}
847
848#[derive(
849    Clone,
850    Copy,
851    Debug,
852    PartialEq,
853    Eq,
854    PartialOrd,
855    Ord,
856    Serialize,
857    Deserialize
858)]
859#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
860pub struct ReplicaLogging {
861    pub log_logging: bool,
862    pub interval: Option<Duration>,
863}
864
865#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
866#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
867pub struct OptimizerFeatureOverride {
868    pub name: String,
869    pub value: String,
870}
871
872#[derive(
873    Clone,
874    Copy,
875    Debug,
876    PartialEq,
877    Eq,
878    PartialOrd,
879    Ord,
880    Serialize,
881    Deserialize
882)]
883#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
884pub struct ClusterScheduleRefreshOptions {
885    pub rehydration_time_estimate: Duration,
886}
887
888#[derive(
889    Clone,
890    Copy,
891    Debug,
892    PartialEq,
893    Eq,
894    PartialOrd,
895    Ord,
896    Serialize,
897    Deserialize
898)]
899#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
900pub enum ClusterSchedule {
901    Manual,
902    Refresh(ClusterScheduleRefreshOptions),
903}
904
905#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
906#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
907pub struct ClusterConfig {
908    pub workload_class: Option<String>,
909    pub variant: ClusterVariant,
910}
911
912#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
913#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
914pub enum ClusterVariant {
915    Unmanaged,
916    Managed(ManagedCluster),
917}
918
919#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
920#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
921pub struct ManagedCluster {
922    pub size: String,
923    pub replication_factor: u32,
924    pub availability_zones: Vec<String>,
925    pub logging: ReplicaLogging,
926    pub arrangement_compression: bool,
927    pub optimizer_feature_overrides: Vec<OptimizerFeatureOverride>,
928    pub schedule: ClusterSchedule,
929    /// User-configured autoscaling policy, distinct from the in-flight runtime
930    /// records below.
931    pub auto_scaling_strategy: Option<AutoScalingStrategy>,
932    /// Latest graceful reconfiguration record, if one has been written.
933    pub reconfiguration: Option<ReconfigurationState>,
934    /// In-flight hydration burst the controller is running.
935    pub burst: Option<BurstState>,
936}
937
938/// The user-configured autoscaling policy of a managed cluster.
939///
940/// Extensible: future strategies are added as additional optional sub-policies.
941#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
942#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
943pub struct AutoScalingStrategy {
944    pub on_hydration: Option<OnHydration>,
945}
946
947/// The `ON HYDRATION` autoscaling sub-policy.
948#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
949#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
950pub struct OnHydration {
951    pub hydration_size: String,
952    pub linger_duration: Option<Duration>,
953}
954
955/// Latest graceful reconfiguration record, including the target shape, deadline,
956/// timeout action, and lifecycle status.
957#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
958#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
959pub struct ReconfigurationState {
960    pub target: ReconfigurationTarget,
961    /// Deadline as an `mz_repr::Timestamp`.
962    pub deadline: u64,
963    /// What to do if the deadline passes before the target hydrates.
964    pub on_timeout: OnTimeoutAction,
965    pub status: ReconfigurationStatus,
966}
967
968/// The lifecycle status of the latest graceful reconfiguration.
969///
970/// NOTE: the serde serialization of these variant names is what the
971/// `mz_internal.mz_cluster_reconfigurations` builtin view matches on. When
972/// adding a variant, extend that view's `status` CASE mapping, or the new
973/// variant surfaces verbatim (`SomeNewStatus`) instead of snake_case.
974#[derive(
975    Clone,
976    Copy,
977    Debug,
978    PartialEq,
979    Eq,
980    PartialOrd,
981    Ord,
982    Serialize,
983    Deserialize
984)]
985#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
986pub enum ReconfigurationStatus {
987    InProgress,
988    Finalized,
989    TimedOut,
990    Cancelled,
991    ResourceExhausted,
992}
993
994/// The action a graceful reconfiguration applies if its deadline passes before
995/// the target replicas hydrate. Mirrors `mz_sql::plan::OnTimeoutAction`.
996///
997/// NOTE: like `ReconfigurationStatus`, the serde variant names feed the
998/// `on_timeout` CASE mapping in `mz_internal.mz_cluster_reconfigurations`.
999#[derive(
1000    Clone,
1001    Copy,
1002    Debug,
1003    PartialEq,
1004    Eq,
1005    PartialOrd,
1006    Ord,
1007    Serialize,
1008    Deserialize
1009)]
1010#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1011pub enum OnTimeoutAction {
1012    /// Cut over to the (not-yet-hydrated) target anyway.
1013    Commit,
1014    /// Drop the target replica set, reverting to the pre-reconfiguration shape.
1015    Rollback,
1016}
1017
1018/// The full config shape a reconfiguration is moving the cluster to, so a
1019/// combined size + replication-factor + availability-zone change is one record.
1020#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1021#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1022pub struct ReconfigurationTarget {
1023    pub size: String,
1024    pub replication_factor: u32,
1025    pub availability_zones: Vec<String>,
1026    pub logging: ReplicaLogging,
1027    pub arrangement_compression: bool,
1028}
1029
1030/// An active hydration burst.
1031#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1032#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1033pub struct BurstState {
1034    pub burst_size: String,
1035    pub linger_duration: Duration,
1036    /// When the steady-state replicas were first observed hydrated, as an
1037    /// `mz_repr::Timestamp`. Absent until that observation.
1038    pub steady_hydrated_at: Option<u64>,
1039}
1040
1041#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1042#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1043pub struct ReplicaConfig {
1044    pub logging: ReplicaLogging,
1045    pub location: ReplicaLocation,
1046    pub arrangement_compression: bool,
1047}
1048
1049#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1050#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1051pub struct UnmanagedLocation {
1052    pub storagectl_addrs: Vec<String>,
1053    pub computectl_addrs: Vec<String>,
1054}
1055
1056#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1057#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1058pub struct ManagedLocation {
1059    pub size: String,
1060    /// The availability zones the replica was provisioned under.
1061    ///
1062    /// For a replica of a managed cluster this is the cluster's
1063    /// `AVAILABILITY ZONES` pool at provision time; the cluster controller
1064    /// compares it against a cluster's target `availability_zones` to tell
1065    /// realized- from target-shape replicas (including an `AVAILABILITY ZONES`
1066    /// divergence). For a replica of an unmanaged cluster it is the user-pinned
1067    /// `AVAILABILITY ZONE`, as a zero- or one-element list. Empty when no zones
1068    /// constrain placement.
1069    pub availability_zones: Vec<String>,
1070    pub internal: bool,
1071    pub billed_as: Option<String>,
1072    pub pending: bool,
1073}
1074
1075#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1076#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1077pub enum ReplicaLocation {
1078    Unmanaged(UnmanagedLocation),
1079    Managed(ManagedLocation),
1080}
1081
1082#[derive(
1083    Clone,
1084    Copy,
1085    Debug,
1086    PartialEq,
1087    Eq,
1088    PartialOrd,
1089    Ord,
1090    Serialize,
1091    Deserialize
1092)]
1093#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1094pub enum RoleId {
1095    System(u64),
1096    User(u64),
1097    Public,
1098    Predefined(u64),
1099}
1100
1101#[derive(
1102    Clone,
1103    Copy,
1104    Debug,
1105    PartialEq,
1106    Eq,
1107    PartialOrd,
1108    Ord,
1109    Serialize,
1110    Deserialize
1111)]
1112#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1113pub enum AutoProvisionSource {
1114    Oidc = 0,
1115    Frontegg = 1,
1116    None = 2,
1117}
1118
1119#[derive(
1120    Clone,
1121    Copy,
1122    Debug,
1123    PartialEq,
1124    Eq,
1125    PartialOrd,
1126    Ord,
1127    Serialize,
1128    Deserialize
1129)]
1130#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1131pub struct RoleAttributes {
1132    pub inherit: bool,
1133    pub superuser: Option<bool>,
1134    pub login: Option<bool>,
1135    pub auto_provision_source: Option<AutoProvisionSource>,
1136}
1137
1138#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1139#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1140pub struct RoleMembership {
1141    pub map: Vec<RoleMembershipEntry>,
1142}
1143
1144#[derive(
1145    Clone,
1146    Copy,
1147    Debug,
1148    PartialEq,
1149    Eq,
1150    PartialOrd,
1151    Ord,
1152    Serialize,
1153    Deserialize
1154)]
1155#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1156pub struct RoleMembershipEntry {
1157    pub key: RoleId,
1158    pub value: RoleId,
1159}
1160
1161#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1162#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1163pub struct RoleVars {
1164    pub entries: Vec<RoleVarsEntry>,
1165}
1166
1167#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1168#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1169pub struct RoleVarsEntry {
1170    pub key: String,
1171    pub val: RoleVar,
1172}
1173
1174#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1175#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1176pub enum RoleVar {
1177    Flat(String),
1178    SqlSet(Vec<String>),
1179}
1180
1181#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1182#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1183pub struct NetworkPolicyRule {
1184    pub name: String,
1185    pub address: String,
1186    pub action: NetworkPolicyRuleAction,
1187    pub direction: NetworkPolicyRuleDirection,
1188}
1189
1190#[derive(
1191    Clone,
1192    Copy,
1193    Debug,
1194    PartialEq,
1195    Eq,
1196    PartialOrd,
1197    Ord,
1198    Serialize,
1199    Deserialize
1200)]
1201#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1202pub enum NetworkPolicyRuleAction {
1203    Allow,
1204}
1205
1206#[derive(
1207    Clone,
1208    Copy,
1209    Debug,
1210    PartialEq,
1211    Eq,
1212    PartialOrd,
1213    Ord,
1214    Serialize,
1215    Deserialize
1216)]
1217#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1218pub enum NetworkPolicyRuleDirection {
1219    Ingress,
1220}
1221
1222#[derive(
1223    Clone,
1224    Copy,
1225    Debug,
1226    PartialEq,
1227    Eq,
1228    PartialOrd,
1229    Ord,
1230    Serialize,
1231    Deserialize
1232)]
1233#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1234pub struct AclMode {
1235    pub bitflags: u64,
1236}
1237
1238#[derive(
1239    Clone,
1240    Copy,
1241    Debug,
1242    PartialEq,
1243    Eq,
1244    PartialOrd,
1245    Ord,
1246    Serialize,
1247    Deserialize
1248)]
1249#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1250pub struct MzAclItem {
1251    pub grantee: RoleId,
1252    pub grantor: RoleId,
1253    pub acl_mode: AclMode,
1254}
1255
1256#[derive(
1257    Clone,
1258    Copy,
1259    Debug,
1260    PartialEq,
1261    Eq,
1262    PartialOrd,
1263    Ord,
1264    Serialize,
1265    Deserialize
1266)]
1267#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1268pub struct DefaultPrivilegesKey {
1269    pub role_id: RoleId,
1270    pub database_id: Option<DatabaseId>,
1271    pub schema_id: Option<SchemaId>,
1272    pub object_type: ObjectType,
1273    pub grantee: RoleId,
1274}
1275
1276#[derive(
1277    Clone,
1278    Copy,
1279    Debug,
1280    PartialEq,
1281    Eq,
1282    PartialOrd,
1283    Ord,
1284    Serialize,
1285    Deserialize
1286)]
1287#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1288pub struct DefaultPrivilegesValue {
1289    pub privileges: AclMode,
1290}
1291
1292#[derive(
1293    Clone,
1294    Copy,
1295    Debug,
1296    PartialEq,
1297    Eq,
1298    PartialOrd,
1299    Ord,
1300    Serialize,
1301    Deserialize
1302)]
1303#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1304pub struct SystemPrivilegesKey {
1305    pub grantee: RoleId,
1306    pub grantor: RoleId,
1307}
1308
1309#[derive(
1310    Clone,
1311    Copy,
1312    Debug,
1313    PartialEq,
1314    Eq,
1315    PartialOrd,
1316    Ord,
1317    Serialize,
1318    Deserialize
1319)]
1320#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1321pub struct SystemPrivilegesValue {
1322    pub acl_mode: AclMode,
1323}
1324
1325#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1326#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1327pub struct AuditLogEventV1 {
1328    pub id: u64,
1329    pub event_type: audit_log_event_v1::EventType,
1330    pub object_type: audit_log_event_v1::ObjectType,
1331    pub user: Option<StringWrapper>,
1332    pub occurred_at: EpochMillis,
1333    pub details: audit_log_event_v1::Details,
1334}
1335
1336pub mod audit_log_event_v1 {
1337    use super::*;
1338
1339    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1340    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1341    pub struct IdFullNameV1 {
1342        pub id: String,
1343        pub name: FullNameV1,
1344    }
1345
1346    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1347    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1348    pub struct FullNameV1 {
1349        pub database: String,
1350        pub schema: String,
1351        pub item: String,
1352    }
1353
1354    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1355    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1356    pub struct IdNameV1 {
1357        pub id: String,
1358        pub name: String,
1359    }
1360
1361    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1362    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1363    pub struct RenameClusterV1 {
1364        pub id: String,
1365        pub old_name: String,
1366        pub new_name: String,
1367    }
1368
1369    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1370    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1371    pub struct RenameClusterReplicaV1 {
1372        pub cluster_id: String,
1373        pub replica_id: String,
1374        pub old_name: String,
1375        pub new_name: String,
1376    }
1377
1378    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1379    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1380    pub struct AlterClusterReconfigurationV1 {
1381        pub cluster_id: String,
1382        pub cluster_name: String,
1383        pub transition: ReconfigurationLifecycleV1,
1384        /// On a `finalized` transition: whether the cut-over was forced by `ON
1385        /// TIMEOUT COMMIT` at the deadline rather than reached by hydration.
1386        #[serde(default)]
1387        pub forced: Option<bool>,
1388        pub target_size: String,
1389        pub target_replication_factor: u32,
1390        pub target_availability_zones: Vec<String>,
1391        pub target_logging: ClusterReplicaLoggingV1,
1392        pub deadline: Option<u64>,
1393    }
1394
1395    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1396    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1397    pub struct ClusterReplicaLoggingV1 {
1398        pub log_logging: bool,
1399        pub interval: Option<Duration>,
1400    }
1401
1402    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1403    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1404    pub struct ReconfigurationLifecycleV1 {
1405        pub transition: reconfiguration_lifecycle_v1::Transition,
1406    }
1407
1408    pub mod reconfiguration_lifecycle_v1 {
1409        use super::*;
1410
1411        #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1412        #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1413        pub enum Transition {
1414            Started(Empty),
1415            Finalized(Empty),
1416            TimedOut(Empty),
1417            Cancelled(Empty),
1418            ResourceExhausted(Empty),
1419        }
1420    }
1421
1422    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1423    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1424    pub struct ClusterHydrationBurstV1 {
1425        pub cluster_id: String,
1426        pub cluster_name: String,
1427        pub transition: HydrationBurstLifecycleV1,
1428        /// On a `finished` transition: why the burst tore down.
1429        #[serde(default)]
1430        pub finish_cause: Option<BurstFinishCauseV1>,
1431        pub burst_size: String,
1432    }
1433
1434    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1435    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1436    pub struct HydrationBurstLifecycleV1 {
1437        pub transition: hydration_burst_lifecycle_v1::Transition,
1438    }
1439
1440    pub mod hydration_burst_lifecycle_v1 {
1441        use super::*;
1442
1443        #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1444        #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1445        pub enum Transition {
1446            Started(Empty),
1447            Finished(Empty),
1448        }
1449    }
1450
1451    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1452    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1453    pub struct BurstFinishCauseV1 {
1454        pub cause: burst_finish_cause_v1::Cause,
1455    }
1456
1457    pub mod burst_finish_cause_v1 {
1458        use super::*;
1459
1460        #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1461        #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1462        pub enum Cause {
1463            LingerElapsed(Empty),
1464            NoLongerWarranted(Empty),
1465        }
1466    }
1467
1468    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1469    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1470    pub struct RenameItemV1 {
1471        pub id: String,
1472        pub old_name: FullNameV1,
1473        pub new_name: FullNameV1,
1474    }
1475
1476    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1477    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1478    pub struct CreateClusterReplicaV1 {
1479        pub cluster_id: String,
1480        pub cluster_name: String,
1481        pub replica_id: Option<StringWrapper>,
1482        pub replica_name: String,
1483        pub logical_size: String,
1484        pub disk: bool,
1485        pub billed_as: Option<String>,
1486        pub internal: bool,
1487    }
1488
1489    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1490    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1491    pub struct CreateClusterReplicaV2 {
1492        pub cluster_id: String,
1493        pub cluster_name: String,
1494        pub replica_id: Option<StringWrapper>,
1495        pub replica_name: String,
1496        pub logical_size: String,
1497        pub disk: bool,
1498        pub billed_as: Option<String>,
1499        pub internal: bool,
1500        pub reason: CreateOrDropClusterReplicaReasonV1,
1501        pub scheduling_policies: Option<SchedulingDecisionsWithReasonsV1>,
1502    }
1503
1504    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1505    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1506    pub struct CreateClusterReplicaV3 {
1507        pub cluster_id: String,
1508        pub cluster_name: String,
1509        pub replica_id: Option<StringWrapper>,
1510        pub replica_name: String,
1511        pub logical_size: String,
1512        pub disk: bool,
1513        pub billed_as: Option<String>,
1514        pub internal: bool,
1515        pub reason: CreateOrDropClusterReplicaReasonV1,
1516        pub scheduling_policies: Option<SchedulingDecisionsWithReasonsV2>,
1517    }
1518
1519    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1520    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1521    pub struct CreateClusterReplicaV4 {
1522        pub cluster_id: String,
1523        pub cluster_name: String,
1524        pub replica_id: Option<StringWrapper>,
1525        pub replica_name: String,
1526        pub logical_size: String,
1527        pub billed_as: Option<String>,
1528        pub internal: bool,
1529        pub reason: CreateOrDropClusterReplicaReasonV1,
1530        pub scheduling_policies: Option<SchedulingDecisionsWithReasonsV2>,
1531    }
1532
1533    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1534    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1535    pub struct DropClusterReplicaV1 {
1536        pub cluster_id: String,
1537        pub cluster_name: String,
1538        pub replica_id: Option<StringWrapper>,
1539        pub replica_name: String,
1540    }
1541
1542    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1543    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1544    pub struct DropClusterReplicaV2 {
1545        pub cluster_id: String,
1546        pub cluster_name: String,
1547        pub replica_id: Option<StringWrapper>,
1548        pub replica_name: String,
1549        pub reason: CreateOrDropClusterReplicaReasonV1,
1550        pub scheduling_policies: Option<SchedulingDecisionsWithReasonsV1>,
1551    }
1552
1553    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1554    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1555    pub struct DropClusterReplicaV3 {
1556        pub cluster_id: String,
1557        pub cluster_name: String,
1558        pub replica_id: Option<StringWrapper>,
1559        pub replica_name: String,
1560        pub reason: CreateOrDropClusterReplicaReasonV1,
1561        pub scheduling_policies: Option<SchedulingDecisionsWithReasonsV2>,
1562    }
1563
1564    #[derive(
1565        Clone,
1566        Copy,
1567        Debug,
1568        PartialEq,
1569        Eq,
1570        PartialOrd,
1571        Ord,
1572        Serialize,
1573        Deserialize
1574    )]
1575    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1576    pub struct CreateOrDropClusterReplicaReasonV1 {
1577        pub reason: CreateOrDropClusterReplicaReasonV1Reason,
1578    }
1579
1580    #[derive(
1581        Clone,
1582        Copy,
1583        Debug,
1584        PartialEq,
1585        Eq,
1586        PartialOrd,
1587        Ord,
1588        Serialize,
1589        Deserialize
1590    )]
1591    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1592    pub enum CreateOrDropClusterReplicaReasonV1Reason {
1593        Manual(Empty),
1594        Schedule(Empty),
1595        System(Empty),
1596        Reconfiguration(Empty),
1597        HydrationBurst(Empty),
1598        Retired(Empty),
1599    }
1600
1601    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1602    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1603    pub struct SchedulingDecisionsWithReasonsV1 {
1604        pub on_refresh: RefreshDecisionWithReasonV1,
1605    }
1606
1607    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1608    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1609    pub struct SchedulingDecisionsWithReasonsV2 {
1610        pub on_refresh: RefreshDecisionWithReasonV2,
1611    }
1612
1613    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1614    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1615    pub enum RefreshDecision {
1616        On(Empty),
1617        Off(Empty),
1618    }
1619
1620    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1621    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1622    pub struct RefreshDecisionWithReasonV1 {
1623        pub objects_needing_refresh: Vec<String>,
1624        pub rehydration_time_estimate: String,
1625        pub decision: RefreshDecision,
1626    }
1627
1628    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1629    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1630    pub struct RefreshDecisionWithReasonV2 {
1631        pub objects_needing_refresh: Vec<String>,
1632        pub objects_needing_compaction: Vec<String>,
1633        pub rehydration_time_estimate: String,
1634        pub decision: RefreshDecision,
1635    }
1636
1637    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1638    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1639    pub struct CreateSourceSinkV1 {
1640        pub id: String,
1641        pub name: FullNameV1,
1642        pub size: Option<StringWrapper>,
1643    }
1644
1645    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1646    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1647    pub struct CreateSourceSinkV2 {
1648        pub id: String,
1649        pub name: FullNameV1,
1650        pub size: Option<StringWrapper>,
1651        pub external_type: String,
1652    }
1653
1654    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1655    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1656    pub struct CreateSourceSinkV3 {
1657        pub id: String,
1658        pub name: FullNameV1,
1659        pub external_type: String,
1660    }
1661
1662    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1663    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1664    pub struct CreateSourceSinkV4 {
1665        pub id: String,
1666        pub cluster_id: Option<StringWrapper>,
1667        pub name: FullNameV1,
1668        pub external_type: String,
1669    }
1670
1671    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1672    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1673    pub struct CreateIndexV1 {
1674        pub id: String,
1675        pub cluster_id: String,
1676        pub name: FullNameV1,
1677    }
1678
1679    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1680    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1681    pub struct CreateMaterializedViewV1 {
1682        pub id: String,
1683        pub cluster_id: String,
1684        pub name: FullNameV1,
1685        pub replacement_target_id: Option<String>,
1686    }
1687
1688    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1689    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1690    pub struct AlterApplyReplacementV1 {
1691        pub target: IdFullNameV1,
1692        pub replacement: IdFullNameV1,
1693    }
1694
1695    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1696    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1697    pub struct AlterSourceSinkV1 {
1698        pub id: String,
1699        pub name: FullNameV1,
1700        pub old_size: Option<StringWrapper>,
1701        pub new_size: Option<StringWrapper>,
1702    }
1703
1704    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1705    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1706    pub struct AlterSetClusterV1 {
1707        pub id: String,
1708        pub name: FullNameV1,
1709        pub old_cluster_id: String,
1710        pub new_cluster_id: String,
1711    }
1712
1713    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1714    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1715    pub struct GrantRoleV1 {
1716        pub role_id: String,
1717        pub member_id: String,
1718        pub grantor_id: String,
1719    }
1720
1721    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1722    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1723    pub struct GrantRoleV2 {
1724        pub role_id: String,
1725        pub member_id: String,
1726        pub grantor_id: String,
1727        pub executed_by: String,
1728    }
1729
1730    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1731    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1732    pub struct RevokeRoleV1 {
1733        pub role_id: String,
1734        pub member_id: String,
1735    }
1736
1737    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1738    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1739    pub struct RevokeRoleV2 {
1740        pub role_id: String,
1741        pub member_id: String,
1742        pub grantor_id: String,
1743        pub executed_by: String,
1744    }
1745
1746    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1747    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1748    pub struct UpdatePrivilegeV1 {
1749        pub object_id: String,
1750        pub grantee_id: String,
1751        pub grantor_id: String,
1752        pub privileges: String,
1753    }
1754
1755    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1756    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1757    pub struct AlterDefaultPrivilegeV1 {
1758        pub role_id: String,
1759        pub database_id: Option<StringWrapper>,
1760        pub schema_id: Option<StringWrapper>,
1761        pub grantee_id: String,
1762        pub privileges: String,
1763    }
1764
1765    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1766    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1767    pub struct UpdateOwnerV1 {
1768        pub object_id: String,
1769        pub old_owner_id: String,
1770        pub new_owner_id: String,
1771    }
1772
1773    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1774    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1775    pub struct SchemaV1 {
1776        pub id: String,
1777        pub name: String,
1778        pub database_name: String,
1779    }
1780
1781    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1782    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1783    pub struct SchemaV2 {
1784        pub id: String,
1785        pub name: String,
1786        pub database_name: Option<StringWrapper>,
1787    }
1788
1789    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1790    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1791    pub struct RenameSchemaV1 {
1792        pub id: String,
1793        pub database_name: Option<String>,
1794        pub old_name: String,
1795        pub new_name: String,
1796    }
1797
1798    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1799    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1800    pub struct UpdateItemV1 {
1801        pub id: String,
1802        pub name: FullNameV1,
1803    }
1804
1805    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1806    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1807    pub struct AlterRetainHistoryV1 {
1808        pub id: String,
1809        pub old_history: Option<String>,
1810        pub new_history: Option<String>,
1811    }
1812
1813    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1814    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1815    pub struct AlterAddColumnV1 {
1816        pub id: String,
1817        pub column: String,
1818        pub column_type: String,
1819        pub nullable: bool,
1820    }
1821
1822    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1823    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1824    pub struct AlterSourceTimestampIntervalV1 {
1825        pub id: String,
1826        pub old_interval: Option<String>,
1827        pub new_interval: Option<String>,
1828    }
1829
1830    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1831    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1832    pub struct ToNewIdV1 {
1833        pub id: String,
1834        pub new_id: String,
1835    }
1836
1837    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1838    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1839    pub struct FromPreviousIdV1 {
1840        pub id: String,
1841        pub previous_id: String,
1842    }
1843
1844    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1845    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1846    pub struct SetV1 {
1847        pub name: String,
1848        pub value: Option<String>,
1849    }
1850
1851    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1852    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1853    pub struct RotateKeysV1 {
1854        pub id: String,
1855        pub name: String,
1856    }
1857
1858    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1859    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1860    pub struct CreateRoleV1 {
1861        pub id: String,
1862        pub name: String,
1863        pub auto_provision_source: Option<String>,
1864    }
1865
1866    #[derive(
1867        Clone,
1868        Copy,
1869        Debug,
1870        PartialEq,
1871        Eq,
1872        Hash,
1873        PartialOrd,
1874        Ord,
1875        Serialize_repr,
1876        Deserialize_repr
1877    )]
1878    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1879    #[repr(u8)]
1880    pub enum EventType {
1881        Unknown = 0,
1882        Create = 1,
1883        Drop = 2,
1884        Alter = 3,
1885        Grant = 4,
1886        Revoke = 5,
1887        Comment = 6,
1888    }
1889
1890    #[derive(
1891        Clone,
1892        Copy,
1893        Debug,
1894        PartialEq,
1895        Eq,
1896        Hash,
1897        PartialOrd,
1898        Ord,
1899        Serialize_repr,
1900        Deserialize_repr
1901    )]
1902    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1903    #[repr(u8)]
1904    pub enum ObjectType {
1905        Unknown = 0,
1906        Cluster = 1,
1907        ClusterReplica = 2,
1908        Connection = 3,
1909        Database = 4,
1910        Func = 5,
1911        Index = 6,
1912        MaterializedView = 7,
1913        Role = 8,
1914        Secret = 9,
1915        Schema = 10,
1916        Sink = 11,
1917        Source = 12,
1918        Table = 13,
1919        Type = 14,
1920        View = 15,
1921        System = 16,
1922        ContinualTask = 17,
1923        NetworkPolicy = 18,
1924    }
1925
1926    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1927    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1928    pub enum Details {
1929        CreateClusterReplicaV1(CreateClusterReplicaV1),
1930        CreateClusterReplicaV2(CreateClusterReplicaV2),
1931        CreateClusterReplicaV3(CreateClusterReplicaV3),
1932        CreateClusterReplicaV4(CreateClusterReplicaV4),
1933        DropClusterReplicaV1(DropClusterReplicaV1),
1934        DropClusterReplicaV2(DropClusterReplicaV2),
1935        DropClusterReplicaV3(DropClusterReplicaV3),
1936        CreateSourceSinkV1(CreateSourceSinkV1),
1937        CreateSourceSinkV2(CreateSourceSinkV2),
1938        AlterSourceSinkV1(AlterSourceSinkV1),
1939        AlterSetClusterV1(AlterSetClusterV1),
1940        GrantRoleV1(GrantRoleV1),
1941        GrantRoleV2(GrantRoleV2),
1942        RevokeRoleV1(RevokeRoleV1),
1943        RevokeRoleV2(RevokeRoleV2),
1944        UpdatePrivilegeV1(UpdatePrivilegeV1),
1945        AlterDefaultPrivilegeV1(AlterDefaultPrivilegeV1),
1946        UpdateOwnerV1(UpdateOwnerV1),
1947        IdFullNameV1(IdFullNameV1),
1948        RenameClusterV1(RenameClusterV1),
1949        RenameClusterReplicaV1(RenameClusterReplicaV1),
1950        RenameItemV1(RenameItemV1),
1951        IdNameV1(IdNameV1),
1952        SchemaV1(SchemaV1),
1953        SchemaV2(SchemaV2),
1954        RenameSchemaV1(RenameSchemaV1),
1955        UpdateItemV1(UpdateItemV1),
1956        CreateSourceSinkV3(CreateSourceSinkV3),
1957        AlterRetainHistoryV1(AlterRetainHistoryV1),
1958        ToNewIdV1(ToNewIdV1),
1959        FromPreviousIdV1(FromPreviousIdV1),
1960        SetV1(SetV1),
1961        ResetAllV1(Empty),
1962        RotateKeysV1(RotateKeysV1),
1963        CreateSourceSinkV4(CreateSourceSinkV4),
1964        CreateIndexV1(CreateIndexV1),
1965        CreateMaterializedViewV1(CreateMaterializedViewV1),
1966        AlterApplyReplacementV1(AlterApplyReplacementV1),
1967        CreateRoleV1(CreateRoleV1),
1968        AlterAddColumnV1(AlterAddColumnV1),
1969        AlterSourceTimestampIntervalV1(AlterSourceTimestampIntervalV1),
1970        AlterClusterReconfigurationV1(AlterClusterReconfigurationV1),
1971        ClusterHydrationBurstV1(ClusterHydrationBurstV1),
1972    }
1973}
1974
1975/// The contents of a single state update.
1976#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1977#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1978// Serialize the top-level enum in the persist-backed catalog as internally tagged to set up
1979// persist pushdown statistics for success.
1980#[serde(tag = "kind")]
1981pub enum StateUpdateKind {
1982    AuditLog(AuditLog),
1983    Cluster(Cluster),
1984    ClusterIntrospectionSourceIndex(ClusterIntrospectionSourceIndex),
1985    ClusterReplica(ClusterReplica),
1986    Comment(Comment),
1987    Config(Config),
1988    Database(Database),
1989    DefaultPrivileges(DefaultPrivileges),
1990    FenceToken(FenceToken),
1991    GidMapping(GidMapping),
1992    IdAlloc(IdAlloc),
1993    Item(Item),
1994    NetworkPolicy(NetworkPolicy),
1995    Role(Role),
1996    RoleAuth(RoleAuth),
1997    Schema(Schema),
1998    ServerConfiguration(ServerConfiguration),
1999    ClusterSystemConfiguration(ClusterSystemConfiguration),
2000    ReplicaSystemConfiguration(ReplicaSystemConfiguration),
2001    Setting(Setting),
2002    SourceReferences(SourceReferences),
2003    StorageCollectionMetadata(StorageCollectionMetadata),
2004    SystemPrivileges(SystemPrivileges),
2005    TxnWalShard(TxnWalShard),
2006    UnfinalizedShard(UnfinalizedShard),
2007}
2008
2009#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2010#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2011pub struct AuditLog {
2012    pub key: AuditLogKey,
2013}
2014
2015#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2016#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2017pub struct Cluster {
2018    pub key: ClusterKey,
2019    pub value: ClusterValue,
2020}
2021
2022#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2023#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2024pub struct ClusterReplica {
2025    pub key: ClusterReplicaKey,
2026    pub value: ClusterReplicaValue,
2027}
2028
2029#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2030#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2031pub struct Comment {
2032    pub key: CommentKey,
2033    pub value: CommentValue,
2034}
2035
2036#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2037#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2038pub struct Config {
2039    pub key: ConfigKey,
2040    pub value: ConfigValue,
2041}
2042
2043#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2044#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2045pub struct Database {
2046    pub key: DatabaseKey,
2047    pub value: DatabaseValue,
2048}
2049
2050#[derive(
2051    Clone,
2052    Copy,
2053    Debug,
2054    PartialEq,
2055    Eq,
2056    PartialOrd,
2057    Ord,
2058    Serialize,
2059    Deserialize
2060)]
2061#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2062pub struct DefaultPrivileges {
2063    pub key: DefaultPrivilegesKey,
2064    pub value: DefaultPrivilegesValue,
2065}
2066
2067#[derive(
2068    Clone,
2069    Copy,
2070    Debug,
2071    PartialEq,
2072    Eq,
2073    PartialOrd,
2074    Ord,
2075    Serialize,
2076    Deserialize
2077)]
2078#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2079pub struct FenceToken {
2080    pub deploy_generation: u64,
2081    pub epoch: i64,
2082}
2083
2084#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2085#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2086pub struct IdAlloc {
2087    pub key: IdAllocKey,
2088    pub value: IdAllocValue,
2089}
2090
2091#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2092#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2093pub struct ClusterIntrospectionSourceIndex {
2094    pub key: ClusterIntrospectionSourceIndexKey,
2095    pub value: ClusterIntrospectionSourceIndexValue,
2096}
2097
2098#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2099#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2100pub struct Item {
2101    pub key: ItemKey,
2102    pub value: ItemValue,
2103}
2104
2105#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2106#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2107pub struct Role {
2108    pub key: RoleKey,
2109    pub value: RoleValue,
2110}
2111
2112#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2113#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2114pub struct RoleAuth {
2115    pub key: RoleAuthKey,
2116    pub value: RoleAuthValue,
2117}
2118
2119#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2120#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2121pub struct NetworkPolicy {
2122    pub key: NetworkPolicyKey,
2123    pub value: NetworkPolicyValue,
2124}
2125
2126#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2127#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2128pub struct Schema {
2129    pub key: SchemaKey,
2130    pub value: SchemaValue,
2131}
2132
2133#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2134#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2135pub struct Setting {
2136    pub key: SettingKey,
2137    pub value: SettingValue,
2138}
2139
2140#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2141#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2142pub struct ServerConfiguration {
2143    pub key: ServerConfigurationKey,
2144    pub value: ServerConfigurationValue,
2145}
2146
2147#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2148#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2149pub struct ClusterSystemConfiguration {
2150    pub key: ClusterSystemConfigurationKey,
2151    pub value: ClusterSystemConfigurationValue,
2152}
2153
2154#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2155#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2156pub struct ReplicaSystemConfiguration {
2157    pub key: ReplicaSystemConfigurationKey,
2158    pub value: ReplicaSystemConfigurationValue,
2159}
2160
2161#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2162#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2163pub struct SourceReferences {
2164    pub key: SourceReferencesKey,
2165    pub value: SourceReferencesValue,
2166}
2167
2168#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2169#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2170pub struct GidMapping {
2171    pub key: GidMappingKey,
2172    pub value: GidMappingValue,
2173}
2174
2175#[derive(
2176    Clone,
2177    Copy,
2178    Debug,
2179    PartialEq,
2180    Eq,
2181    PartialOrd,
2182    Ord,
2183    Serialize,
2184    Deserialize
2185)]
2186#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2187pub struct SystemPrivileges {
2188    pub key: SystemPrivilegesKey,
2189    pub value: SystemPrivilegesValue,
2190}
2191
2192#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2193#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2194pub struct StorageCollectionMetadata {
2195    pub key: StorageCollectionMetadataKey,
2196    pub value: StorageCollectionMetadataValue,
2197}
2198
2199#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2200#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2201pub struct UnfinalizedShard {
2202    pub key: UnfinalizedShardKey,
2203}
2204
2205#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2206#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2207pub struct TxnWalShard {
2208    pub value: TxnWalShardValue,
2209}
2210
2211#[derive(
2212    Clone,
2213    Copy,
2214    Debug,
2215    PartialEq,
2216    Eq,
2217    Hash,
2218    PartialOrd,
2219    Ord,
2220    Serialize_repr,
2221    Deserialize_repr
2222)]
2223#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2224#[repr(u8)]
2225pub enum CatalogItemType {
2226    Unknown = 0,
2227    Table = 1,
2228    Source = 2,
2229    Sink = 3,
2230    View = 4,
2231    MaterializedView = 5,
2232    Index = 6,
2233    Type = 7,
2234    Func = 8,
2235    Secret = 9,
2236    Connection = 10,
2237}
2238
2239#[derive(
2240    Clone,
2241    Copy,
2242    Debug,
2243    PartialEq,
2244    Eq,
2245    Hash,
2246    PartialOrd,
2247    Ord,
2248    Serialize_repr,
2249    Deserialize_repr
2250)]
2251#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2252#[repr(u8)]
2253pub enum ObjectType {
2254    Unknown = 0,
2255    Table = 1,
2256    View = 2,
2257    MaterializedView = 3,
2258    Source = 4,
2259    Sink = 5,
2260    Index = 6,
2261    Type = 7,
2262    Role = 8,
2263    Cluster = 9,
2264    ClusterReplica = 10,
2265    Secret = 11,
2266    Connection = 12,
2267    Database = 13,
2268    Schema = 14,
2269    Func = 15,
2270    NetworkPolicy = 17,
2271}