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
Snapshot FastZIP entry registry.
-
Field Summary
Fields inherited from class com.e1c.g5.v8.fastzip.entry.fs.FsFzipEntryRegistry
LAST_RESERVED_ETYPE
Fields inherited from interface com.e1c.g5.v8.fastzip.entry.IFzipEntryRegistry
MAX_ENTRY_DESCRIPTOR_LENGTH
-
Constructor Summary
ConstructorsConstructorDescriptionSnapshotEntryRegistry
(Path root, org.eclipse.core.resources.IProject project, ParticipantsRegistry participantsRegistry) Constructs a new registry. -
Method Summary
Modifier and TypeMethodDescriptioncreateParticipantMetadataEntryDescriptor
(String participantId, String entryId) Creates a new participant metadata entry.createParticipantVersionEntryDescriptor
(String participantId, int version) Creates a new participant format version entry.createVersionEntryDescriptor
(int version) Creates a new version entry.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.getVersion
(Stream<IFzipEntry> entries) Finds a version entry in a stream of entries and return the version.readEntryDescriptor
(Supplier<DataInput> inputSupplier) Deserializes entry fromDataInput
.void
writeEntryDescriptor
(IFzipEntry entry, DataOutput out) Serializes an entry toDataOutput
.Methods inherited from class com.e1c.g5.v8.fastzip.entry.fs.FsFzipEntryRegistry
createEntryDescriptor, getPaths, getRoot
-
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 benull
project
- the project, cannot benull
participantsRegistry
- the snapshot participants registry, cannot benull
-
-
Method Details
-
getVersion
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 benull
- Returns:
- the optional version, never
null
-
getParticipantFormatVersions
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 benull
- Returns:
- map of participant format version, never
null
-
createVersionEntryDescriptor
Creates a new version entry.- Parameters:
version
- the version- Returns:
- the version entry, never
null
-
createParticipantVersionEntryDescriptor
Creates a new participant format version entry.- Parameters:
participantId
- the participant id, cannot benull
version
- the participant format version- Returns:
- the participant version entry, never
null
-
createParticipantMetadataEntryDescriptor
Creates a new participant metadata entry.- Parameters:
participantId
- the participant id, cannot benull
entryId
- the entry id, cannot benull
- Returns:
- the participant metadata entry, never
null
-
writeEntryDescriptor
Description copied from interface:IFzipEntryRegistry
Serializes an entry toDataOutput
.The behaviour is unspecified if more than
IFzipEntryRegistry.MAX_ENTRY_DESCRIPTOR_LENGTH
bytes were written to the output.- Specified by:
writeEntryDescriptor
in interfaceIFzipEntryRegistry
- Overrides:
writeEntryDescriptor
in classFsFzipEntryRegistry
- Parameters:
entry
- the entry, nevernull
out
- the output, nevernull
- Throws:
IOException
- if an IO error occurs
-
readEntryDescriptor
Description copied from interface:IFzipEntryRegistry
Deserializes entry fromDataInput
.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 interfaceIFzipEntryRegistry
- Overrides:
readEntryDescriptor
in classFsFzipEntryRegistry
- Parameters:
inputSupplier
- the input supplier, nevernull
- Returns:
- the deserialized entry, cannot be
null
- Throws:
IOException
- if an IO error occurs or the entry cannot be deserialized
-