Interface PumpOpGrantManager
- All Known Implementing Classes:
LimitGrantManager
,LockGrantManager
Grant names can be added to pump ops via intents.xml. Grants can have a colon in the name where the string up to the colon is the grant type and the string after the colon is data provided to the corresponding grant manager. This allows grants to include limited data that the manager can operate on. For example, a power based grant manager may look for a power value after the colon.
The base TpourOp and VpourOp classes include a default grant called
limit
. This can be used by the LimitPumpOpGrantManager
to restrict how many pumps can be run per board or per device.
Managers are called sequentially with the entire list of grants that the pump op requires. The manager must examine all grants and process those that it cares about. A manager must lock the resources associated with the grants if indicating that the grant was acquired. If any manager fails to acquire a grant, all previously successful acquisitions will be released. All requests for grants will be serialized. This ensures there will be no deadlocks, eliminates the need for complex transactional logic with distributed grants, and ensures that grant managers don't need to be reentrant.
- Since:
- 1.0
- Version:
- 2024-07-24
-
Method Summary
Modifier and TypeMethodDescriptionboolean
acquireGrants
(PumpOp op) Acquire the specified grants for the specified pump op.void
releaseGrants
(PumpOp op) Called to release any grants acquired by the specified pump op.
-
Method Details
-
acquireGrants
Acquire the specified grants for the specified pump op. If the grants can be acquired, any associated resources should be locked until released by callingreleaseGrants()
with the same pump op. Each registered manager will be called and if any one fails, all acquired grants up to that point will be released by a call toreleaseGrants()
. All calls are serialized so grant managers need not worry about concurrency or global deadlocks. If this manager does not manage any of the specified grants, it should still return true to indicate that no grants have been denied.- Parameters:
op
- the pump operation containing the grants- Returns:
- false if the grants could not be acquired
-
releaseGrants
Called to release any grants acquired by the specified pump op.- Parameters:
op
- the op used to acquire grants
-