10Duke Scale C++ Client
Loading...
Searching...
No Matches
tenduke::se::licensing::SimpleLeases Class Reference

#include <SimpleLeases.h>

Detailed Description

Base implementation of tenduke::se::licensing::MutableLeases.

Inheritance diagram for tenduke::se::licensing::SimpleLeases:
tenduke::se::licensing::MutableLeases tenduke::se::licensing::Leases tenduke::se::licensing::DefaultLeases

Public Member Functions

std::vector<::tenduke::se::licensing::LeasegetAllLeases () override
 Returns all leases in the cache.
 
::tenduke::se::licensing::Lease getLease (const std::string &leaseId) override
 Returns a lease by id.
 
std::vector<::tenduke::se::licensing::LeasegetLeasesForProduct (const std::string &productName) override
 Returns all leases for given product.
 
void addLease (const ::tenduke::se::licensing::Lease &lease) override
 Adds a lease to the cache.
 
void mergeLeases (const std::vector<::tenduke::se::licensing::Lease > &leases) override
 Merges given leases to the cache.
 
void removeAll () override
 Removes all leases from the cache.
 
void removeLease (const ::tenduke::se::licensing::Lease &lease) override
 Removes given lease from the cache.
 
void removeLease (const std::string &leaseId) override
 Removes lease from the cache by lease id.
 

Protected Attributes

std::map< std::string, ::tenduke::se::licensing::Leaseleases
 The leases.
 
std::recursive_mutex concurrencyLock
 Serializes the access to the methods.
 

Member Function Documentation

◆ addLease()

void tenduke::se::licensing::SimpleLeases::addLease ( const ::tenduke::se::licensing::Lease lease)
overridevirtual

Adds a lease to the cache.

Parameters
lease-

Implements tenduke::se::licensing::MutableLeases.

◆ getAllLeases()

std::vector<::Lease > tenduke::se::licensing::SimpleLeases::getAllLeases ( )
overridevirtual

Returns all leases in the cache.

Returns
-

Implements tenduke::se::licensing::Leases.

◆ getLease()

Lease tenduke::se::licensing::SimpleLeases::getLease ( const std::string &  leaseId)
overridevirtual

Returns a lease by id.

Parameters
leaseId
Returns
-
Exceptions
std::out_of_rangeIf no such lease in the cache

Implements tenduke::se::licensing::Leases.

◆ getLeasesForProduct()

std::vector<::Lease > tenduke::se::licensing::SimpleLeases::getLeasesForProduct ( const std::string &  productName)
overridevirtual

Returns all leases for given product.

Parameters
productName-
Returns
-

Implements tenduke::se::licensing::Leases.

◆ mergeLeases()

void tenduke::se::licensing::SimpleLeases::mergeLeases ( const std::vector<::tenduke::se::licensing::Lease > &  leases)
overridevirtual

Merges given leases to the cache.

The merge honors tenduke::se::licensing::Lease.oldLeaseId, if present.

Parameters
leases

Implements tenduke::se::licensing::MutableLeases.

◆ removeAll()

void tenduke::se::licensing::SimpleLeases::removeAll ( )
overridevirtual

Removes all leases from the cache.

Implements tenduke::se::licensing::MutableLeases.

◆ removeLease() [1/2]

void tenduke::se::licensing::SimpleLeases::removeLease ( const ::tenduke::se::licensing::Lease lease)
overridevirtual

Removes given lease from the cache.

IMPORTANT: Uses tenduke::se::licensing::Lease.oldLeaseId if present falling back to tenduke::se::licensing::Lease.leaseId. This is to work transparently with heartbeats.

Parameters
lease-

Implements tenduke::se::licensing::MutableLeases.

◆ removeLease() [2/2]

void tenduke::se::licensing::SimpleLeases::removeLease ( const std::string &  leaseId)
overridevirtual

Removes lease from the cache by lease id.

Parameters
leaseId-

Implements tenduke::se::licensing::MutableLeases.


The documentation for this class was generated from the following files: