Skip to main content

mz_catalog_protos/
objects_v87.rs

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