Class SnapshotEntryRegistry

java.lang.Object
com.e1c.g5.v8.fastzip.entry.fs.FsFzipEntryRegistry
com.e1c.g5.v8.internal.snapshot.fastzip.SnapshotEntryRegistry
All Implemented Interfaces:
IFzipEntryRegistry

public final class SnapshotEntryRegistry extends FsFzipEntryRegistry
Snapshot FastZIP entry registry.
  • Constructor Details

    • SnapshotEntryRegistry

      public SnapshotEntryRegistry(Path root, org.eclipse.core.resources.IProject project, ParticipantsRegistry participantsRegistry)
      Constructs a new registry.
      Parameters:
      root - the root directory of metadata files, cannot be null
      project - the project, cannot be null
      participantsRegistry - the snapshot participants registry, cannot be null
  • Method Details

    • getVersion

      public Optional<Integer> getVersion(Stream<IFzipEntry> entries)
      Finds a version entry in a stream of entries and return the version. If the version entry was not found, an empty optional is returned.
      Parameters:
      entries - the stream of FastZIP entries, cannot be null
      Returns:
      the optional version, never null
    • getParticipantFormatVersions

      public Map<String,Integer> getParticipantFormatVersions(Stream<IFzipEntry> entries)
      Finds participant format version entries in a stream of entries and returns a map from participant id to its format version.
      Parameters:
      entries - the stream of FastZIP entries, cannot be null
      Returns:
      map of participant format version, never null
    • createVersionEntryDescriptor

      public IFzipEntry createVersionEntryDescriptor(int version)
      Creates a new version entry.
      Parameters:
      version - the version
      Returns:
      the version entry, never null
    • createParticipantVersionEntryDescriptor

      public IFzipEntry createParticipantVersionEntryDescriptor(String participantId, int version)
      Creates a new participant format version entry.
      Parameters:
      participantId - the participant id, cannot be null
      version - the participant format version
      Returns:
      the participant version entry, never null
    • createParticipantMetadataEntryDescriptor

      public IFzipEntry createParticipantMetadataEntryDescriptor(String participantId, String entryId)
      Creates a new participant metadata entry.
      Parameters:
      participantId - the participant id, cannot be null
      entryId - the entry id, cannot be null
      Returns:
      the participant metadata entry, never null
    • writeEntryDescriptor

      public void writeEntryDescriptor(IFzipEntry entry, DataOutput out) throws IOException
      Description copied from interface: IFzipEntryRegistry
      Serializes an entry to DataOutput.

      The behaviour is unspecified if more than IFzipEntryRegistry.MAX_ENTRY_DESCRIPTOR_LENGTH bytes were written to the output.

      Specified by:
      writeEntryDescriptor in interface IFzipEntryRegistry
      Overrides:
      writeEntryDescriptor in class FsFzipEntryRegistry
      Parameters:
      entry - the entry, never null
      out - the output, never null
      Throws:
      IOException - if an IO error occurs
    • readEntryDescriptor

      public IFzipEntry readEntryDescriptor(Supplier<DataInput> inputSupplier) throws IOException
      Description copied from interface: IFzipEntryRegistry
      Deserializes entry from DataInput.

      The input is provided by a supplier. The supplier may be invoked multiple times. Each invocation will yield an input with the same data.

      The number of bytes read from the last supplied input must be equal to the number of bytes written on serialization. Otherwise the behaviour is unspecified.

      The behaviour is unspecified if more than IFzipEntryRegistry.MAX_ENTRY_DESCRIPTOR_LENGTH bytes were read from the input.

      Specified by:
      readEntryDescriptor in interface IFzipEntryRegistry
      Overrides:
      readEntryDescriptor in class FsFzipEntryRegistry
      Parameters:
      inputSupplier - the input supplier, never null
      Returns:
      the deserialized entry, cannot be null
      Throws:
      IOException - if an IO error occurs or the entry cannot be deserialized