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
matchis one predictable branch at the top of a call, and everything under it — thestreeprobe, the Arrow gather, the redb tail — is the same fully static codeGitStore::<S>::open_with_armsproduces, becauseSis 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
impl SelectedStore
Sourcepub fn arms(&self) -> StoreConfig
pub fn arms(&self) -> StoreConfig
The arms this store was built with.
Sourcepub fn writer_name(&self) -> &'static str
pub fn writer_name(&self) -> &'static str
The selected writer’s name, as it goes on a bench row.
Sourcepub fn writer_durability(&self) -> &'static str
pub fn writer_durability(&self) -> &'static str
What the selected writer’s append promises.
Sourcepub fn index_ipc_bytes(&self) -> usize
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.
Sourcepub fn index_name(&self) -> &'static str
pub fn index_name(&self) -> &'static str
The name the built projection reports about itself —
OneTableFourColumns, 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.
Sourcepub fn oids_in_extent(&self, extent: Extent) -> Result<Vec<Vec<u8>>>
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.
Sourcepub fn object_count(&self) -> usize
pub fn object_count(&self) -> usize
Objects in the objects table.
Sourcepub fn wait_indexed(&self)
pub fn wait_indexed(&self)
Block until the background drain has absorbed everything pushed.
Sourcepub fn rebuild_projection(&self) -> Result<()>
pub fn rebuild_projection(&self) -> Result<()>
Rebuild the projection, so the layout under test is what answers rather than the redb tail.
Trait Implementations§
Source§impl GitOps for SelectedStore
impl GitOps for SelectedStore
Source§fn put(&self, pack: &[u8], refs: &[RefUpdate]) -> Result<TxId>
fn put(&self, pack: &[u8], refs: &[RefUpdate]) -> Result<TxId>
Source§fn has(&self, oid: Oid<'_>) -> Result<bool>
fn has(&self, oid: Oid<'_>) -> Result<bool>
Source§fn extents(&self, oids: &[Oid<'_>]) -> Result<Vec<Option<Extent>>>
fn extents(&self, oids: &[Oid<'_>]) -> Result<Vec<Option<Extent>>>
Source§fn update_ref(
&self,
name: &str,
old: Option<Oid<'_>>,
new: Option<Oid<'_>>,
) -> Result<TxId>
fn update_ref( &self, name: &str, old: Option<Oid<'_>>, new: Option<Oid<'_>>, ) -> Result<TxId>
Source§fn put_refs_cas(&self, edits: &[RefCas<'_>]) -> Result<TxId>
fn put_refs_cas(&self, edits: &[RefCas<'_>]) -> Result<TxId>
git push --atomic primitive. Read moreSource§impl GitServe for SelectedStore
The reading contract, delegated the same way GitOps is.
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>
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>)>>
fn read(&self, oid: Oid<'_>) -> Result<Option<(ObjType, Vec<u8>)>>
GitOps::get
deliberately is not. Read more