Skip to main content

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