Class MapSnapshot

java.lang.Object
com.loomcache.server.datastructures.MapSnapshot

public class MapSnapshot extends Object
Kryo-serializable snapshot of a DistributedMap.

Fields use ArrayList (pre-registered in KryoSerializer) so only the snapshot class itself plus the user K/V types need registration. User K/V types must already be registered for wire-level serialization, so the snapshot contract is consistent with the wire contract.

  • Field Details

    • CURRENT_SCHEMA_VERSION

      public static final int CURRENT_SCHEMA_VERSION
      See Also:
    • KIND_FULL

      public static final byte KIND_FULL
      See Also:
    • KIND_DELTA

      public static final byte KIND_DELTA
      See Also:
    • KRYO_REGISTRATION_ID

      public static final int KRYO_REGISTRATION_ID
      Kryo registration ID for MapSnapshot. Chosen above the reserved range (10..38) so it never collides with a base registration.
      See Also:
    • schemaVersion

      public int schemaVersion
    • kind

      public byte kind
    • keys

      public ArrayList<Object> keys
    • values

      public ArrayList<@Nullable Object> values
    • ttlValues

      public ArrayList<@Nullable Long> ttlValues
      TTL metadata. Schema v1 stored remaining TTL in nanoseconds. Schema v2 stores absolute expiration epoch millis, so restore after downtime does not extend the entry lifetime.
    • maxIdleDeadlineValues

      public ArrayList<@Nullable Long> maxIdleDeadlineValues
      Max-idle metadata. Schema v3 stores absolute idle-expiration epoch millis plus the idle window in nanoseconds so restore preserves the original deadline instead of granting a fresh idle interval.
    • maxIdleNanosValues

      public ArrayList<@Nullable Long> maxIdleNanosValues
    • writeMetadataTimestampValues

      public ArrayList<@Nullable Long> writeMetadataTimestampValues
      WAN merge/access metadata. Schema v4 stores this in parallel arrays so snapshot restore preserves LatestUpdate/HigherHits/LatestAccess policy inputs across restarts.
    • writeMetadataWriterValues

      public ArrayList<@Nullable String> writeMetadataWriterValues
    • hitCountValues

      public ArrayList<@Nullable Long> hitCountValues
    • lastAccessMillisValues

      public ArrayList<@Nullable Long> lastAccessMillisValues
    • evictionKeys

      public ArrayList<Object> evictionKeys
      Eviction metadata captured in strategy-defined order. For LFU, evictionMetadataValues stores per-key frequency. For RANDOM, evictionSelectionState preserves the deterministic selector state.
    • evictionMetadataValues

      public ArrayList<@Nullable Long> evictionMetadataValues
    • evictionSelectionState

      public @Nullable Long evictionSelectionState
  • Constructor Details

    • MapSnapshot

      public MapSnapshot()
  • Method Details

    • registerWith

      public static void registerWith(KryoSerializer serializer)
      Register MapSnapshot with the given Kryo serializer. Idempotent — safe to call once per KryoSerializer instance, typically at startup.
    • isFullSnapshot

      public boolean isFullSnapshot()
    • isDeltaSnapshot

      public boolean isDeltaSnapshot()
    • serialize

      public static byte[] serialize(MapSnapshot snapshot, String mapName, KryoSerializer serializer)
    • deserialize

      public static MapSnapshot deserialize(byte[] data, String mapName, KryoSerializer serializer)
    • materialize

      public static byte[] materialize(byte @Nullable [] baseData, byte[] updateData, String mapName, KryoSerializer serializer)