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_ETYPEFields 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.voidwriteEntryDescriptor(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 benullproject- the project, cannot benullparticipantsRegistry- 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 benullversion- the participant format version- Returns:
- the participant version entry, never
null
-
createParticipantMetadataEntryDescriptor
Creates a new participant metadata entry.- Parameters:
participantId- the participant id, cannot benullentryId- the entry id, cannot benull- Returns:
- the participant metadata entry, never
null
-
writeEntryDescriptor
Description copied from interface:IFzipEntryRegistrySerializes an entry toDataOutput.The behaviour is unspecified if more than
IFzipEntryRegistry.MAX_ENTRY_DESCRIPTOR_LENGTHbytes were written to the output.- Specified by:
writeEntryDescriptorin interfaceIFzipEntryRegistry- Overrides:
writeEntryDescriptorin classFsFzipEntryRegistry- Parameters:
entry- the entry, nevernullout- the output, nevernull- Throws:
IOException- if an IO error occurs
-
readEntryDescriptor
Description copied from interface:IFzipEntryRegistryDeserializes 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_LENGTHbytes were read from the input.- Specified by:
readEntryDescriptorin interfaceIFzipEntryRegistry- Overrides:
readEntryDescriptorin 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
-