|
10Duke Scale C++ SDK
|
#include <Leases.h>
A read-only lease-cache service.
This is a memory-based cache for leases of checked out licenses. The licensing client stores all leases to a cache, which removes the need for the application developer to do bookkeeping for checked out leases.
This read-only interface allows the application developer to check then contents of the cache.
To operate on the leases (release or heartbeat), use the licensing client.
Note that the lease-cache is a local understanding of what is currently checked out. For example, a leases released by a system administrator from another machine would not be synced to the lease cache.
Public Member Functions | |
| virtual std::vector<::tenduke::se::licensing::Lease > | getAllLeases ()=0 |
| Returns all leases in the cache. | |
| virtual std::vector<::tenduke::se::licensing::Lease > | getLeasesDueForHeartbeat ()=0 |
| Returns the leases that are due for heartbeat. | |
| virtual std::int64_t | getNextHeartbeatDueEpochS ()=0 |
| Returns the time when the next lease becomes due for heartbeat. | |
| virtual std::vector<::tenduke::se::licensing::Lease > | getLeasesForProduct (const std::string &productName)=0 |
| Returns all leases for given product. | |
| virtual::tenduke::se::licensing::Lease | getLease (const std::string &leaseId)=0 |
| Returns a lease by id. | |
| virtual bool | isEmpty ()=0 |
| Returns true if the cache is empty. | |
| virtual std::size_t | size ()=0 |
| Returns how many leases the cache contains. | |
Static Public Attributes | |
| static const std::int64_t | NO_HEARTBEAT_DUE_EPOCH_S_MAGIC = INT64_MAX |
| Magic value returned by getNextHeartbeatDueEpochS() when no lease can be heartbeat. | |
|
pure virtual |
Returns all leases in the cache.
|
pure virtual |
Returns a lease by id.
| leaseId |
| std::out_of_range | If no such lease in the cache |
|
pure virtual |
Returns the leases that are due for heartbeat.
A lease is due for heartbeat when the current time is within the heartbeat window of the lease: The lease has not expired (see tenduke::se::licensing::Lease::expiresEpochS) and the earliest allowed heartbeat time (see tenduke::se::licensing::Lease::heartbeatNotBeforeEpochS) has been reached. A lease without the earliest allowed heartbeat time is always due.
Note that the licensing client applies a small tolerance for clock-skew when it checks the leases, so the client may accept a lease slightly before this method reports it as due.
|
pure virtual |
Returns all leases for given product.
| productName | - |
|
pure virtual |
Returns the time when the next lease becomes due for heartbeat.
This is the earliest tenduke::se::licensing::Lease::heartbeatNotBeforeEpochS of the leases that have not expired. The value is in the past, if the cache has leases that are due for heartbeat right now. For a lease without the earliest allowed heartbeat time, the current time is used.
Use this to schedule the next heartbeat: Wait until the returned time and then heartbeat the leases.
|
pure virtual |
Returns true if the cache is empty.
|
pure virtual |
Returns how many leases the cache contains.