Skip to main content

SelectedStore

Enum SelectedStore 

Source
pub enum SelectedStore {
    OneTableFourColumns(GitStore<OneTableFourColumns>),
    FourTables(GitStore<FourTables>),
    PackedPayload(GitStore<PackedPayload>),
}
Expand description

A GitStore whose index arm was chosen at run time.

The ObjectIndex arm is a type, so a value can only choose it by naming every monomorphisation. This enum is that list, and it is an enum rather than a Box<dyn GitOps> for two reasons:

  • a boxed trait object can only offer the twelve, and the arms differ in things the twelve deliberately do not expose — how many Arrow bytes the projection actually materialised, which writer is on the ack path. A bench or an operator dump needs those, and a guard needs them to assert that the selector selected on applied output rather than on a label;
  • there is no allocation and no vtable: the match is one predictable branch at the top of a call, and everything under it — the stree probe, the Arrow gather, the redb tail — is the same fully static code GitStore::<S>::open_with_arms produces, because S is known inside each arm.

§What it costs, stated rather than hidden

One branch per GitOps call — not per object. extents(&[1000 oids]) is one branch and a thousand monomorphised lookups behind it. The binary carries three copies of the store, which is the price of picking a type at run time and there is no version of this that does not pay it.

A caller that knows its arm at compile time should not come through here: GitStore::open and GitStore::open_with_arms hand back a concrete store with no branch at all, and that includes every caller that wants the default.

Variants§

§

OneTableFourColumns(GitStore<OneTableFourColumns>)

§

FourTables(GitStore<FourTables>)

§

PackedPayload(GitStore<PackedPayload>)

Implementations§

Source§

impl SelectedStore

Source

pub fn arms(&self) -> StoreConfig

The arms this store was built with.

Source

pub fn writer_name(&self) -> &'static str

The selected writer’s name, as it goes on a bench row.

Source

pub fn writer_durability(&self) -> &'static str

What the selected writer’s append promises.

Source

pub fn index_ipc_bytes(&self) -> usize

Arrow IPC bytes the selected index arm actually materialised.

The applied output that distinguishes one layout from another: a packed 25-byte column, four columns in one section and four independent sections are three different numbers for the same objects. This is what a guard reads to prove the selector selected, because a name would prove only that a name was copied.

Source

pub fn index_name(&self) -> &'static str

The name the built projection reports about itselfOneTableFourColumns, FourTables or PackedPayload.

The other half of the applied-output pair index_ipc_bytes starts: the byte count separates the arms once objects are in the store, and this separates them from the instant it is built, including on an empty store where all three materialise nothing. It is the value crate::arms::IndexArm::projection_name exists to be compared with — what the layout calls itself, never what the selector asked for — so a server logging it is stating what it built rather than repeating its own environment back.

Source

pub fn oids_in_extent(&self, extent: Extent) -> Result<Vec<Vec<u8>>>

The oids a pushed extent introduced — GitStore::oids_in_extent, delegated.

Not one of the twelve (a pack’s extent is a znippy concept), so it does not arrive with the GitOps impl below and has to be forwarded by hand. A server that reports the objects a push introduced needs it, and a server that picked its index arm at run time still needs it.

Source

pub fn object_count(&self) -> usize

Objects in the objects table.

Source

pub fn wait_indexed(&self)

Block until the background drain has absorbed everything pushed.

Source

pub fn rebuild_projection(&self) -> Result<()>

Rebuild the projection, so the layout under test is what answers rather than the redb tail.

Source

pub fn seal(&self) -> Result<Vec<ReservedSection>>

The twelfth method — inherent, not on GitOps, because it returns Arrow ReservedSections a gix backend has no analog for.

Trait Implementations§

Source§

impl GitOps for SelectedStore

Source§

fn put(&self, pack: &[u8], refs: &[RefUpdate]) -> Result<TxId>

One push: pack bytes and ref updates, durable before this returns. Read more
Source§

fn put_pack(&self, bytes: &[u8]) -> Result<TxId>

The pack half of put, on its own.
Source§

fn put_refs(&self, updates: &[RefUpdate]) -> Result<TxId>

The ref half of put, on its own.
Source§

fn get(&self, oid: Oid<'_>) -> Result<Option<Stored>>

The stored bytes of one object.
Source§

fn has(&self, oid: Oid<'_>) -> Result<bool>

Is this object here? The negotiation call, made a thousand at a time.
Source§

fn size(&self, oid: Oid<'_>) -> Result<Option<u64>>

Post-resolution size.
Source§

fn extents(&self, oids: &[Oid<'_>]) -> Result<Vec<Option<Extent>>>

Byte extents, in bulk — the wire path.
Source§

fn refs(&self) -> Result<Vec<RefRow>>

The current ref namespace.
Source§

fn update_ref( &self, name: &str, old: Option<Oid<'_>>, new: Option<Oid<'_>>, ) -> Result<TxId>

Compare-and-swap one ref.
Source§

fn put_refs_cas(&self, edits: &[RefCas<'_>]) -> Result<TxId>

Apply every edit or none. The git push --atomic primitive. Read more
Source§

fn reachable(&self, want: &[Oid<'_>], have: &[Oid<'_>]) -> Result<Vec<Vec<u8>>>

want minus have, the object closure a fetch must send.
Source§

fn gc(&self) -> Result<GcReport>

Reachability, drop the dead index rows, then compact.
Source§

impl GitServe for SelectedStore

The reading contract, delegated the same way GitOps is.

Every method is one predictable branch over a monomorphised body — the same arrangement, and the same cost argument, SelectedStore makes for the eleven. It is here rather than in crate::serve only because the macro that generates it lives in this module.

Source§

fn emit_pack( &self, objects: &[Oid<'_>], have: &[Oid<'_>], caps: &Caps, out: &mut dyn Write, ) -> Result<PackStats>

objects is the exact set to emit, not tips to close over — the contract’s word, and this forwarder uses it so that the name cannot drift back into want one arm at a time. See crate::serve::GitServe::emit_pack.

Source§

fn read(&self, oid: Oid<'_>) -> Result<Option<(ObjType, Vec<u8>)>>

The object, INFLATED and delta-resolved — what GitOps::get deliberately is not. Read more
Source§

fn header(&self, oid: Oid<'_>) -> Result<Option<(ObjType, u64)>>

Kind and post-resolution size without the payload. The type probe. Read more
Source§

fn sizes(&self, oids: &[Oid<'_>]) -> Result<Vec<Option<u64>>>

Bulk post-resolution size. The negotiation path calls it a thousand at a time. Read more
Source§

fn head(&self) -> Result<Option<RefRow>>

HEAD. Read more
Source§

fn set_head(&self, target: &str) -> Result<TxId>

Point HEAD. The other half of the pair; point_head_at is the live consumer.
Source§

fn select(&self, want: &[Oid<'_>], have: &[Oid<'_>]) -> Result<Option<ReachSet>>

Negotiation: want minus have, with the two derived facts a caller cannot recompute cheaply. Read more

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.