Skip to main content

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