Skip to content

Commit

Permalink
Restored dynamic OnDiskKeySerializer/OnDiskValueSerializer class regi…
Browse files Browse the repository at this point in the history
…stration

Signed-off-by: Artem Ananev <[email protected]>
  • Loading branch information
artemananiev committed Dec 19, 2024
1 parent 7a8e450 commit 839d0b4
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
import com.swirlds.common.utility.NonCryptographicHashing;
import com.swirlds.logging.legacy.LogMarker;
import com.swirlds.state.merkle.disk.OnDiskKey;
import com.swirlds.state.merkle.disk.OnDiskKeySerializer;
import com.swirlds.state.merkle.disk.OnDiskValue;
import com.swirlds.state.merkle.disk.OnDiskValueSerializer;
import com.swirlds.state.merkle.memory.InMemoryValue;
import com.swirlds.state.merkle.memory.InMemoryWritableKVState;
import com.swirlds.state.merkle.queue.QueueNode;
Expand Down Expand Up @@ -286,14 +288,34 @@ public static void registerWithSystem(
md.inMemoryValueClassId(),
md.stateDefinition().keyCodec(),
md.stateDefinition().valueCodec())));
// FUTURE WORK: remove OnDiskKey registration, once there are no objects of this clas
// in existing state snapshots
constructableRegistry.registerConstructable(new ClassConstructorPair(
OnDiskKey.class,
() -> new OnDiskKey<>(
md.onDiskKeyClassId(), md.stateDefinition().keyCodec())));
// FUTURE WORK: remove OnDiskKeySerilalizer registration, once there are no objects of this clas
// in existing state snapshots
constructableRegistry.registerConstructable(new ClassConstructorPair(
OnDiskKeySerializer.class,
() -> new OnDiskKeySerializer<>(
md.onDiskKeySerializerClassId(),
md.onDiskKeyClassId(),
md.stateDefinition().keyCodec())));
// FUTURE WORK: remove OnDiskValue registration, once there are no objects of this clas
// in existing state snapshots
constructableRegistry.registerConstructable(new ClassConstructorPair(
OnDiskValue.class,
() -> new OnDiskValue<>(
md.onDiskValueClassId(), md.stateDefinition().valueCodec())));
// FUTURE WORK: remove OnDiskValueSerializer registration, once there are no objects of this clas
// in existing state snapshots
constructableRegistry.registerConstructable(new ClassConstructorPair(
OnDiskValueSerializer.class,
() -> new OnDiskValueSerializer<>(
md.onDiskValueSerializerClassId(),
md.onDiskValueClassId(),
md.stateDefinition().valueCodec())));
constructableRegistry.registerConstructable(new ClassConstructorPair(
SingletonNode.class,
() -> new SingletonNode<>(
Expand Down

0 comments on commit 839d0b4

Please sign in to comment.