Skip to main content

BranchContext

Struct BranchContext 

Source
pub struct BranchContext { /* private fields */ }
Expand description

Branch context for data virtualization.

Determines which branch a request targets. When a branch is active, the gateway applies Copy-on-Write semantics:

  • Reads: main rows UNION branch overlay (overlay wins on PK conflict)
  • Writes: inserted/updated rows go to _qail_branch_rows overlay
  • Deletes: a tombstone marker is added to the overlay

Implementations§

Source§

impl BranchContext

Source

pub const MAX_NAME_LEN: usize = 64

Maximum branch name length.

Source

pub fn main() -> Self

Create a context targeting the main branch (no overlay).

Source

pub fn branch(name: &str) -> Self

Create a context targeting a named branch.

§Panics

Panics if the branch name is invalid. Use try_branch for fallible creation.

Source

pub fn try_branch(name: &str) -> Option<Self>

Try to create a branch context, returning None if the name is invalid.

Source

pub fn parse_header(value: Option<&str>) -> Result<Self, String>

Parse an optional branch header value into a BranchContext.

Rules:

  • None, empty string, and main (case-insensitive) map to main.
  • Any other value must pass Self::is_valid_name.
Source

pub fn from_header(value: Option<&str>) -> Result<Self, String>

Create from an optional branch name (None = main).

Source

pub fn is_valid_name(name: &str) -> bool

Validate a branch name.

Rules:

  • 1 to 64 characters
  • Only alphanumeric, hyphens (-), underscores (_), and dots (.)
  • Must not start with . or -
Source

pub fn is_main(&self) -> bool

Returns true if this is the main branch.

Source

pub fn has_branch(&self) -> bool

Returns true if this is a named branch (not main).

Source

pub fn branch_name(&self) -> Option<&str>

Get the branch name, if any.

Trait Implementations§

Source§

impl Clone for BranchContext

Source§

fn clone(&self) -> BranchContext

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BranchContext

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for BranchContext

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for BranchContext

Source§

impl PartialEq for BranchContext

Source§

fn eq(&self, other: &BranchContext) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BranchContext

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ColumnValue<Value> for T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.