3). Monitor Service Loop is Created to React to New Lease Won Events
Within the run function of provider/manifest/service.go an endless for loop monitors for events placed onto a channel. When a event is received for the RPC node event bus of type LeaseWon the handleLease method is called.
The handleLease method determines if a manager is active for the deployment via the ensureManager method. The manifest manager logic exists in provider/manifest/manager.go and handles the validation/application of the manifest when received from the tenant send manifest operation.
New Manifest Manager instance is initiated by calling the newManager function in provider/manifest/manager.go with the service type and deployment ID (DSEQ) passed in as arguments.
The newManager function calls the run method - passing in the manager struct that includes the leasech channel - which invokes a perpetual for loop to await events on various channels.
The manifest manager instance is returned to the handleLease method in service.go.
The handleLease method in service.go continues and calls another handleLease method in manager.go passing in lease events received on the bus.
The handleLease method in manager.go puts the event onto the leasech channel.
When the manifest manager run method receives an event on the leasech channel the maybeFetchData method is called and results is placed onto the runch channel.
The maybeFetchData method attempts to fetch deployment and lease data with associated downstream logic.
5). Receipt of Manifest from Tenant Send to Provider
A method of name Submit is included in provider/manifest/service.go which accepts incoming manifest sends from the deployer/tenant to the provider. The function is initiated via an incoming HTTP post detailed subsequently.
The Submit method is called when a HTTP post - which contains the Akash manifest in the body - is received on an endpoint and handler written/registered in provider/gateway/rest/router.go.
HTTP Endpoint
Request Handler
Note the call of the Submit method which is the provider/manifest/service.go function shown prior. The Deployment ID and manifest are sent to Submit as received in the HTTP post from the tenant’s send manifest action following lease creation with a provider.