reifydb_catalog/store/sequence/
get.rs

1// Copyright (c) reifydb.com 2025
2// This file is licensed under the AGPL-3.0-or-later, see license.md file
3
4use reifydb_core::{
5	Error,
6	interface::{QueryTransaction, SequenceId},
7};
8use reifydb_type::internal;
9
10use crate::{CatalogStore, store::sequence::Sequence};
11
12impl CatalogStore {
13	pub async fn get_sequence(rx: &mut impl QueryTransaction, sequence_id: SequenceId) -> crate::Result<Sequence> {
14		CatalogStore::find_sequence(rx, sequence_id).await?.ok_or_else(|| {
15			Error(internal!(
16				"Sequence with ID {:?} not found in catalog. This indicates a critical catalog inconsistency.",
17				sequence_id
18			))
19		})
20	}
21}