pub struct Rule {
pub match: String,
pub filter: String,
pub convert_enum_to_text: HashMap<String, String>,
pub convert_charset: HashMap<String, CharsetConversion>,
pub source_unique_key_columns: String,
pub target_unique_key_columns: String,
pub source_unique_key_target_columns: String,
pub convert_int_to_enum: HashMap<String, bool>,
}Expand description
Rule represents one rule in a Filter.
Fields§
§match: StringMatch can be a table name or a regular expression. If it starts with a ‘/’, it’s a regular expression. For example, “t” matches a table named “t”, whereas “/t.*” matches all tables that begin with ‘t’.
filter: StringFilter: If empty, all columns and rows of the matching tables are sent. If it’s a keyrange like “-80”, only rows that match the keyrange are sent. If Match is a table name instead of a regular expression, the Filter can also be a select expression like this: “select * from t”, same as an empty Filter, or “select * from t where in_keyrange(‘-80’)”, same as “-80”, or “select col1, col2 from t where in_keyrange(col1, ‘hash’, ‘-80’), or What is allowed in a select expression depends on whether it’s a vstreamer or vreplication request. For more details, please refer to the specific package documentation. On the vreplication side, Filter can also accept a special “exclude” value, which will cause the matched tables to be excluded. TODO(sougou): support this on vstreamer side also.
ConvertEnumToText: optional, list per enum column name, the list of textual values. When reading the binary log, all enum values are numeric. But sometimes it is useful/needed to know what the textual mapping are. Online DDL provides such use case.
convert_enum_to_text: HashMap<String, String>Example: key=“color”, value=“‘red’,‘green’,‘blue’”
convert_charset: HashMap<String, CharsetConversion>ConvertCharset: optional mapping, between column name and a CharsetConversion. This hints to vreplication that columns are encoded from/to non-trivial charsets The map is only populated when either “from” or “to” charset of a column are non-trivial trivial charsets are utf8 and ascii variants.
source_unique_key_columns: StringSourceUniqueKeyColumns represents the ordered columns in the index used by rowstreamer to iterate the table It is comma delimited, as in col1,col2,col3 (tokens are escaped via net/url)
target_unique_key_columns: StringTargetUniqueKeyColumns represents the ordered columns in that index used by vcopier and vplayer to apply rows It is comma delimited, as in col1,col2,col3 (tokens are escaped via net/url)
source_unique_key_target_columns: StringSourceUniqueKeyTargetColumns represents the names of columns in target table, mapped from the chosen unique key on source tables (some columns may be renamed from source to target)
convert_int_to_enum: HashMap<String, bool>ConvertIntToEnum lists any columns that are converted from an integral value into an enum. such columns need to have special transofrmation of the data, from an integral format into a string format. e.g. the value 0 needs to be converted to ‘0’.
Trait Implementations§
Source§impl Message for Rule
impl Message for Rule
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn decode<B>(buf: B) -> Result<Self, DecodeError>
fn decode<B>(buf: B) -> Result<Self, DecodeError>
Source§fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
Source§fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
self. Read moreSource§fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
self.impl StructuralPartialEq for Rule
Auto Trait Implementations§
impl Freeze for Rule
impl RefUnwindSafe for Rule
impl Send for Rule
impl Sync for Rule
impl Unpin for Rule
impl UnwindSafe for Rule
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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