Kea
1.9.9-git
|
Resource race avoidance RAII handler. More...
#include <resource_handler.h>
Public Member Functions | |
ResourceHandler () | |
Constructor. More... | |
virtual | ~ResourceHandler () |
Destructor. More... | |
bool | isLocked (Lease::Type type, const asiolink::IOAddress &addr) |
Checks if a resource is owned by this handler. More... | |
bool | tryLock (Lease::Type type, const asiolink::IOAddress &addr) |
Tries to acquires a resource. More... | |
void | unLock (Lease::Type type, const asiolink::IOAddress &addr) |
Releases a resource. More... | |
Resource race avoidance RAII handler.
Definition at line 27 of file resource_handler.h.
isc::dhcp::ResourceHandler::ResourceHandler | ( | ) |
Constructor.
Definition at line 23 of file resource_handler.cc.
|
virtual |
bool isc::dhcp::ResourceHandler::isLocked | ( | Lease::Type | type, |
const asiolink::IOAddress & | addr | ||
) |
Checks if a resource is owned by this handler.
type | Type of the resource, member of Lease::Type enum. |
addr | The address or prefix aka the resource. |
Definition at line 77 of file resource_handler.cc.
References isc::asiolink::IOAddress::toBytes().
Referenced by isc::dhcp::ResourceHandler4::isLocked4().
bool isc::dhcp::ResourceHandler::tryLock | ( | Lease::Type | type, |
const asiolink::IOAddress & | addr | ||
) |
Tries to acquires a resource.
Lookup the resource, if not found insert the resource in the resource container and return true, if found return false
type | Type of the resource, member of Lease::Type enum. |
addr | The address or prefix aka the resource. |
Definition at line 64 of file resource_handler.cc.
Referenced by isc::lease_cmds::LeaseCmdsImpl::lease6BulkApplyHandler(), isc::lease_cmds::LeaseCmdsImpl::lease6UpdateHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseAddHandler(), and isc::dhcp::ResourceHandler4::tryLock4().
void isc::dhcp::ResourceHandler::unLock | ( | Lease::Type | type, |
const asiolink::IOAddress & | addr | ||
) |
Releases a resource.
Remove the resource from the resource container.
type | Type of the resource, member of Lease::Type enum. |
addr | The address or prefix aka the resource. |
when | we do not own the resource. |
Definition at line 85 of file resource_handler.cc.
References isc_throw, isc::asiolink::IOAddress::toBytes(), isc::asiolink::IOAddress::toText(), and isc::dhcp::Lease::typeToText().
Referenced by isc::dhcp::ResourceHandler4::unLock4().