#[repr(transparent)]pub struct VirtualNode(u16);
Expand description
VirtualNode
(a.k.a. Vnode) is a minimal partition that a set of keys belong to. It is used for
consistent hashing.
Tuple Fields§
§0: u16
Implementations§
source§impl VirtualNode
impl VirtualNode
sourcepub const COUNT_FOR_COMPAT: usize = 256usize
pub const COUNT_FOR_COMPAT: usize = 256usize
The total count of virtual nodes, for compatibility purposes ONLY.
Typical use cases:
- As the default value for the session configuration.
- As the vnode count for all streaming jobs, fragments, and tables that were created before the variable vnode count support was introduced.
- As the vnode count for singletons.
source§impl VirtualNode
impl VirtualNode
sourcepub const COUNT_FOR_TEST: usize = 256usize
pub const COUNT_FOR_TEST: usize = 256usize
The total count of virtual nodes, for testing purposes.
sourcepub const MAX_FOR_TEST: VirtualNode = _
pub const MAX_FOR_TEST: VirtualNode = _
The maximum value of the virtual node, for testing purposes.
source§impl VirtualNode
impl VirtualNode
sourcepub const MAX_COUNT: usize = 32_768usize
pub const MAX_COUNT: usize = 32_768usize
The maximum count of virtual nodes that fits in VirtualNodeInner
.
Note that the most significant bit is not used. This is because we use signed integers (i16
)
for the scalar representation, where overflow can be confusing in terms of ordering.
sourcepub const MAX_REPRESENTABLE: VirtualNode = _
pub const MAX_REPRESENTABLE: VirtualNode = _
The maximum value of the virtual node that can be represented.
Note that this is NOT the maximum value of the virtual node, which depends on the configuration.
source§impl VirtualNode
impl VirtualNode
sourcepub const RW_TYPE: DataType = DataType::Int16
pub const RW_TYPE: DataType = DataType::Int16
We may use VirtualNode
as a datum in a stream, or store it as a column.
Hence this reifies it as a RW datatype.
sourcepub const ZERO: VirtualNode = _
pub const ZERO: VirtualNode = _
The minimum (zero) value of the virtual node.
sourcepub const fn from_index(index: usize) -> Self
pub const fn from_index(index: usize) -> Self
Creates a virtual node from the usize
index.
sourcepub const fn from_scalar(scalar: i16) -> Self
pub const fn from_scalar(scalar: i16) -> Self
Creates a virtual node from the given scalar representation. Used by VNODE
expression.
pub fn from_datum(datum: DatumRef<'_>) -> Self
sourcepub const fn to_scalar(self) -> i16
pub const fn to_scalar(self) -> i16
Returns the scalar representation of the virtual node. Used by VNODE
expression.
pub const fn to_datum(self) -> Datum
sourcepub const fn from_be_bytes(bytes: [u8; 2]) -> Self
pub const fn from_be_bytes(bytes: [u8; 2]) -> Self
Creates a virtual node from the given big-endian bytes representation.
sourcepub const fn to_be_bytes(self) -> [u8; 2]
pub const fn to_be_bytes(self) -> [u8; 2]
Returns the big-endian bytes representation of the virtual node.
sourcepub fn all(vnode_count: usize) -> AllVirtualNodeIter
pub fn all(vnode_count: usize) -> AllVirtualNodeIter
Iterates over all virtual nodes.
source§impl VirtualNode
impl VirtualNode
pub fn compute_chunk( data_chunk: &DataChunk, keys: &[usize], vnode_count: usize, ) -> Vec<VirtualNode>
sourcepub fn compute_chunk_for_test(
data_chunk: &DataChunk,
keys: &[usize],
) -> Vec<VirtualNode>
pub fn compute_chunk_for_test( data_chunk: &DataChunk, keys: &[usize], ) -> Vec<VirtualNode>
Equivalent to Self::compute_chunk
with VirtualNode::COUNT_FOR_TEST
as the vnode count.
pub fn compute_row( row: impl Row, indices: &[usize], vnode_count: usize, ) -> VirtualNode
sourcepub fn compute_row_for_test(row: impl Row, indices: &[usize]) -> VirtualNode
pub fn compute_row_for_test(row: impl Row, indices: &[usize]) -> VirtualNode
Equivalent to Self::compute_row
with VirtualNode::COUNT_FOR_TEST
as the vnode count.
Trait Implementations§
source§impl Clone for VirtualNode
impl Clone for VirtualNode
source§fn clone(&self) -> VirtualNode
fn clone(&self) -> VirtualNode
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for VirtualNode
impl Debug for VirtualNode
source§impl Display for VirtualNode
impl Display for VirtualNode
source§impl Hash for VirtualNode
impl Hash for VirtualNode
source§impl<T: VnodeMappingItem> Index<VirtualNode> for VnodeMapping<T>
impl<T: VnodeMappingItem> Index<VirtualNode> for VnodeMapping<T>
source§impl Ord for VirtualNode
impl Ord for VirtualNode
source§fn cmp(&self, other: &VirtualNode) -> Ordering
fn cmp(&self, other: &VirtualNode) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for VirtualNode
impl PartialEq for VirtualNode
source§impl PartialOrd for VirtualNode
impl PartialOrd for VirtualNode
impl Copy for VirtualNode
impl Eq for VirtualNode
impl !From<HashCode<Crc32FastBuilder>> for VirtualNode
vnode_count
must be provided to convert a hash code to a virtual node.
Use Crc32HashCodeToVnodeExt::to_vnode
instead.
impl StructuralPartialEq for VirtualNode
Auto Trait Implementations§
impl Freeze for VirtualNode
impl RefUnwindSafe for VirtualNode
impl Send for VirtualNode
impl Sync for VirtualNode
impl Unpin for VirtualNode
impl UnwindSafe for VirtualNode
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§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> 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> 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
§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
source§impl<M> MetricVecRelabelExt for M
impl<M> MetricVecRelabelExt for M
source§fn relabel(
self,
metric_level: MetricLevel,
relabel_threshold: MetricLevel,
) -> RelabeledMetricVec<M>
fn relabel( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>
RelabeledMetricVec::with_metric_level
.source§fn relabel_n(
self,
metric_level: MetricLevel,
relabel_threshold: MetricLevel,
relabel_num: usize,
) -> RelabeledMetricVec<M>
fn relabel_n( self, metric_level: MetricLevel, relabel_threshold: MetricLevel, relabel_num: usize, ) -> RelabeledMetricVec<M>
RelabeledMetricVec::with_metric_level_relabel_n
.source§fn relabel_debug_1(
self,
relabel_threshold: MetricLevel,
) -> RelabeledMetricVec<M>
fn relabel_debug_1( self, relabel_threshold: MetricLevel, ) -> RelabeledMetricVec<M>
RelabeledMetricVec::with_metric_level_relabel_n
with metric_level
set to
MetricLevel::Debug
and relabel_num
set to 1.