Skip to main content

mz_catalog_protos/
objects.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 optimizer_feature_overrides: Vec<OptimizerFeatureOverride>,
927    pub schedule: ClusterSchedule,
928    /// User-configured autoscaling policy, distinct from the in-flight runtime
929    /// records below.
930    pub auto_scaling_strategy: Option<AutoScalingStrategy>,
931    /// Latest graceful reconfiguration record, if one has been written.
932    pub reconfiguration: Option<ReconfigurationState>,
933    /// In-flight hydration burst the controller is running.
934    pub burst: Option<BurstState>,
935}
936
937/// The user-configured autoscaling policy of a managed cluster.
938///
939/// Extensible: future strategies are added as additional optional sub-policies.
940#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
941#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
942pub struct AutoScalingStrategy {
943    pub on_hydration: Option<OnHydration>,
944}
945
946/// The `ON HYDRATION` autoscaling sub-policy.
947#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
948#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
949pub struct OnHydration {
950    pub hydration_size: String,
951    pub linger_duration: Option<Duration>,
952}
953
954/// Latest graceful reconfiguration record, including the target shape, deadline,
955/// timeout action, and lifecycle status.
956#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
957#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
958pub struct ReconfigurationState {
959    pub target: ReconfigurationTarget,
960    /// Deadline as an `mz_repr::Timestamp`.
961    pub deadline: u64,
962    /// What to do if the deadline passes before the target hydrates.
963    pub on_timeout: OnTimeoutAction,
964    pub status: ReconfigurationStatus,
965}
966
967/// The lifecycle status of the latest graceful reconfiguration.
968#[derive(
969    Clone,
970    Copy,
971    Debug,
972    PartialEq,
973    Eq,
974    PartialOrd,
975    Ord,
976    Serialize,
977    Deserialize
978)]
979#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
980pub enum ReconfigurationStatus {
981    InProgress,
982    Finalized,
983    TimedOut,
984    Cancelled,
985    ResourceExhausted,
986}
987
988/// The action a graceful reconfiguration applies if its deadline passes before
989/// the target replicas hydrate. Mirrors `mz_sql::plan::OnTimeoutAction`.
990#[derive(
991    Clone,
992    Copy,
993    Debug,
994    PartialEq,
995    Eq,
996    PartialOrd,
997    Ord,
998    Serialize,
999    Deserialize
1000)]
1001#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1002pub enum OnTimeoutAction {
1003    /// Cut over to the (not-yet-hydrated) target anyway.
1004    Commit,
1005    /// Drop the target replica set, reverting to the pre-reconfiguration shape.
1006    Rollback,
1007}
1008
1009/// The full config shape a reconfiguration is moving the cluster to, so a
1010/// combined size + replication-factor + availability-zone change is one record.
1011#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1012#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1013pub struct ReconfigurationTarget {
1014    pub size: String,
1015    pub replication_factor: u32,
1016    pub availability_zones: Vec<String>,
1017    pub logging: ReplicaLogging,
1018}
1019
1020/// An active hydration burst.
1021#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1022#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1023pub struct BurstState {
1024    pub burst_size: String,
1025    pub linger_duration: Duration,
1026    /// When the steady-state replicas were first observed hydrated, as an
1027    /// `mz_repr::Timestamp`. Absent until that observation.
1028    pub steady_hydrated_at: Option<u64>,
1029}
1030
1031#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1032#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1033pub struct ReplicaConfig {
1034    pub logging: ReplicaLogging,
1035    pub location: ReplicaLocation,
1036}
1037
1038#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1039#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1040pub struct UnmanagedLocation {
1041    pub storagectl_addrs: Vec<String>,
1042    pub computectl_addrs: Vec<String>,
1043}
1044
1045#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1046#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1047pub struct ManagedLocation {
1048    pub size: String,
1049    /// The availability zones the replica was provisioned under.
1050    ///
1051    /// For a replica of a managed cluster this is the cluster's
1052    /// `AVAILABILITY ZONES` pool at provision time; the cluster controller
1053    /// compares it against a cluster's target `availability_zones` to tell
1054    /// realized- from target-shape replicas (including an `AVAILABILITY ZONES`
1055    /// divergence). For a replica of an unmanaged cluster it is the user-pinned
1056    /// `AVAILABILITY ZONE`, as a zero- or one-element list. Empty when no zones
1057    /// constrain placement.
1058    pub availability_zones: Vec<String>,
1059    pub internal: bool,
1060    pub billed_as: Option<String>,
1061    pub pending: bool,
1062}
1063
1064#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1065#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1066pub enum ReplicaLocation {
1067    Unmanaged(UnmanagedLocation),
1068    Managed(ManagedLocation),
1069}
1070
1071#[derive(
1072    Clone,
1073    Copy,
1074    Debug,
1075    PartialEq,
1076    Eq,
1077    PartialOrd,
1078    Ord,
1079    Serialize,
1080    Deserialize
1081)]
1082#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1083pub enum RoleId {
1084    System(u64),
1085    User(u64),
1086    Public,
1087    Predefined(u64),
1088}
1089
1090#[derive(
1091    Clone,
1092    Copy,
1093    Debug,
1094    PartialEq,
1095    Eq,
1096    PartialOrd,
1097    Ord,
1098    Serialize,
1099    Deserialize
1100)]
1101#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1102pub enum AutoProvisionSource {
1103    Oidc = 0,
1104    Frontegg = 1,
1105    None = 2,
1106}
1107
1108#[derive(
1109    Clone,
1110    Copy,
1111    Debug,
1112    PartialEq,
1113    Eq,
1114    PartialOrd,
1115    Ord,
1116    Serialize,
1117    Deserialize
1118)]
1119#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1120pub struct RoleAttributes {
1121    pub inherit: bool,
1122    pub superuser: Option<bool>,
1123    pub login: Option<bool>,
1124    pub auto_provision_source: Option<AutoProvisionSource>,
1125}
1126
1127#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1128#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1129pub struct RoleMembership {
1130    pub map: Vec<RoleMembershipEntry>,
1131}
1132
1133#[derive(
1134    Clone,
1135    Copy,
1136    Debug,
1137    PartialEq,
1138    Eq,
1139    PartialOrd,
1140    Ord,
1141    Serialize,
1142    Deserialize
1143)]
1144#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1145pub struct RoleMembershipEntry {
1146    pub key: RoleId,
1147    pub value: RoleId,
1148}
1149
1150#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1151#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1152pub struct RoleVars {
1153    pub entries: Vec<RoleVarsEntry>,
1154}
1155
1156#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1157#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1158pub struct RoleVarsEntry {
1159    pub key: String,
1160    pub val: RoleVar,
1161}
1162
1163#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1164#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1165pub enum RoleVar {
1166    Flat(String),
1167    SqlSet(Vec<String>),
1168}
1169
1170#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1171#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1172pub struct NetworkPolicyRule {
1173    pub name: String,
1174    pub address: String,
1175    pub action: NetworkPolicyRuleAction,
1176    pub direction: NetworkPolicyRuleDirection,
1177}
1178
1179#[derive(
1180    Clone,
1181    Copy,
1182    Debug,
1183    PartialEq,
1184    Eq,
1185    PartialOrd,
1186    Ord,
1187    Serialize,
1188    Deserialize
1189)]
1190#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1191pub enum NetworkPolicyRuleAction {
1192    Allow,
1193}
1194
1195#[derive(
1196    Clone,
1197    Copy,
1198    Debug,
1199    PartialEq,
1200    Eq,
1201    PartialOrd,
1202    Ord,
1203    Serialize,
1204    Deserialize
1205)]
1206#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1207pub enum NetworkPolicyRuleDirection {
1208    Ingress,
1209}
1210
1211#[derive(
1212    Clone,
1213    Copy,
1214    Debug,
1215    PartialEq,
1216    Eq,
1217    PartialOrd,
1218    Ord,
1219    Serialize,
1220    Deserialize
1221)]
1222#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1223pub struct AclMode {
1224    pub bitflags: u64,
1225}
1226
1227#[derive(
1228    Clone,
1229    Copy,
1230    Debug,
1231    PartialEq,
1232    Eq,
1233    PartialOrd,
1234    Ord,
1235    Serialize,
1236    Deserialize
1237)]
1238#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1239pub struct MzAclItem {
1240    pub grantee: RoleId,
1241    pub grantor: RoleId,
1242    pub acl_mode: AclMode,
1243}
1244
1245#[derive(
1246    Clone,
1247    Copy,
1248    Debug,
1249    PartialEq,
1250    Eq,
1251    PartialOrd,
1252    Ord,
1253    Serialize,
1254    Deserialize
1255)]
1256#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1257pub struct DefaultPrivilegesKey {
1258    pub role_id: RoleId,
1259    pub database_id: Option<DatabaseId>,
1260    pub schema_id: Option<SchemaId>,
1261    pub object_type: ObjectType,
1262    pub grantee: RoleId,
1263}
1264
1265#[derive(
1266    Clone,
1267    Copy,
1268    Debug,
1269    PartialEq,
1270    Eq,
1271    PartialOrd,
1272    Ord,
1273    Serialize,
1274    Deserialize
1275)]
1276#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1277pub struct DefaultPrivilegesValue {
1278    pub privileges: AclMode,
1279}
1280
1281#[derive(
1282    Clone,
1283    Copy,
1284    Debug,
1285    PartialEq,
1286    Eq,
1287    PartialOrd,
1288    Ord,
1289    Serialize,
1290    Deserialize
1291)]
1292#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1293pub struct SystemPrivilegesKey {
1294    pub grantee: RoleId,
1295    pub grantor: RoleId,
1296}
1297
1298#[derive(
1299    Clone,
1300    Copy,
1301    Debug,
1302    PartialEq,
1303    Eq,
1304    PartialOrd,
1305    Ord,
1306    Serialize,
1307    Deserialize
1308)]
1309#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1310pub struct SystemPrivilegesValue {
1311    pub acl_mode: AclMode,
1312}
1313
1314#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1315#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1316pub struct AuditLogEventV1 {
1317    pub id: u64,
1318    pub event_type: audit_log_event_v1::EventType,
1319    pub object_type: audit_log_event_v1::ObjectType,
1320    pub user: Option<StringWrapper>,
1321    pub occurred_at: EpochMillis,
1322    pub details: audit_log_event_v1::Details,
1323}
1324
1325pub mod audit_log_event_v1 {
1326    use super::*;
1327
1328    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1329    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1330    pub struct IdFullNameV1 {
1331        pub id: String,
1332        pub name: FullNameV1,
1333    }
1334
1335    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1336    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1337    pub struct FullNameV1 {
1338        pub database: String,
1339        pub schema: String,
1340        pub item: String,
1341    }
1342
1343    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1344    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1345    pub struct IdNameV1 {
1346        pub id: String,
1347        pub name: String,
1348    }
1349
1350    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1351    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1352    pub struct RenameClusterV1 {
1353        pub id: String,
1354        pub old_name: String,
1355        pub new_name: String,
1356    }
1357
1358    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1359    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1360    pub struct RenameClusterReplicaV1 {
1361        pub cluster_id: String,
1362        pub replica_id: String,
1363        pub old_name: String,
1364        pub new_name: String,
1365    }
1366
1367    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1368    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1369    pub struct AlterClusterReconfigurationV1 {
1370        pub cluster_id: String,
1371        pub cluster_name: String,
1372        pub transition: ReconfigurationLifecycleV1,
1373        /// On a `finalized` transition: whether the cut-over was forced by `ON
1374        /// TIMEOUT COMMIT` at the deadline rather than reached by hydration.
1375        #[serde(default)]
1376        pub forced: Option<bool>,
1377        pub target_size: String,
1378        pub target_replication_factor: u32,
1379        pub target_availability_zones: Vec<String>,
1380        pub target_logging: ClusterReplicaLoggingV1,
1381        pub deadline: Option<u64>,
1382    }
1383
1384    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1385    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1386    pub struct ClusterReplicaLoggingV1 {
1387        pub log_logging: bool,
1388        pub interval: Option<Duration>,
1389    }
1390
1391    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1392    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1393    pub struct ReconfigurationLifecycleV1 {
1394        pub transition: reconfiguration_lifecycle_v1::Transition,
1395    }
1396
1397    pub mod reconfiguration_lifecycle_v1 {
1398        use super::*;
1399
1400        #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1401        #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1402        pub enum Transition {
1403            Started(Empty),
1404            Finalized(Empty),
1405            TimedOut(Empty),
1406            Cancelled(Empty),
1407            ResourceExhausted(Empty),
1408        }
1409    }
1410
1411    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1412    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1413    pub struct ClusterHydrationBurstV1 {
1414        pub cluster_id: String,
1415        pub cluster_name: String,
1416        pub transition: HydrationBurstLifecycleV1,
1417        /// On a `finished` transition: why the burst tore down.
1418        #[serde(default)]
1419        pub finish_cause: Option<BurstFinishCauseV1>,
1420        pub burst_size: String,
1421    }
1422
1423    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1424    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1425    pub struct HydrationBurstLifecycleV1 {
1426        pub transition: hydration_burst_lifecycle_v1::Transition,
1427    }
1428
1429    pub mod hydration_burst_lifecycle_v1 {
1430        use super::*;
1431
1432        #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1433        #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1434        pub enum Transition {
1435            Started(Empty),
1436            Finished(Empty),
1437        }
1438    }
1439
1440    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1441    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1442    pub struct BurstFinishCauseV1 {
1443        pub cause: burst_finish_cause_v1::Cause,
1444    }
1445
1446    pub mod burst_finish_cause_v1 {
1447        use super::*;
1448
1449        #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1450        #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1451        pub enum Cause {
1452            LingerElapsed(Empty),
1453            NoLongerWarranted(Empty),
1454        }
1455    }
1456
1457    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1458    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1459    pub struct RenameItemV1 {
1460        pub id: String,
1461        pub old_name: FullNameV1,
1462        pub new_name: FullNameV1,
1463    }
1464
1465    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1466    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1467    pub struct CreateClusterReplicaV1 {
1468        pub cluster_id: String,
1469        pub cluster_name: String,
1470        pub replica_id: Option<StringWrapper>,
1471        pub replica_name: String,
1472        pub logical_size: String,
1473        pub disk: bool,
1474        pub billed_as: Option<String>,
1475        pub internal: bool,
1476    }
1477
1478    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1479    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1480    pub struct CreateClusterReplicaV2 {
1481        pub cluster_id: String,
1482        pub cluster_name: String,
1483        pub replica_id: Option<StringWrapper>,
1484        pub replica_name: String,
1485        pub logical_size: String,
1486        pub disk: bool,
1487        pub billed_as: Option<String>,
1488        pub internal: bool,
1489        pub reason: CreateOrDropClusterReplicaReasonV1,
1490        pub scheduling_policies: Option<SchedulingDecisionsWithReasonsV1>,
1491    }
1492
1493    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1494    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1495    pub struct CreateClusterReplicaV3 {
1496        pub cluster_id: String,
1497        pub cluster_name: String,
1498        pub replica_id: Option<StringWrapper>,
1499        pub replica_name: String,
1500        pub logical_size: String,
1501        pub disk: bool,
1502        pub billed_as: Option<String>,
1503        pub internal: bool,
1504        pub reason: CreateOrDropClusterReplicaReasonV1,
1505        pub scheduling_policies: Option<SchedulingDecisionsWithReasonsV2>,
1506    }
1507
1508    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1509    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1510    pub struct CreateClusterReplicaV4 {
1511        pub cluster_id: String,
1512        pub cluster_name: String,
1513        pub replica_id: Option<StringWrapper>,
1514        pub replica_name: String,
1515        pub logical_size: String,
1516        pub billed_as: Option<String>,
1517        pub internal: bool,
1518        pub reason: CreateOrDropClusterReplicaReasonV1,
1519        pub scheduling_policies: Option<SchedulingDecisionsWithReasonsV2>,
1520    }
1521
1522    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1523    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1524    pub struct DropClusterReplicaV1 {
1525        pub cluster_id: String,
1526        pub cluster_name: String,
1527        pub replica_id: Option<StringWrapper>,
1528        pub replica_name: String,
1529    }
1530
1531    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1532    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1533    pub struct DropClusterReplicaV2 {
1534        pub cluster_id: String,
1535        pub cluster_name: String,
1536        pub replica_id: Option<StringWrapper>,
1537        pub replica_name: String,
1538        pub reason: CreateOrDropClusterReplicaReasonV1,
1539        pub scheduling_policies: Option<SchedulingDecisionsWithReasonsV1>,
1540    }
1541
1542    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1543    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1544    pub struct DropClusterReplicaV3 {
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<SchedulingDecisionsWithReasonsV2>,
1551    }
1552
1553    #[derive(
1554        Clone,
1555        Copy,
1556        Debug,
1557        PartialEq,
1558        Eq,
1559        PartialOrd,
1560        Ord,
1561        Serialize,
1562        Deserialize
1563    )]
1564    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1565    pub struct CreateOrDropClusterReplicaReasonV1 {
1566        pub reason: CreateOrDropClusterReplicaReasonV1Reason,
1567    }
1568
1569    #[derive(
1570        Clone,
1571        Copy,
1572        Debug,
1573        PartialEq,
1574        Eq,
1575        PartialOrd,
1576        Ord,
1577        Serialize,
1578        Deserialize
1579    )]
1580    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1581    pub enum CreateOrDropClusterReplicaReasonV1Reason {
1582        Manual(Empty),
1583        Schedule(Empty),
1584        System(Empty),
1585        Reconfiguration(Empty),
1586        HydrationBurst(Empty),
1587        Retired(Empty),
1588    }
1589
1590    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1591    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1592    pub struct SchedulingDecisionsWithReasonsV1 {
1593        pub on_refresh: RefreshDecisionWithReasonV1,
1594    }
1595
1596    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1597    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1598    pub struct SchedulingDecisionsWithReasonsV2 {
1599        pub on_refresh: RefreshDecisionWithReasonV2,
1600    }
1601
1602    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1603    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1604    pub enum RefreshDecision {
1605        On(Empty),
1606        Off(Empty),
1607    }
1608
1609    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1610    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1611    pub struct RefreshDecisionWithReasonV1 {
1612        pub objects_needing_refresh: Vec<String>,
1613        pub rehydration_time_estimate: String,
1614        pub decision: RefreshDecision,
1615    }
1616
1617    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1618    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1619    pub struct RefreshDecisionWithReasonV2 {
1620        pub objects_needing_refresh: Vec<String>,
1621        pub objects_needing_compaction: Vec<String>,
1622        pub rehydration_time_estimate: String,
1623        pub decision: RefreshDecision,
1624    }
1625
1626    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1627    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1628    pub struct CreateSourceSinkV1 {
1629        pub id: String,
1630        pub name: FullNameV1,
1631        pub size: Option<StringWrapper>,
1632    }
1633
1634    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1635    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1636    pub struct CreateSourceSinkV2 {
1637        pub id: String,
1638        pub name: FullNameV1,
1639        pub size: Option<StringWrapper>,
1640        pub external_type: String,
1641    }
1642
1643    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1644    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1645    pub struct CreateSourceSinkV3 {
1646        pub id: String,
1647        pub name: FullNameV1,
1648        pub external_type: String,
1649    }
1650
1651    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1652    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1653    pub struct CreateSourceSinkV4 {
1654        pub id: String,
1655        pub cluster_id: Option<StringWrapper>,
1656        pub name: FullNameV1,
1657        pub external_type: String,
1658    }
1659
1660    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1661    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1662    pub struct CreateIndexV1 {
1663        pub id: String,
1664        pub cluster_id: String,
1665        pub name: FullNameV1,
1666    }
1667
1668    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1669    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1670    pub struct CreateMaterializedViewV1 {
1671        pub id: String,
1672        pub cluster_id: String,
1673        pub name: FullNameV1,
1674        pub replacement_target_id: Option<String>,
1675    }
1676
1677    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1678    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1679    pub struct AlterApplyReplacementV1 {
1680        pub target: IdFullNameV1,
1681        pub replacement: IdFullNameV1,
1682    }
1683
1684    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1685    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1686    pub struct AlterSourceSinkV1 {
1687        pub id: String,
1688        pub name: FullNameV1,
1689        pub old_size: Option<StringWrapper>,
1690        pub new_size: Option<StringWrapper>,
1691    }
1692
1693    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1694    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1695    pub struct AlterSetClusterV1 {
1696        pub id: String,
1697        pub name: FullNameV1,
1698        pub old_cluster_id: String,
1699        pub new_cluster_id: String,
1700    }
1701
1702    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1703    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1704    pub struct GrantRoleV1 {
1705        pub role_id: String,
1706        pub member_id: String,
1707        pub grantor_id: String,
1708    }
1709
1710    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1711    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1712    pub struct GrantRoleV2 {
1713        pub role_id: String,
1714        pub member_id: String,
1715        pub grantor_id: String,
1716        pub executed_by: String,
1717    }
1718
1719    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1720    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1721    pub struct RevokeRoleV1 {
1722        pub role_id: String,
1723        pub member_id: String,
1724    }
1725
1726    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1727    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1728    pub struct RevokeRoleV2 {
1729        pub role_id: String,
1730        pub member_id: String,
1731        pub grantor_id: String,
1732        pub executed_by: String,
1733    }
1734
1735    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1736    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1737    pub struct UpdatePrivilegeV1 {
1738        pub object_id: String,
1739        pub grantee_id: String,
1740        pub grantor_id: String,
1741        pub privileges: String,
1742    }
1743
1744    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1745    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1746    pub struct AlterDefaultPrivilegeV1 {
1747        pub role_id: String,
1748        pub database_id: Option<StringWrapper>,
1749        pub schema_id: Option<StringWrapper>,
1750        pub grantee_id: String,
1751        pub privileges: String,
1752    }
1753
1754    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1755    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1756    pub struct UpdateOwnerV1 {
1757        pub object_id: String,
1758        pub old_owner_id: String,
1759        pub new_owner_id: String,
1760    }
1761
1762    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1763    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1764    pub struct SchemaV1 {
1765        pub id: String,
1766        pub name: String,
1767        pub database_name: String,
1768    }
1769
1770    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1771    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1772    pub struct SchemaV2 {
1773        pub id: String,
1774        pub name: String,
1775        pub database_name: Option<StringWrapper>,
1776    }
1777
1778    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1779    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1780    pub struct RenameSchemaV1 {
1781        pub id: String,
1782        pub database_name: Option<String>,
1783        pub old_name: String,
1784        pub new_name: String,
1785    }
1786
1787    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1788    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1789    pub struct UpdateItemV1 {
1790        pub id: String,
1791        pub name: FullNameV1,
1792    }
1793
1794    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1795    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1796    pub struct AlterRetainHistoryV1 {
1797        pub id: String,
1798        pub old_history: Option<String>,
1799        pub new_history: Option<String>,
1800    }
1801
1802    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1803    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1804    pub struct AlterAddColumnV1 {
1805        pub id: String,
1806        pub column: String,
1807        pub column_type: String,
1808        pub nullable: bool,
1809    }
1810
1811    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1812    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1813    pub struct AlterSourceTimestampIntervalV1 {
1814        pub id: String,
1815        pub old_interval: Option<String>,
1816        pub new_interval: Option<String>,
1817    }
1818
1819    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1820    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1821    pub struct ToNewIdV1 {
1822        pub id: String,
1823        pub new_id: String,
1824    }
1825
1826    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1827    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1828    pub struct FromPreviousIdV1 {
1829        pub id: String,
1830        pub previous_id: String,
1831    }
1832
1833    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1834    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1835    pub struct SetV1 {
1836        pub name: String,
1837        pub value: Option<String>,
1838    }
1839
1840    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1841    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1842    pub struct RotateKeysV1 {
1843        pub id: String,
1844        pub name: String,
1845    }
1846
1847    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1848    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1849    pub struct CreateRoleV1 {
1850        pub id: String,
1851        pub name: String,
1852        pub auto_provision_source: Option<String>,
1853    }
1854
1855    #[derive(
1856        Clone,
1857        Copy,
1858        Debug,
1859        PartialEq,
1860        Eq,
1861        Hash,
1862        PartialOrd,
1863        Ord,
1864        Serialize_repr,
1865        Deserialize_repr
1866    )]
1867    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1868    #[repr(u8)]
1869    pub enum EventType {
1870        Unknown = 0,
1871        Create = 1,
1872        Drop = 2,
1873        Alter = 3,
1874        Grant = 4,
1875        Revoke = 5,
1876        Comment = 6,
1877    }
1878
1879    #[derive(
1880        Clone,
1881        Copy,
1882        Debug,
1883        PartialEq,
1884        Eq,
1885        Hash,
1886        PartialOrd,
1887        Ord,
1888        Serialize_repr,
1889        Deserialize_repr
1890    )]
1891    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1892    #[repr(u8)]
1893    pub enum ObjectType {
1894        Unknown = 0,
1895        Cluster = 1,
1896        ClusterReplica = 2,
1897        Connection = 3,
1898        Database = 4,
1899        Func = 5,
1900        Index = 6,
1901        MaterializedView = 7,
1902        Role = 8,
1903        Secret = 9,
1904        Schema = 10,
1905        Sink = 11,
1906        Source = 12,
1907        Table = 13,
1908        Type = 14,
1909        View = 15,
1910        System = 16,
1911        ContinualTask = 17,
1912        NetworkPolicy = 18,
1913    }
1914
1915    #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1916    #[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1917    pub enum Details {
1918        CreateClusterReplicaV1(CreateClusterReplicaV1),
1919        CreateClusterReplicaV2(CreateClusterReplicaV2),
1920        CreateClusterReplicaV3(CreateClusterReplicaV3),
1921        CreateClusterReplicaV4(CreateClusterReplicaV4),
1922        DropClusterReplicaV1(DropClusterReplicaV1),
1923        DropClusterReplicaV2(DropClusterReplicaV2),
1924        DropClusterReplicaV3(DropClusterReplicaV3),
1925        CreateSourceSinkV1(CreateSourceSinkV1),
1926        CreateSourceSinkV2(CreateSourceSinkV2),
1927        AlterSourceSinkV1(AlterSourceSinkV1),
1928        AlterSetClusterV1(AlterSetClusterV1),
1929        GrantRoleV1(GrantRoleV1),
1930        GrantRoleV2(GrantRoleV2),
1931        RevokeRoleV1(RevokeRoleV1),
1932        RevokeRoleV2(RevokeRoleV2),
1933        UpdatePrivilegeV1(UpdatePrivilegeV1),
1934        AlterDefaultPrivilegeV1(AlterDefaultPrivilegeV1),
1935        UpdateOwnerV1(UpdateOwnerV1),
1936        IdFullNameV1(IdFullNameV1),
1937        RenameClusterV1(RenameClusterV1),
1938        RenameClusterReplicaV1(RenameClusterReplicaV1),
1939        RenameItemV1(RenameItemV1),
1940        IdNameV1(IdNameV1),
1941        SchemaV1(SchemaV1),
1942        SchemaV2(SchemaV2),
1943        RenameSchemaV1(RenameSchemaV1),
1944        UpdateItemV1(UpdateItemV1),
1945        CreateSourceSinkV3(CreateSourceSinkV3),
1946        AlterRetainHistoryV1(AlterRetainHistoryV1),
1947        ToNewIdV1(ToNewIdV1),
1948        FromPreviousIdV1(FromPreviousIdV1),
1949        SetV1(SetV1),
1950        ResetAllV1(Empty),
1951        RotateKeysV1(RotateKeysV1),
1952        CreateSourceSinkV4(CreateSourceSinkV4),
1953        CreateIndexV1(CreateIndexV1),
1954        CreateMaterializedViewV1(CreateMaterializedViewV1),
1955        AlterApplyReplacementV1(AlterApplyReplacementV1),
1956        CreateRoleV1(CreateRoleV1),
1957        AlterAddColumnV1(AlterAddColumnV1),
1958        AlterSourceTimestampIntervalV1(AlterSourceTimestampIntervalV1),
1959        AlterClusterReconfigurationV1(AlterClusterReconfigurationV1),
1960        ClusterHydrationBurstV1(ClusterHydrationBurstV1),
1961    }
1962}
1963
1964/// The contents of a single state update.
1965#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1966#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
1967// Serialize the top-level enum in the persist-backed catalog as internally tagged to set up
1968// persist pushdown statistics for success.
1969#[serde(tag = "kind")]
1970pub enum StateUpdateKind {
1971    AuditLog(AuditLog),
1972    Cluster(Cluster),
1973    ClusterIntrospectionSourceIndex(ClusterIntrospectionSourceIndex),
1974    ClusterReplica(ClusterReplica),
1975    Comment(Comment),
1976    Config(Config),
1977    Database(Database),
1978    DefaultPrivileges(DefaultPrivileges),
1979    FenceToken(FenceToken),
1980    GidMapping(GidMapping),
1981    IdAlloc(IdAlloc),
1982    Item(Item),
1983    NetworkPolicy(NetworkPolicy),
1984    Role(Role),
1985    RoleAuth(RoleAuth),
1986    Schema(Schema),
1987    ServerConfiguration(ServerConfiguration),
1988    ClusterSystemConfiguration(ClusterSystemConfiguration),
1989    ReplicaSystemConfiguration(ReplicaSystemConfiguration),
1990    Setting(Setting),
1991    SourceReferences(SourceReferences),
1992    StorageCollectionMetadata(StorageCollectionMetadata),
1993    SystemPrivileges(SystemPrivileges),
1994    TxnWalShard(TxnWalShard),
1995    UnfinalizedShard(UnfinalizedShard),
1996}
1997
1998#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
1999#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2000pub struct AuditLog {
2001    pub key: AuditLogKey,
2002}
2003
2004#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2005#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2006pub struct Cluster {
2007    pub key: ClusterKey,
2008    pub value: ClusterValue,
2009}
2010
2011#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2012#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2013pub struct ClusterReplica {
2014    pub key: ClusterReplicaKey,
2015    pub value: ClusterReplicaValue,
2016}
2017
2018#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2019#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2020pub struct Comment {
2021    pub key: CommentKey,
2022    pub value: CommentValue,
2023}
2024
2025#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2026#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2027pub struct Config {
2028    pub key: ConfigKey,
2029    pub value: ConfigValue,
2030}
2031
2032#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2033#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2034pub struct Database {
2035    pub key: DatabaseKey,
2036    pub value: DatabaseValue,
2037}
2038
2039#[derive(
2040    Clone,
2041    Copy,
2042    Debug,
2043    PartialEq,
2044    Eq,
2045    PartialOrd,
2046    Ord,
2047    Serialize,
2048    Deserialize
2049)]
2050#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2051pub struct DefaultPrivileges {
2052    pub key: DefaultPrivilegesKey,
2053    pub value: DefaultPrivilegesValue,
2054}
2055
2056#[derive(
2057    Clone,
2058    Copy,
2059    Debug,
2060    PartialEq,
2061    Eq,
2062    PartialOrd,
2063    Ord,
2064    Serialize,
2065    Deserialize
2066)]
2067#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2068pub struct FenceToken {
2069    pub deploy_generation: u64,
2070    pub epoch: i64,
2071}
2072
2073#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2074#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2075pub struct IdAlloc {
2076    pub key: IdAllocKey,
2077    pub value: IdAllocValue,
2078}
2079
2080#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2081#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2082pub struct ClusterIntrospectionSourceIndex {
2083    pub key: ClusterIntrospectionSourceIndexKey,
2084    pub value: ClusterIntrospectionSourceIndexValue,
2085}
2086
2087#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2088#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2089pub struct Item {
2090    pub key: ItemKey,
2091    pub value: ItemValue,
2092}
2093
2094#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2095#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2096pub struct Role {
2097    pub key: RoleKey,
2098    pub value: RoleValue,
2099}
2100
2101#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2102#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2103pub struct RoleAuth {
2104    pub key: RoleAuthKey,
2105    pub value: RoleAuthValue,
2106}
2107
2108#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2109#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2110pub struct NetworkPolicy {
2111    pub key: NetworkPolicyKey,
2112    pub value: NetworkPolicyValue,
2113}
2114
2115#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2116#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2117pub struct Schema {
2118    pub key: SchemaKey,
2119    pub value: SchemaValue,
2120}
2121
2122#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2123#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2124pub struct Setting {
2125    pub key: SettingKey,
2126    pub value: SettingValue,
2127}
2128
2129#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2130#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2131pub struct ServerConfiguration {
2132    pub key: ServerConfigurationKey,
2133    pub value: ServerConfigurationValue,
2134}
2135
2136#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2137#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2138pub struct ClusterSystemConfiguration {
2139    pub key: ClusterSystemConfigurationKey,
2140    pub value: ClusterSystemConfigurationValue,
2141}
2142
2143#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2144#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2145pub struct ReplicaSystemConfiguration {
2146    pub key: ReplicaSystemConfigurationKey,
2147    pub value: ReplicaSystemConfigurationValue,
2148}
2149
2150#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2151#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2152pub struct SourceReferences {
2153    pub key: SourceReferencesKey,
2154    pub value: SourceReferencesValue,
2155}
2156
2157#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2158#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2159pub struct GidMapping {
2160    pub key: GidMappingKey,
2161    pub value: GidMappingValue,
2162}
2163
2164#[derive(
2165    Clone,
2166    Copy,
2167    Debug,
2168    PartialEq,
2169    Eq,
2170    PartialOrd,
2171    Ord,
2172    Serialize,
2173    Deserialize
2174)]
2175#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2176pub struct SystemPrivileges {
2177    pub key: SystemPrivilegesKey,
2178    pub value: SystemPrivilegesValue,
2179}
2180
2181#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2182#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2183pub struct StorageCollectionMetadata {
2184    pub key: StorageCollectionMetadataKey,
2185    pub value: StorageCollectionMetadataValue,
2186}
2187
2188#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2189#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2190pub struct UnfinalizedShard {
2191    pub key: UnfinalizedShardKey,
2192}
2193
2194#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
2195#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2196pub struct TxnWalShard {
2197    pub value: TxnWalShardValue,
2198}
2199
2200#[derive(
2201    Clone,
2202    Copy,
2203    Debug,
2204    PartialEq,
2205    Eq,
2206    Hash,
2207    PartialOrd,
2208    Ord,
2209    Serialize_repr,
2210    Deserialize_repr
2211)]
2212#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2213#[repr(u8)]
2214pub enum CatalogItemType {
2215    Unknown = 0,
2216    Table = 1,
2217    Source = 2,
2218    Sink = 3,
2219    View = 4,
2220    MaterializedView = 5,
2221    Index = 6,
2222    Type = 7,
2223    Func = 8,
2224    Secret = 9,
2225    Connection = 10,
2226}
2227
2228#[derive(
2229    Clone,
2230    Copy,
2231    Debug,
2232    PartialEq,
2233    Eq,
2234    Hash,
2235    PartialOrd,
2236    Ord,
2237    Serialize_repr,
2238    Deserialize_repr
2239)]
2240#[cfg_attr(any(test, feature = "proptest"), derive(Arbitrary))]
2241#[repr(u8)]
2242pub enum ObjectType {
2243    Unknown = 0,
2244    Table = 1,
2245    View = 2,
2246    MaterializedView = 3,
2247    Source = 4,
2248    Sink = 5,
2249    Index = 6,
2250    Type = 7,
2251    Role = 8,
2252    Cluster = 9,
2253    ClusterReplica = 10,
2254    Secret = 11,
2255    Connection = 12,
2256    Database = 13,
2257    Schema = 14,
2258    Func = 15,
2259    NetworkPolicy = 17,
2260}