Skip to main content

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