Legend:
Library
Module
Module type
Parameter
Class
Class type
Generic resource fetching/requesting service.
This module defines a generic resource fetching service Requester. It is parameterized by abstract services Disk, Request, Memory_table and Probe.
It offers a key/value store interface. Values are looked up successively in Memory_table.t, then in Disk.store. If not found, they are *requested* using the Request service. Ultimately, values are *cached* in the Memory_table for faster retrieval on subsequent queries. This is similar to a *read-through* cache except that values are never evicted from the Memory_table.
Internally, the service schedules requests to an abstract external source (e.g. network) for missing keys. The key is then *pending* and the caller waits for the value to be available.
When a value is missing, the requester sends a request via Request.send to query a value to the network. The requester must be *notified* by an external component when the requested value is available using Requester.notify.
Notified values are validated before being inserted in the requester, using the Probe module.
The full resource fetching service is realized by the conjunction of two components. The requester component, defined by this library, and a notifying component (for instance, a worker thread waiting for network messages).
The requester offers two interfaces. FULL_REQUESTER is the full view, which includes the creation, shutdown, and notification functions. It is to be used by the controller setting up the service, and the notifying component. REQUESTER is the restricted view, exported to the service final user.