MySQL 8.4.2
Source Code Documentation
Acl_cache Class Reference

#include <sql_auth_cache.h>

Public Member Functions

 Acl_cache ()
 
 ~Acl_cache ()
 
void increase_version ()
 When ever the role graph is modified we must flatten the privileges again. More...
 
Acl_mapcheckout_acl_map (Security_context *sctx, Auth_id_ref &uid, List_of_auth_id_refs &active_roles)
 Returns a pointer to an acl map to the caller and increase the reference count on the object, iff the object version is the same as the global graph version. More...
 
void return_acl_map (Acl_map *map)
 When the security context is done with the acl map it calls the cache to decrease the reference count on that object. More...
 
void flush_cache ()
 Removes all acl map objects with a references count of zero. More...
 
uint64 version ()
 Return a lower boundary to the current version count. More...
 
int32 size ()
 Return a snapshot of the number of items in the cache. More...
 

Private Member Functions

Acl_mapcreate_acl_map (uint64 version, Security_context *sctx)
 Creates a new acl map for the authorization id of the security context. More...
 

Private Attributes

std::atomic< uint64m_role_graph_version
 Role graph version counter. More...
 
Acl_cache_internal m_cache
 
mysql_mutex_t m_cache_flush_mutex
 

Constructor & Destructor Documentation

◆ Acl_cache()

Acl_cache::Acl_cache ( )

◆ ~Acl_cache()

Acl_cache::~Acl_cache ( )

Member Function Documentation

◆ checkout_acl_map()

Acl_map * Acl_cache::checkout_acl_map ( Security_context sctx,
Auth_id_ref uid,
List_of_auth_id_refs active_roles 
)

Returns a pointer to an acl map to the caller and increase the reference count on the object, iff the object version is the same as the global graph version.

If no acl map exists which correspond to the current authorization id of the security context, a new acl map is calculated, inserted into the cache and returned to the user. A new object will also be created if the role graph version counter is different than the acl map object's version.

Parameters
sctxThe target Security_context
uidThe target authid
active_rolesA list of active roles
Returns
A pointer to an Acl_map
Return values
!NULLSuccess
NULLA fatal OOM error happened.

◆ create_acl_map()

Acl_map * Acl_cache::create_acl_map ( uint64  version,
Security_context sctx 
)
private

Creates a new acl map for the authorization id of the security context.

Parameters
versionThe version of the new map
sctxThe associated security context

◆ flush_cache()

void Acl_cache::flush_cache ( )

Removes all acl map objects with a references count of zero.

◆ increase_version()

void Acl_cache::increase_version ( )

When ever the role graph is modified we must flatten the privileges again.

This is done by increasing the role graph version counter. Next time a security context is created for an authorization id (aid) a request is also sent to the acl_cache to checkout a flattened acl_map for this particular aid. If a previous acl_map exists the version of this map is compared to the role graph version. If they don't match a new acl_map is calculated and inserted into the cache.

◆ return_acl_map()

void Acl_cache::return_acl_map ( Acl_map map)

When the security context is done with the acl map it calls the cache to decrease the reference count on that object.

Parameters
mapacl map

◆ size()

int32 Acl_cache::size ( )

Return a snapshot of the number of items in the cache.

◆ version()

uint64 Acl_cache::version ( )

Return a lower boundary to the current version count.

Member Data Documentation

◆ m_cache

Acl_cache_internal Acl_cache::m_cache
private

◆ m_cache_flush_mutex

mysql_mutex_t Acl_cache::m_cache_flush_mutex
private

◆ m_role_graph_version

std::atomic<uint64> Acl_cache::m_role_graph_version
private

Role graph version counter.


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