APRGlobalStorage Struct Reference

A datatype to manage all of the ServiceJobs on a Grassroots system running on Apache httpd. More...

#include <apr_global_storage.h>

Public Member Functions

bool InitAPRGlobalStorage (APRGlobalStorage *storage_p, apr_pool_t *pool_p, apr_hashfunc_t hash_fn, unsigned char *(*make_key_fn)(const void *data_p, uint32 raw_key_length, uint32 *key_len_p), void(*free_key_and_value_fn)(unsigned char *key_p, void *value_p), server_rec *server_p, const char *mutex_filename_s, const char *cache_id_s, const char *provider_name_s, unsigned char *(*compress_fn)(unsigned char *src_s, unsigned int src_length, unsigned int *dest_length_p, const char *const key_s), unsigned char *(*decompress_fn)(unsigned char *src_s, unsigned int src_length, unsigned int *dest_length_p, const char *const key_s))
 Initialise an APRGlobalStorage. More...
 
APRGlobalStorageAllocateAPRGlobalStorage (apr_pool_t *pool_p, apr_hashfunc_t hash_fn, unsigned char *(*make_key_fn)(const void *data_p, uint32 raw_key_length, uint32 *key_len_p), void(*free_key_and_value_fn)(unsigned char *key_p, void *value_p), server_rec *server_p, const char *mutex_filename_s, const char *cache_id_s, const char *provider_name_s, unsigned char *(*compress_fn)(unsigned char *src_s, unsigned int src_length, unsigned int *dest_length_p, const char *const key_s), unsigned char *(*decompress_fn)(unsigned char *src_s, unsigned int src_length, unsigned int *dest_length_p, const char *const key_s))
 Allocate an APRGlobalStorage. More...
 
apr_status_t FreeAPRGlobalStorage (void *data_p)
 Free an APRGlobalStorage. More...
 
void DestroyAPRGlobalStorage (APRGlobalStorage *storage_p)
 Free an APRGlobalStorage. More...
 
bool AddObjectToAPRGlobalStorage (APRGlobalStorage *storage_p, const void *raw_key_p, unsigned int raw_key_length, unsigned char *value_p, unsigned int value_length)
 Add an object to an APRGlobalStorage. More...
 
void * GetObjectFromAPRGlobalStorage (APRGlobalStorage *storage_p, const void *raw_key_p, unsigned int raw_key_length)
 Get an object from an APRGlobalStorage. More...
 
void * RemoveObjectFromAPRGlobalStorage (APRGlobalStorage *storage_p, const void *raw_key_p, unsigned int raw_key_length)
 Remove an object from an APRGlobalStorage. More...
 
bool IterateOverAPRGlobalStorage (APRGlobalStorage *storage_p, ap_socache_iterator_t *iterator_p, void *data_p)
 Iterate over the data stored within an APRGlobalStorage. More...
 
bool InitAPRGlobalStorageForChild (APRGlobalStorage *storage_p, apr_pool_t *pool_p)
 Initialise an APRGlobalStorage for usage in an Apache child process. More...
 
bool PreConfigureGlobalStorage (APRGlobalStorage *storage_p, apr_pool_t *config_pool_p)
 Set up an APRGlobalStorage prior to the configuration details being used. More...
 
bool PostConfigureGlobalStorage (APRGlobalStorage *storage_p, apr_pool_t *config_pool_p, server_rec *server_p, const char *provider_name_s, struct ap_socache_hints *cache_hints_p)
 Configure an APRGlobalStorage in the Apache parent process before any child processes are launched. More...
 
void PrintAPRGlobalStorage (APRGlobalStorage *storage_p)
 Print the contents of an APRGlobalStorage object to the log OUtputStream. More...
 

Detailed Description

A datatype to manage all of the ServiceJobs on a Grassroots system running on Apache httpd.

This datatype uses the Apache httpd shared object module functionality to store data that will be needed for longer than a single request.

Member Function Documentation

◆ InitAPRGlobalStorage()

bool InitAPRGlobalStorage ( APRGlobalStorage storage_p,
apr_pool_t *  pool_p,
apr_hashfunc_t  hash_fn,
unsigned char *(*)(const void *data_p, uint32 raw_key_length, uint32 *key_len_p)  make_key_fn,
void(*)(unsigned char *key_p, void *value_p)  free_key_and_value_fn,
server_rec *  server_p,
const char *  mutex_filename_s,
const char *  cache_id_s,
const char *  provider_name_s,
unsigned char *(*)(unsigned char *src_s, unsigned int src_length, unsigned int *dest_length_p, const char *const key_s)  compress_fn,
unsigned char *(*)(unsigned char *src_s, unsigned int src_length, unsigned int *dest_length_p, const char *const key_s)  decompress_fn 
)

Initialise an APRGlobalStorage.

Parameters
storage_pThe APRGlobalStorage to initialise.
pool_pThe memory pool used for any allocations.
hash_fnThe callback function used to determine the slot in the underlying shared object cache. to put or get any items.
make_key_fnThe callback function used to create the key that will be used by the hash function.
free_key_and_value_fnThe callback function used to free an entry in the underlying shared object cache.
server_pThe server_rec that will own the APRGlobalStorage.
mutex_filename_sThe filename used to store the mutex variable governing access to the APRGlobalStorage.
cache_id_sThe id used to identify this APRGlobalStorage.
provider_name_sThe name of the shared object cache provider to use.
compress_fnThe callback function to use for compressing data in the given APRGlobalStorage. This can be NULL in which case the data will be stored uncompressed.
decompress_fnThe callback function to use for decompressing data in the given APRGlobalStorage. This can be NULL in which case the data will be retrieved as is.
Returns
true if the initialisation was successful or false if there was a problem.

◆ AllocateAPRGlobalStorage()

APRGlobalStorage * AllocateAPRGlobalStorage ( apr_pool_t *  pool_p,
apr_hashfunc_t  hash_fn,
unsigned char *(*)(const void *data_p, uint32 raw_key_length, uint32 *key_len_p)  make_key_fn,
void(*)(unsigned char *key_p, void *value_p)  free_key_and_value_fn,
server_rec *  server_p,
const char *  mutex_filename_s,
const char *  cache_id_s,
const char *  provider_name_s,
unsigned char *(*)(unsigned char *src_s, unsigned int src_length, unsigned int *dest_length_p, const char *const key_s)  compress_fn,
unsigned char *(*)(unsigned char *src_s, unsigned int src_length, unsigned int *dest_length_p, const char *const key_s)  decompress_fn 
)

Allocate an APRGlobalStorage.

Parameters
pool_pThe memory pool used for any allocations.
hash_fnThe callback function used to determine the slot in the underlying shared object cache. to put or get any items.
make_key_fnThe callback function used to create the key that will be used by the hash function.
free_key_and_value_fnThe callback function used to free an entry in the underlying shared object cache.
server_pThe server_rec that will own the APRGlobalStorage.
mutex_filename_sThe filename used to store the mutex variable governing access to the APRGlobalStorage.
cache_id_sThe id used to identify this APRGlobalStorage.
provider_name_sThe name of the shared object cache provider to use.
compress_fnThe callback function to use for compressing data in the given APRGlobalStorage. This can be NULL in which case the data will be stored uncompressed.
decompress_fnThe callback function to use for decompressing data in the given APRGlobalStorage. This can be NULL in which case the data will be retrieved as is.
Returns
The newly-allocated APRGlobalStorage or NULL upon error.
See also
InitAPRGlobalStorage.
FreeAPRGlobalStorage.

◆ FreeAPRGlobalStorage()

apr_status_t FreeAPRGlobalStorage ( void *  data_p)

Free an APRGlobalStorage.

This will simply call DestroyAPRGlobalStorage and exists to match the function signature required for those that can be triggered at APR memory pool cleanup.

Parameters
data_pThe APRGlobalStorage that will get freed.
Returns
APR_OK upon success, any other code signifies an error.
See also
DestroyAPRGlobalStorage.

◆ DestroyAPRGlobalStorage()

void DestroyAPRGlobalStorage ( APRGlobalStorage storage_p)

Free an APRGlobalStorage.

Parameters
storage_pThe APRGlobalStorage to free.

◆ AddObjectToAPRGlobalStorage()

bool AddObjectToAPRGlobalStorage ( APRGlobalStorage storage_p,
const void *  raw_key_p,
unsigned int  raw_key_length,
unsigned char *  value_p,
unsigned int  value_length 
)

Add an object to an APRGlobalStorage.

Parameters
storage_pThe APRGlobalStorage to search in.
raw_key_pThe raw key for the object that is being searched for.
raw_key_lengthThe size in bytes of the raw key.
value_pThe value to copy to store in the APRGlobalStorage. It wll be mapped to the given key.
value_lengthThe size in bytes of the value.
Returns
The matched value or NULL if the key is not in the APRGlobalStorage.

◆ GetObjectFromAPRGlobalStorage()

void * GetObjectFromAPRGlobalStorage ( APRGlobalStorage storage_p,
const void *  raw_key_p,
unsigned int  raw_key_length 
)

Get an object from an APRGlobalStorage.

Parameters
storage_pThe APRGlobalStorage to search in.
raw_key_pThe raw key for the object that is being searched for.
raw_key_lengthThe size in bytes of the raw key.
Returns
The matched value or NULL if the key is not in the APRGlobalStorage.

◆ RemoveObjectFromAPRGlobalStorage()

void * RemoveObjectFromAPRGlobalStorage ( APRGlobalStorage storage_p,
const void *  raw_key_p,
unsigned int  raw_key_length 
)

Remove an object from an APRGlobalStorage.

Parameters
storage_pThe APRGlobalStorage to search in.
raw_key_pThe raw key for the object that is being searched for.
raw_key_lengthThe size in bytes of the raw key.
Returns
The matched value or NULL if the key is not in the APRGlobalStorage. If found, the value will be removed from the APRGlobalStorage.

◆ IterateOverAPRGlobalStorage()

bool IterateOverAPRGlobalStorage ( APRGlobalStorage storage_p,
ap_socache_iterator_t *  iterator_p,
void *  data_p 
)

Iterate over the data stored within an APRGlobalStorage.

Parameters
storage_pThe APRGlobalStorage to iterate over.
iterator_pThe iterator to use.
data_pAn opitional custom data pointer that the iterator might want to use. This can be NULL.
Returns
true if the iteration was successful or false if there was a problem.

◆ InitAPRGlobalStorageForChild()

bool InitAPRGlobalStorageForChild ( APRGlobalStorage storage_p,
apr_pool_t *  pool_p 
)

Initialise an APRGlobalStorage for usage in an Apache child process.

Parameters
storage_pThe APRGlobalStorage to initialise.
pool_pA memory pool to use if needed.
Returns
true if the initialisation was successful or false if there was a problem.

◆ PreConfigureGlobalStorage()

bool PreConfigureGlobalStorage ( APRGlobalStorage storage_p,
apr_pool_t *  config_pool_p 
)

Set up an APRGlobalStorage prior to the configuration details being used.

Parameters
storage_pThe APRGlobalStorage to initialise.
config_pool_pA memory pool to use if needed.
Returns
true if the initialisation was successful or false if there was a problem.

◆ PostConfigureGlobalStorage()

bool PostConfigureGlobalStorage ( APRGlobalStorage storage_p,
apr_pool_t *  config_pool_p,
server_rec *  server_p,
const char *  provider_name_s,
struct ap_socache_hints *  cache_hints_p 
)

Configure an APRGlobalStorage in the Apache parent process before any child processes are launched.

Parameters
storage_pThe APRGlobalStorage to configure.
config_pool_pThe memory pool available to use.
server_pThe Apache server structure.
provider_name_sThe name of sharded object cache provider to use.
cache_hints_pA set of hints which may be used when initialising the shared object cache. Providers may ignore some or all of these hints.
Returns
true if successful or false if there was a problem.

◆ PrintAPRGlobalStorage()

void PrintAPRGlobalStorage ( APRGlobalStorage storage_p)

Print the contents of an APRGlobalStorage object to the log OUtputStream.

Parameters
storage_pThe APRGlobalStorage to print.

The documentation for this struct was generated from the following file: