File Registry {#guide-fileregistry}


User Documentation
@endWRENCHDoc @WRENCHDeveloperDoc
Developer Documentation
@endWRENCHDoc @WRENCHInternalDoc
Internal Documentation

Overview # {#guide-fileregistry-overview}

A file registry service is a simple store of key-value pairs where keys are files (i.e., wrench::WorkflowFile) and values are Storage Services (i.e., wrench::StorageService). It is used to keep track of the location of file copies. In real-world deployments, this service is often called a "replica catalog".

Creating a file registry service # {#guide-fileregistry-creating}

In WRENCH, a file registry service is defined by the wrench::FileRegistryService class, an instantiation of which requires the following parameters:

The example below shows how to create an instance that runs on host "ReplicaCatalog". The service's properties are customized to specify that it takes 0.1 (simulated) seconds for the service to lookup an entry in its database.

auto fr_service = simulation->add(
          new wrench::FileRegistryService("ReplicaCatalog",
                                       {{wrench::FileRegistryService::LOOKUP_COMPUTE_COST, "0.1"}},

File registry service properties {#guide-fileregistry-creating-properties}

The properties that can be configured for a file registry service include:


Using a file registry service # {#guide-fileregistry-using}

Adding/removing an entry to a file registry service is done as follows:

wrench::WorkflowFile *some_file;
wrench::StorageService *some_storage_service;


fr_service->addEntry(some_file, some_storage_service);
fr_service->removeEntry(some_file, some_storage_service);

Retrieving all entries for a given file is done as follows:

wrench::WorkflowFile *some_file;


std::set<wrench::StorageService *> entries;
entries = fr_service->lookupEntry(some_file);

If a network proximity service is running, it is possible to retrieve entries for a file sorted by non-decreasing proximity from some reference host. Returned entries are stored in a (sorted) std::map where the keys are network distances to the reference host. For instance:

wrench::WorkflowFile *some_file;
wrench::NetworkProximityService *np_service;

std::map<double, wrench::StorageService *> entries;
entries = fr_service->lookupEntry(some_file, "ReferenceHost", np_service);