Skip to content

Network Class Loading And Service Packaging

Thomas Cujé edited this page Jan 28, 2017 · 1 revision

The service developer packs the service and all service deps (not the las2peer core or WebConnector) into one "fat"-jar. The manifest file contains "las2peer-service-name" and "las2peer-service-version" as values. This service jar is used to upload the service into the network.

For each file inside the jar a secure hash (currently SHA-512) is generated. The service name, service version and all filenames including their hashes are packed as XML into an envelope with identifier "las2peer-service-package-{service name}-{service version}" and stored in the network. The service version is added to an envelope with id "las2peer-service-versions-{service name}" to get a list of all versions. To provide data integrity without signatures each file is stored in an "HashedArtifact" with the identifier "hashed-{secure hash}". Data integrity checks can be performed calculating the secure hash with the retrieved content. The main benefit is that files which would be uploaded several times, like classes in common used libraries as the apache-commons-io lib, don't have to be uploaded multiple times.

To load a service with given name and optional version the class loader either loads the service-package-envelope directly or reads the service-versions-envelope first to determine the latest version. Then the class loader uses the filename to hash mapping from the service-package-envelope to determine the hashes of class files. Afterwards the actual class can be retrieved using the hash from the mapping.

Features:

  • Max .class file size is 500 kB, same as AbstractArtifact.MAX_SIZE