The StateMachine trait in d-engine-core is the protocol-layer abstraction that Raft consensus depends on. Over time a few application-level methods have accumulated in the trait that Raft itself never calls. This makes it harder for external implementors to provide their own state machine, because they are forced to implement concepts (TTL cleanup, prefix scan, collection size) that have nothing to do with consensus.
Methods proposed for removal from the trait:
scan_prefix — application-level query, not needed by the Raft loop. Should live on the concrete server-layer types or behind a separate optional trait.
lease_background_cleanup — TTL expiry is a business concern. The default no-op implementation hints that this does not belong in the protocol contract.
len / is_empty — observability/debug helpers, not consensus requirements.
Out of scope for this ticket:
get stays for now — the current lease-read path in the Raft loop calls it directly. Once the ReadActor fast path (tracked separately) is complete, get can be revisited.
Impact:
External state machine implementors will have a smaller, cleaner surface to implement. No behaviour change for existing built-in implementations — the methods move, they do not disappear.
The
StateMachinetrait ind-engine-coreis the protocol-layer abstraction that Raft consensus depends on. Over time a few application-level methods have accumulated in the trait that Raft itself never calls. This makes it harder for external implementors to provide their own state machine, because they are forced to implement concepts (TTL cleanup, prefix scan, collection size) that have nothing to do with consensus.Methods proposed for removal from the trait:
scan_prefix— application-level query, not needed by the Raft loop. Should live on the concrete server-layer types or behind a separate optional trait.lease_background_cleanup— TTL expiry is a business concern. The default no-op implementation hints that this does not belong in the protocol contract.len/is_empty— observability/debug helpers, not consensus requirements.Out of scope for this ticket:
getstays for now — the current lease-read path in the Raft loop calls it directly. Once the ReadActor fast path (tracked separately) is complete,getcan be revisited.Impact:
External state machine implementors will have a smaller, cleaner surface to implement. No behaviour change for existing built-in implementations — the methods move, they do not disappear.