Make codec shape authority compile-time and fixed
This commit is contained in:
parent
bfe21dfb3f
commit
54cc167f81
2 changed files with 322 additions and 52 deletions
|
|
@ -8,7 +8,7 @@ use lazaret_core::identity::{GenerationId, SessionId};
|
|||
pub use lazaret_core::records::StateResetScopeV1;
|
||||
use lazaret_core::records::{
|
||||
Domain, DomainStore, DomainStoreMetadata, DurableDecision, Generation, Mailbox, Participant,
|
||||
ParticipantRole, ParticipantState, RecordTransitionError, Session, SessionPhase,
|
||||
ParticipantRole, ParticipantState, RecordTransitionError, SchemaType, Session, SessionPhase,
|
||||
SessionTerminal, SessionTerminalState,
|
||||
};
|
||||
use lazaret_linux::filesystem::ExclusiveFileLock;
|
||||
|
|
@ -40,6 +40,10 @@ pub struct StateResetIntentV1 {
|
|||
scope: StateResetScopeV1,
|
||||
}
|
||||
|
||||
impl SchemaType for StateResetIntentV1 {
|
||||
const NAME: &'static str = "StateResetIntentV1";
|
||||
}
|
||||
|
||||
impl StateResetIntentV1 {
|
||||
#[must_use]
|
||||
pub fn new(domain_id: lazaret_core::identity::DomainId, scope: StateResetScopeV1) -> Self {
|
||||
|
|
|
|||
|
|
@ -319,6 +319,18 @@ fn reset_intent_is_typed_transactional_and_domain_bound() {
|
|||
domain().domain_id,
|
||||
StateResetScopeV1::Selected(b"/usr".to_vec()),
|
||||
);
|
||||
assert_eq!(
|
||||
encode(&intent).unwrap(),
|
||||
[
|
||||
&[
|
||||
22, 108, 97, 122, 97, 114, 101, 116, 45, 115, 116, 97, 116, 101, 45, 114, 101, 115,
|
||||
101, 116, 45, 118, 49,
|
||||
][..],
|
||||
&[1; 32],
|
||||
&[1, 4, 47, 117, 115, 114],
|
||||
]
|
||||
.concat()
|
||||
);
|
||||
|
||||
assert_eq!(store.state_reset_intent().unwrap(), None);
|
||||
store.begin_state_reset(&intent).unwrap();
|
||||
|
|
@ -457,6 +469,10 @@ fn metadata_and_typed_row_validation_fail_closed() {
|
|||
schema_version: u32,
|
||||
}
|
||||
|
||||
impl SchemaType for RawMetadata<'_> {
|
||||
const NAME: &'static str = "test::RawMetadata";
|
||||
}
|
||||
|
||||
let directory = TestDirectory::new("metadata");
|
||||
drop(open_store(&directory));
|
||||
let database = Database::open(directory.path("domain.redb")).unwrap();
|
||||
|
|
|
|||
Loading…
Reference in a new issue