ion7-llm / kv.slots

class

ion7.llm.kv.Slots

_ctx ion7.core.Context
_free boolean[] `_free[i]` is true when seq `i` is available.
_reserved table `_reserved[i] == true` for slots the allocator must skip.
_capacity integer Total seqs the context supports.

Functions

Slots.new

Build a slot allocator over `[0, n_seq_max - 1]` of `ctx`.

Slots.new(ctx, opts)
ctxion7.core.Context
optstable?
→ ion7.llm.kv.Slots

Slots:acquire

Claim a free slot. Returns nil when every non-reserved seq is already in use ; the caller decides whether to fail, evict, or queue.

Slots:acquire()
→ integer?

Slots:release

Return a slot to the pool. The KV row is wiped before the slot becomes available again so a stale prefill from the previous tenant cannot leak into the new conversation.

Slots:release(seq_id)
seq_idinteger

Slots:n_free

Number of slots currently free (excludes reserved).

Slots:n_free()
→ integer

Slots:capacity

Total non-reserved capacity (the upper bound on `Pool` concurrency).

Slots:capacity()
→ integer

Slots:is_reserved

True when `seq_id` is in the reserved set (e.g. the prefix slot).

Slots:is_reserved(seq_id)
seq_idinteger
→ boolean