FOSSology
4.4.0
Open Source License Compliance by Open Source Software
|
license_ref table cache functions More...
#include "buckets.h"
Go to the source code of this file.
Functions | |
FUNCTION long | lrcache_hash (cacheroot_t *pcroot, char *rf_shortname) |
Calculate the hash of an rf_shortname rf_shortname is the key. More... | |
FUNCTION void | lrcache_print (cacheroot_t *pcroot) |
Print the contents of the hash table. More... | |
FUNCTION void | lrcache_free (cacheroot_t *pcroot) |
Free the hash table. More... | |
FUNCTION int | lrcache_add (cacheroot_t *pcroot, long rf_pk, char *rf_shortname) |
Add a rf_shortname, rf_pk to the license_ref cache rf_shortname is the key. More... | |
FUNCTION long | lrcache_lookup (cacheroot_t *pcroot, char *rf_shortname) |
Lookup rf_pk in the license_ref cache rf_shortname is the key. More... | |
FUNCTION int | lrcache_init (PGconn *pgConn, cacheroot_t *pcroot) |
Build a cache the license ref db table. More... | |
FUNCTION long | get_rfpk (PGconn *pgConn, cacheroot_t *pcroot, char *rf_shortname) |
Get the rf_pk for rf_shortname. More... | |
FUNCTION long | add2license_ref (PGconn *pgConn, char *licenseName) |
license_ref table cache functions
This cache is an in memory hash table of the license_ref license names and primary keys.
Definition in file liccache.c.
FUNCTION long add2license_ref | ( | PGconn * | pgConn, |
char * | licenseName | ||
) |
Adds a new license to license_ref table
pgConn | Database connection |
licenseName | Name of license to be added |
Definition at line 246 of file liccache.c.
FUNCTION long get_rfpk | ( | PGconn * | pgConn, |
cacheroot_t * | pcroot, | ||
char * | rf_shortname | ||
) |
Get the rf_pk for rf_shortname.
Checks the cache to get the rf_pk for this shortname. If it doesn't exist, add it to both license_ref and the license_ref cache (the hash table).
pgConn | Database connection |
pcroot | Hash table to be looked |
rf_shortname | Short name to search |
Definition at line 213 of file liccache.c.
FUNCTION int lrcache_add | ( | cacheroot_t * | pcroot, |
long | rf_pk, | ||
char * | rf_shortname | ||
) |
Add a rf_shortname, rf_pk to the license_ref cache rf_shortname is the key.
pcroot | Hash table to be modified |
rf_pk | License id to be added |
rf_shortname | License short name to be added |
Definition at line 99 of file liccache.c.
FUNCTION void lrcache_free | ( | cacheroot_t * | pcroot | ) |
Free the hash table.
pcroot | Hash table to be destroyed |
Definition at line 72 of file liccache.c.
FUNCTION long lrcache_hash | ( | cacheroot_t * | pcroot, |
char * | rf_shortname | ||
) |
Calculate the hash of an rf_shortname rf_shortname is the key.
pcroot | Hash table root |
rf_shortname | License short name |
Definition at line 26 of file liccache.c.
FUNCTION int lrcache_init | ( | PGconn * | pgConn, |
cacheroot_t * | pcroot | ||
) |
Build a cache the license ref db table.
[in] | pgConn | Database connection |
[out] | pcroot | Hash table |
lrcache_init builds a cache using the rf_shortname as the key and the rf_pk as the value. This is an optimization. The cache is used for reference license lookups instead of querying the db.
Definition at line 174 of file liccache.c.
FUNCTION long lrcache_lookup | ( | cacheroot_t * | pcroot, |
char * | rf_shortname | ||
) |
Lookup rf_pk in the license_ref cache rf_shortname is the key.
pcroot | Hash table (haystack) |
rf_shortname | Short name to be searched (needle) |
Definition at line 135 of file liccache.c.
FUNCTION void lrcache_print | ( | cacheroot_t * | pcroot | ) |
Print the contents of the hash table.
pcroot | Hash table to be printed |
Definition at line 46 of file liccache.c.