Skip to main content

VnodeCountCompat

Trait VnodeCountCompat 

Source
pub trait VnodeCountCompat {
    // Required method
    fn vnode_count_inner(&self) -> VnodeCount;

    // Provided method
    fn vnode_count(&self) -> usize { ... }
}
Expand description

A trait for accessing the vnode count field with backward compatibility.

§maybe_?

The reason why there’s a maybe_ prefix on the protobuf field is that, a getter method with the same name as the field will be generated for prost structs. Directly naming it vnode_count will lead to the method vnode_count() returning 0 when the field is unset, which can be misleading sometimes.

Instead, we name the field as maybe_vnode_count and provide the method vnode_count through this trait, ensuring that backward compatibility is handled properly.

Required Methods§

Source

fn vnode_count_inner(&self) -> VnodeCount

Get the maybe_vnode_count field.

Provided Methods§

Source

fn vnode_count(&self) -> usize

Returns the vnode count if it’s set. Otherwise, returns VirtualNode::COUNT_FOR_COMPAT for distributed tables/fragments, and 1 for singleton tables/fragments, for backward compatibility. Panics if the field is a placeholder.

See the documentation on the field of the implementing type for more details.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl VnodeCountCompat for StorageTableDesc

Source§

impl VnodeCountCompat for Table

Implementors§