Skip to content

Commit

Permalink
refactor(iota-storage): Remove deprecated_get_transaction_checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
jkrvivian committed Oct 30, 2024
1 parent cdec695 commit c0db5b2
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 68 deletions.
9 changes: 0 additions & 9 deletions crates/iota-core/src/authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4980,15 +4980,6 @@ impl TransactionKeyValueStoreTrait for AuthorityState {
Ok((summaries, contents, summaries_by_digest, contents_by_digest))
}

async fn deprecated_get_transaction_checkpoint(
&self,
digest: TransactionDigest,
) -> IotaResult<Option<CheckpointSequenceNumber>> {
self.get_checkpoint_cache()
.deprecated_get_transaction_checkpoint(&digest)
.map(|res| res.map(|(_epoch, checkpoint)| checkpoint))
}

async fn get_object(
&self,
object_id: ObjectID,
Expand Down
5 changes: 0 additions & 5 deletions crates/iota-json-rpc/src/coin_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,11 +466,6 @@ mod tests {
checkpoint_contents_by_digest: &[CheckpointContentsDigest],
) -> IotaResult<KVStoreCheckpointData>;

async fn deprecated_get_transaction_checkpoint(
&self,
digest: TransactionDigest,
) -> IotaResult<Option<CheckpointSequenceNumber>>;

async fn get_object(&self, object_id: ObjectID, version: SequenceNumber) -> IotaResult<Option<Object>>;

async fn multi_get_transaction_checkpoint(
Expand Down
9 changes: 5 additions & 4 deletions crates/iota-json-rpc/src/read_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -788,12 +788,13 @@ impl ReadApiServer for ReadApi {

temp_response.checkpoint_seq = self
.transaction_kv_store
.deprecated_get_transaction_checkpoint(digest)
.multi_get_transaction_checkpoint(&Vec::from([digest]))
.await
.map_err(|e| {
.tap_err(|e| {
error!("Failed to retrieve checkpoint sequence for transaction {digest:?} with error: {e:?}");
Error::from(e)
})?;
})?
.pop()
.unwrap();

if let Some(checkpoint_seq) = &temp_response.checkpoint_seq {
let kv_store = self.transaction_kv_store.clone();
Expand Down
11 changes: 0 additions & 11 deletions crates/iota-storage/src/http_key_value_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,17 +411,6 @@ impl TransactionKeyValueStoreTrait for HttpKVStore {
))
}

#[instrument(level = "trace", skip_all)]
async fn deprecated_get_transaction_checkpoint(
&self,
digest: TransactionDigest,
) -> IotaResult<Option<CheckpointSequenceNumber>> {
let key = Key::TxToCheckpoint(digest);
self.fetch(key).await.map(|maybe| {
maybe.and_then(|bytes| deser::<_, CheckpointSequenceNumber>(&key, bytes.as_ref()))
})
}

#[instrument(level = "trace", skip_all)]
async fn get_object(
&self,
Expand Down
32 changes: 0 additions & 32 deletions crates/iota-storage/src/key_value_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,15 +403,6 @@ impl TransactionKeyValueStore {
})
}

pub async fn deprecated_get_transaction_checkpoint(
&self,
digest: TransactionDigest,
) -> IotaResult<Option<CheckpointSequenceNumber>> {
self.inner
.deprecated_get_transaction_checkpoint(digest)
.await
}

pub async fn get_object(
&self,
object_id: ObjectID,
Expand Down Expand Up @@ -452,11 +443,6 @@ pub trait TransactionKeyValueStoreTrait {
checkpoint_contents_by_digest: &[CheckpointContentsDigest],
) -> IotaResult<KVStoreCheckpointData>;

async fn deprecated_get_transaction_checkpoint(
&self,
digest: TransactionDigest,
) -> IotaResult<Option<CheckpointSequenceNumber>>;

async fn get_object(
&self,
object_id: ObjectID,
Expand Down Expand Up @@ -588,24 +574,6 @@ impl TransactionKeyValueStoreTrait for FallbackTransactionKVStore {
Ok((res.0, res.1, res.2, res.3))
}

#[instrument(level = "trace", skip_all)]
async fn deprecated_get_transaction_checkpoint(
&self,
digest: TransactionDigest,
) -> IotaResult<Option<CheckpointSequenceNumber>> {
let mut res = self
.primary
.deprecated_get_transaction_checkpoint(digest)
.await?;
if res.is_none() {
res = self
.fallback
.deprecated_get_transaction_checkpoint(digest)
.await?;
}
Ok(res)
}

#[instrument(level = "trace", skip_all)]
async fn get_object(
&self,
Expand Down
7 changes: 0 additions & 7 deletions crates/iota-storage/tests/key_value_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,6 @@ impl TransactionKeyValueStoreTrait for MockTxStore {
Ok((summaries, contents, summaries_by_digest, contents_by_digest))
}

async fn deprecated_get_transaction_checkpoint(
&self,
digest: TransactionDigest,
) -> IotaResult<Option<CheckpointSequenceNumber>> {
Ok(self.tx_to_checkpoint.get(&digest).cloned())
}

async fn get_object(
&self,
object_id: ObjectID,
Expand Down

0 comments on commit c0db5b2

Please sign in to comment.