-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Indexer] Add raw_checkpoints table (#19451)
## Description This PR adds a raw_checkpoints table that store the raw BCS data for each checkpoint. This will serve as the KV table for checkpoints. ## Test plan CI. Once I add some code for the reads there will be some test coverage. --- ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] Indexer: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK: - [ ] REST API:
- Loading branch information
Showing
12 changed files
with
101 additions
and
8 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
crates/sui-indexer/migrations/pg/2024-09-19-011238_raw_checkpoints/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DROP TABLE raw_checkpoints; |
6 changes: 6 additions & 0 deletions
6
crates/sui-indexer/migrations/pg/2024-09-19-011238_raw_checkpoints/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CREATE TABLE raw_checkpoints | ||
( | ||
sequence_number BIGINT PRIMARY KEY, | ||
certified_checkpoint BYTEA NOT NULL, | ||
checkpoint_contents BYTEA NOT NULL | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use crate::schema::raw_checkpoints; | ||
use crate::types::IndexedCheckpoint; | ||
use diesel::prelude::*; | ||
|
||
#[derive(Queryable, Insertable, Selectable, Debug, Clone, Default)] | ||
#[diesel(table_name = raw_checkpoints)] | ||
pub struct StoredRawCheckpoint { | ||
pub sequence_number: i64, | ||
/// BCS serialized CertifiedCheckpointSummary | ||
pub certified_checkpoint: Vec<u8>, | ||
/// BCS serialized CheckpointContents | ||
pub checkpoint_contents: Vec<u8>, | ||
} | ||
|
||
impl From<&IndexedCheckpoint> for StoredRawCheckpoint { | ||
fn from(c: &IndexedCheckpoint) -> Self { | ||
Self { | ||
sequence_number: c.sequence_number as i64, | ||
certified_checkpoint: bcs::to_bytes(c.certified_checkpoint.as_ref().unwrap()).unwrap(), | ||
checkpoint_contents: bcs::to_bytes(c.checkpoint_contents.as_ref().unwrap()).unwrap(), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters