pub struct TableMetadataManager {
table_name_manager: TableNameManager,
table_info_manager: TableInfoManager,
view_info_manager: ViewInfoManager,
datanode_table_manager: DatanodeTableManager,
catalog_manager: CatalogManager,
schema_manager: SchemaManager,
table_route_manager: TableRouteManager,
tombstone_manager: TombstoneManager,
kv_backend: KvBackendRef,
}
Fields§
§table_name_manager: TableNameManager
§table_info_manager: TableInfoManager
§view_info_manager: ViewInfoManager
§datanode_table_manager: DatanodeTableManager
§catalog_manager: CatalogManager
§schema_manager: SchemaManager
§table_route_manager: TableRouteManager
§tombstone_manager: TombstoneManager
§kv_backend: KvBackendRef
Implementations§
source§impl TableMetadataManager
impl TableMetadataManager
pub fn new(kv_backend: KvBackendRef) -> Self
pub async fn init(&self) -> Result<()>
pub fn table_name_manager(&self) -> &TableNameManager
pub fn table_info_manager(&self) -> &TableInfoManager
pub fn view_info_manager(&self) -> &ViewInfoManager
pub fn datanode_table_manager(&self) -> &DatanodeTableManager
pub fn catalog_manager(&self) -> &CatalogManager
pub fn schema_manager(&self) -> &SchemaManager
pub fn table_route_manager(&self) -> &TableRouteManager
pub fn kv_backend(&self) -> &KvBackendRef
pub async fn get_full_table_info( &self, table_id: TableId, ) -> Result<(Option<DeserializedValueWithBytes<TableInfoValue>>, Option<DeserializedValueWithBytes<TableRouteValue>>)>
sourcepub async fn create_view_metadata(
&self,
view_info: RawTableInfo,
raw_logical_plan: Vec<u8>,
table_names: HashSet<TableName>,
columns: Vec<String>,
plan_columns: Vec<String>,
definition: String,
) -> Result<()>
pub async fn create_view_metadata( &self, view_info: RawTableInfo, raw_logical_plan: Vec<u8>, table_names: HashSet<TableName>, columns: Vec<String>, plan_columns: Vec<String>, definition: String, ) -> Result<()>
Creates metadata for view and returns an error if different metadata exists.
The caller MUST ensure it has the exclusive access to TableNameKey
.
Parameters include:
view_info
: the encoded logical plantable_names
: the resolved fully table names in logical plancolumns
: the view columnsplan_columns
: the original plan columnsdefinition
: The SQL to create the view
sourcepub async fn create_table_metadata(
&self,
table_info: RawTableInfo,
table_route_value: TableRouteValue,
region_wal_options: HashMap<RegionNumber, String>,
) -> Result<()>
pub async fn create_table_metadata( &self, table_info: RawTableInfo, table_route_value: TableRouteValue, region_wal_options: HashMap<RegionNumber, String>, ) -> Result<()>
Creates metadata for table and returns an error if different metadata exists.
The caller MUST ensure it has the exclusive access to TableNameKey
.
pub fn create_logical_tables_metadata_chunk_size(&self) -> usize
sourcepub async fn create_logical_tables_metadata(
&self,
tables_data: Vec<(RawTableInfo, TableRouteValue)>,
) -> Result<()>
pub async fn create_logical_tables_metadata( &self, tables_data: Vec<(RawTableInfo, TableRouteValue)>, ) -> Result<()>
Creates metadata for multiple logical tables and return an error if different metadata exists.
fn table_metadata_keys( &self, table_id: TableId, table_name: &TableName, table_route_value: &TableRouteValue, ) -> Result<Vec<Vec<u8>>>
sourcepub async fn delete_table_metadata(
&self,
table_id: TableId,
table_name: &TableName,
table_route_value: &TableRouteValue,
) -> Result<()>
pub async fn delete_table_metadata( &self, table_id: TableId, table_name: &TableName, table_route_value: &TableRouteValue, ) -> Result<()>
Deletes metadata for table logically.
The caller MUST ensure it has the exclusive access to TableNameKey
.
sourcepub async fn delete_table_metadata_tombstone(
&self,
table_id: TableId,
table_name: &TableName,
table_route_value: &TableRouteValue,
) -> Result<()>
pub async fn delete_table_metadata_tombstone( &self, table_id: TableId, table_name: &TableName, table_route_value: &TableRouteValue, ) -> Result<()>
Deletes metadata tombstone for table permanently.
The caller MUST ensure it has the exclusive access to TableNameKey
.
sourcepub async fn restore_table_metadata(
&self,
table_id: TableId,
table_name: &TableName,
table_route_value: &TableRouteValue,
) -> Result<()>
pub async fn restore_table_metadata( &self, table_id: TableId, table_name: &TableName, table_route_value: &TableRouteValue, ) -> Result<()>
Restores metadata for table.
The caller MUST ensure it has the exclusive access to TableNameKey
.
sourcepub async fn destroy_table_metadata(
&self,
table_id: TableId,
table_name: &TableName,
table_route_value: &TableRouteValue,
) -> Result<()>
pub async fn destroy_table_metadata( &self, table_id: TableId, table_name: &TableName, table_route_value: &TableRouteValue, ) -> Result<()>
Deletes metadata for table permanently.
The caller MUST ensure it has the exclusive access to TableNameKey
.
fn view_info_keys( &self, view_id: TableId, view_name: &TableName, ) -> Result<Vec<Vec<u8>>>
sourcepub async fn destroy_view_info(
&self,
view_id: TableId,
view_name: &TableName,
) -> Result<()>
pub async fn destroy_view_info( &self, view_id: TableId, view_name: &TableName, ) -> Result<()>
Deletes metadata for view permanently.
The caller MUST ensure it has the exclusive access to ViewNameKey
.
sourcepub async fn rename_table(
&self,
current_table_info_value: &DeserializedValueWithBytes<TableInfoValue>,
new_table_name: String,
) -> Result<()>
pub async fn rename_table( &self, current_table_info_value: &DeserializedValueWithBytes<TableInfoValue>, new_table_name: String, ) -> Result<()>
Renames the table name and returns an error if different metadata exists.
The caller MUST ensure it has the exclusive access to old and new TableNameKey
s,
and the new TableNameKey
MUST be empty.
sourcepub async fn update_table_info(
&self,
current_table_info_value: &DeserializedValueWithBytes<TableInfoValue>,
region_distribution: Option<RegionDistribution>,
new_table_info: RawTableInfo,
) -> Result<()>
pub async fn update_table_info( &self, current_table_info_value: &DeserializedValueWithBytes<TableInfoValue>, region_distribution: Option<RegionDistribution>, new_table_info: RawTableInfo, ) -> Result<()>
Updates table info and returns an error if different metadata exists. And cascade-ly update all redundant table options for each region if region_distribution is present.
sourcepub async fn update_view_info(
&self,
view_id: TableId,
current_view_info_value: &DeserializedValueWithBytes<ViewInfoValue>,
new_view_info: Vec<u8>,
table_names: HashSet<TableName>,
columns: Vec<String>,
plan_columns: Vec<String>,
definition: String,
) -> Result<()>
pub async fn update_view_info( &self, view_id: TableId, current_view_info_value: &DeserializedValueWithBytes<ViewInfoValue>, new_view_info: Vec<u8>, table_names: HashSet<TableName>, columns: Vec<String>, plan_columns: Vec<String>, definition: String, ) -> Result<()>
Updates view info and returns an error if different metadata exists. Parameters include:
view_id
: the view idcurrent_view_info_value
: the current view info for CAS checkingnew_view_info
: the encoded logical plantable_names
: the resolved fully table names in logical plancolumns
: the view columnsplan_columns
: the original plan columnsdefinition
: The SQL to create the view
pub fn batch_update_table_info_value_chunk_size(&self) -> usize
pub async fn batch_update_table_info_values( &self, table_info_value_pairs: Vec<(DeserializedValueWithBytes<TableInfoValue>, RawTableInfo)>, ) -> Result<()>
pub async fn update_table_route( &self, table_id: TableId, region_info: RegionInfo, current_table_route_value: &DeserializedValueWithBytes<TableRouteValue>, new_region_routes: Vec<RegionRoute>, new_region_options: &HashMap<String, String>, new_region_wal_options: &HashMap<RegionNumber, String>, ) -> Result<()>
sourcepub async fn update_leader_region_status<F>(
&self,
table_id: TableId,
current_table_route_value: &DeserializedValueWithBytes<TableRouteValue>,
next_region_route_status: F,
) -> Result<()>
pub async fn update_leader_region_status<F>( &self, table_id: TableId, current_table_route_value: &DeserializedValueWithBytes<TableRouteValue>, next_region_route_status: F, ) -> Result<()>
Updates the leader status of the RegionRoute.
Auto Trait Implementations§
impl Freeze for TableMetadataManager
impl !RefUnwindSafe for TableMetadataManager
impl Send for TableMetadataManager
impl Sync for TableMetadataManager
impl Unpin for TableMetadataManager
impl !UnwindSafe for TableMetadataManager
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Conv for T
impl<T> Conv for T
§impl<T, V> Convert<T> for Vwhere
V: Into<T>,
impl<T, V> Convert<T> for Vwhere
V: Into<T>,
fn convert(value: Self) -> T
fn convert_box(value: Box<Self>) -> Box<T>
fn convert_vec(value: Vec<Self>) -> Vec<T>
fn convert_vec_box(value: Vec<Box<Self>>) -> Vec<Box<T>>
fn convert_matrix(value: Vec<Vec<Self>>) -> Vec<Vec<T>>
fn convert_option(value: Option<Self>) -> Option<T>
fn convert_option_box(value: Option<Box<Self>>) -> Option<Box<T>>
fn convert_option_vec(value: Option<Vec<Self>>) -> Option<Vec<T>>
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.