pub struct OffsetAntichain {
    inner: BTreeMap<PartitionId, MzOffset>,
}
Expand description

OffsetAntichain is similar to a timely Antichain<(PartitionId, T: TotalOrder)>, but additionally:

  • Uses a BTreeMap as the implementation to allow absence of a PartitionId to mean that PartitionId is at T::minimum. This helps avoid needing to hold onto a HUGE Antichain for all possible PartitionIds
    • Note this means that a partition being “finished” (like a normal “empty” Antichain, is not currently supported, but could be added
    • Note that this Antichain can also have been filtered, as in, missing some partitions for which data exists but we don’t care about. This is semantically different than if we just don’t have data, but it is represented the same
  • Is not generic over T, but instead uses MzOffset, which:
    • implements TotalOrder
    • implements checked_sub
  • Allows users to go from a frontier to an actual set of offsets that are connected to real data.
    • This is a consequence of implementation, where the frontier is ALWAYS generated from real data offsets, in an invertible way.

OffsetAntichain has 4 sets of Api’s:

  • “read” apis like get and as_vec
  • “mutation” apis (currently only filter_by_partition)
  • And 2 “write” apis, that should primarily be used separately from each other:
    • “Frontier” apis, which directly manipulate the underlying frontier. Useful for implementing primitives like reclocking
    • “Data” apis, that maintain special invariants:
      • insert_data_up_to updates the frontier based on a given offset that is associated with actual data.
      • as_data_offsets inverts the behavior of insert_data_up_to and returns a BTreeMap<PartitionId, MzOffset> of offets of real committed data.

Fields§

§inner: BTreeMap<PartitionId, MzOffset>

Implementations§

Initialize an Antichain where all partitions have made no progress.

Produce offsets for all partitions in this OffsetAntichain that were at one point given by insert_data_up_to.

If the partition is yet to make any progress, it may be filtered out.

Invariant: After initialization, only insert_data_up_to (not insert and friends) may be used with this OffsetAntichain for this function to produce meaningful values, unless you are very careful.

Insert a new MzOffset frontier value for the pid, returning the old one if it wasn’t there.

Insert a new MzOffset frontier value for pid if it is larger than the previously stored value.

The same as insert, but for many values.

Advance the frontier for PartitionId by diff Initializes the offset for pid if it doesn’t exist.

Returns true iff this OffsetAntichain is <= other. This requires that for all partitions tracked in other, the offset in self is <= or absent.

Creates a new OffsetAntichain that starts out as a copy of self but where each offset is upper bounded by the corresponding offset from other, if there is one.

NOTE: This is not an equivalent of meet, as known from timely Antichain. This operation is asymmetric: we want partitions in the result only if they exist in self, we don’t want partitions in the result that only exist in other. If we did the latter, this could mean that we advance a frontier further than the original self` would have.

Attempt to the the MzOffset value for pid’s frontier

List the contained partitions.

Iterate over the entire frontier.

Iterate over the entire frontier.

Convert the frontier into a vector. Useful for certain old apis in the storage crate.

Scope this OffsetAntichain down to only partitions that pass this filter callback.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more

Implementation that converts from an Antichain to an OffsetAntichain. This translation code is here for compatibility and will be removed once the pipeline is switched to native timestamps throughout.

Native antichains can express a superset of frontiers that the OffsetAntichain can, therefore the conversion here can fail. While it’s non-standard to panic in From implementations this is fine here because it’s just an interim step that will be removed shortly and all uses would have to panic on error anyway.

Converts to this type from the input type.

Implementation that converts from an OffsetAntichain to an Antichain. This translation code is here for compatibility and will be removed once the pipeline is switched to native timestamps throughout.

Converts to this type from the input type.
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Converts to this type from a reference to the input type.
Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Attaches the current Context to this type, returning a WithContext wrapper. Read more
Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Wrap the input message T in a tonic::Request
The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Upcasts this ProgressEventTimestamp to Any. Read more
Returns the name of the concrete type of this object. Read more
Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more