Skip to content

Commit a924b45

Browse files
committed
easy refactor(graphql-alt): lock down visibility
## Description Switch `pub` to `pub(crate)` or `pub(super)` where possible. ## Test plan CI
1 parent caf3ac7 commit a924b45

File tree

11 files changed

+27
-27
lines changed

11 files changed

+27
-27
lines changed

crates/sui-indexer-alt-graphql/src/api/scalars/cursor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub(crate) enum Error {
2424
}
2525

2626
impl<C> JsonCursor<C> {
27-
pub fn new(cursor: C) -> Self {
27+
pub(crate) fn new(cursor: C) -> Self {
2828
Self(cursor)
2929
}
3030
}

crates/sui-indexer-alt-graphql/src/api/types/object.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ pub(crate) struct ObjectImpl<'o>(&'o Object);
8282
#[derive(InputObject, Debug, Clone, Eq, PartialEq)]
8383
pub(crate) struct ObjectKey {
8484
/// The object's ID.
85-
pub address: SuiAddress,
85+
pub(crate) address: SuiAddress,
8686

8787
/// If specified, tries to fetch the object at this exact version.
88-
pub version: Option<UInt53>,
88+
pub(crate) version: Option<UInt53>,
8989

9090
/// If specified, tries to fetch the latest version of the object at or before this version.
9191
///
@@ -94,10 +94,10 @@ pub(crate) struct ObjectKey {
9494
/// - The root object of the object it is wrapped in, if it is wrapped.
9595
/// - The root object of its owner, if it is owned by another object.
9696
/// - The object itself, if it is not object-owned or wrapped.
97-
pub root_version: Option<UInt53>,
97+
pub(crate) root_version: Option<UInt53>,
9898

9999
/// If specified, tries to fetch the latest version as of this checkpoint.
100-
pub at_checkpoint: Option<UInt53>,
100+
pub(crate) at_checkpoint: Option<UInt53>,
101101
}
102102

103103
#[derive(thiserror::Error, Debug, Clone)]

crates/sui-indexer-alt-graphql/src/api/types/transaction.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ use super::transaction_effects::{EffectsContents, TransactionEffects};
2121

2222
#[derive(Clone)]
2323
pub(crate) struct Transaction {
24-
pub digest: TransactionDigest,
25-
pub contents: TransactionContents,
24+
pub(crate) digest: TransactionDigest,
25+
pub(crate) contents: TransactionContents,
2626
}
2727

2828
#[derive(Clone)]

crates/sui-indexer-alt-graphql/src/api/types/transaction_effects.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ use super::{
2929

3030
#[derive(Clone)]
3131
pub(crate) struct TransactionEffects {
32-
pub digest: TransactionDigest,
33-
pub contents: EffectsContents,
32+
pub(crate) digest: TransactionDigest,
33+
pub(crate) contents: EffectsContents,
3434
}
3535

3636
#[derive(Clone)]

crates/sui-indexer-alt-graphql/src/extensions/query_limits/input.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ use super::{
1818
/// How many input nodes the query used, and how deep the deepest part of the query was.
1919
#[derive(Serialize, Deserialize)]
2020
pub(super) struct Usage {
21-
pub nodes: u32,
22-
pub depth: u32,
21+
pub(super) nodes: u32,
22+
pub(super) depth: u32,
2323
}
2424

2525
/// Check input node limits for the query in `doc` regarding depth and number of nodes. These

crates/sui-indexer-alt-graphql/src/extensions/query_limits/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ pub(crate) mod show_usage;
2929
mod visitor;
3030

3131
pub(crate) struct QueryLimitsConfig {
32-
pub max_output_nodes: u32,
33-
pub max_query_nodes: u32,
34-
pub max_query_depth: u32,
35-
pub max_query_payload_size: u32,
36-
pub max_tx_payload_size: u32,
32+
pub(crate) max_output_nodes: u32,
33+
pub(crate) max_query_nodes: u32,
34+
pub(crate) max_query_depth: u32,
35+
pub(crate) max_query_payload_size: u32,
36+
pub(crate) max_tx_payload_size: u32,
3737

38-
pub tx_payload_args: BTreeSet<(&'static str, &'static str, &'static str)>,
38+
pub(crate) tx_payload_args: BTreeSet<(&'static str, &'static str, &'static str)>,
3939
}
4040

4141
/// Extension factory for adding checks that the query is within configurable limits.
@@ -64,7 +64,7 @@ struct Usage {
6464

6565
impl QueryLimitsConfig {
6666
/// Requests to this service can definitely not exceed this size, in bytes.
67-
pub fn max_payload_size(&self) -> u32 {
67+
pub(crate) fn max_payload_size(&self) -> u32 {
6868
self.max_query_payload_size + self.max_tx_payload_size
6969
}
7070
}

crates/sui-indexer-alt-graphql/src/extensions/query_limits/output.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use super::{
1717
/// How many output nodes are estimated to be output from this query.
1818
#[derive(Serialize, Deserialize)]
1919
pub(super) struct Usage {
20-
pub nodes: u32,
20+
pub(super) nodes: u32,
2121
}
2222

2323
struct OutputNodeBudget<'c> {

crates/sui-indexer-alt-graphql/src/extensions/query_limits/payload.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ use super::{
2121
/// The proportion of the query content that was transaction payload versus query payload.
2222
#[derive(Serialize, Deserialize)]
2323
pub(super) struct Usage {
24-
pub query_payload_size: u32,
25-
pub tx_payload_size: u32,
24+
pub(super) query_payload_size: u32,
25+
pub(super) tx_payload_size: u32,
2626
}
2727

2828
/// Validation rule that finds parts of the request that correspond to transaction payloads

crates/sui-indexer-alt-graphql/src/extensions/timeout.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ use crate::error::request_timeout;
2020

2121
/// How long to wait for each kind of operation before timing out.
2222
pub(crate) struct TimeoutConfig {
23-
pub query: Duration,
24-
pub mutation: Duration,
23+
pub(crate) query: Duration,
24+
pub(crate) mutation: Duration,
2525
}
2626

2727
/// The timeout extension is responsible for limiting the amount of time spent serving any single

crates/sui-indexer-alt-graphql/src/pagination.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ pub(crate) struct PaginationConfig {
2626

2727
/// The configuration for a single paginated field.
2828
pub(crate) struct PageLimits {
29-
pub default: u32,
30-
pub max: u32,
29+
pub(crate) default: u32,
30+
pub(crate) max: u32,
3131
}
3232

3333
#[derive(Debug, Eq, PartialEq)]

0 commit comments

Comments
 (0)