Bucket agent initialization and lookup functions.
More...
#include "buckets.h"
Go to the source code of this file.
|
FUNCTION int | getBucketpool_pk (PGconn *pgConn, char *bucketpool_name) |
| Get a bucketpool_pk based on the bucketpool_name. More...
|
|
FUNCTION pbucketdef_t | initBuckets (PGconn *pgConn, int bucketpool_pk, cacheroot_t *pcroot) |
| Initialize the bucket definition list. If an error occured, write the error to stdout. More...
|
|
FUNCTION int * | getMatchOnly (PGconn *pgConn, int bucketpool_pk, char *filename, cacheroot_t *pcroot) |
| Read the match only file (bucket type 2) More...
|
|
FUNCTION int ** | getMatchEvery (PGconn *pgConn, int bucketpool_pk, char *filename, cacheroot_t *pcroot) |
| Read the match every file filename, for bucket type 1. More...
|
|
FUNCTION regex_file_t * | getRegexFile (PGconn *pgConn, int bucketpool_pk, char *filename, cacheroot_t *pcroot) |
| Parse filename, for bucket type 5 REGEX-FILE Lines are in format: More...
|
|
FUNCTION int | getRegexFiletype (char *token, char *filepath) |
| Given a filetype token from REGEX-FILE return the token int representation. More...
|
|
FUNCTION int * | getLicsInStr (PGconn *pgConn, char *nameStr, cacheroot_t *pcroot) |
| Given a string with | separated license names return an integer array of rf_pk's. More...
|
|
FUNCTION int | LatestNomosAgent (PGconn *pgConn, int upload_pk) |
| Get the latest nomos agent_pk that has data for this this uploadtree. More...
|
|
FUNCTION int | childParent (PGconn *pgConn, int uploadtree_pk) |
| Given an uploadtree_pk of a container, find the uploadtree_pk of it's children (i.e. scan down through artifacts to get the children's parent. More...
|
|
Bucket agent initialization and lookup functions.
Definition in file inits.c.
◆ childParent()
FUNCTION int childParent |
( |
PGconn * |
pgConn, |
|
|
int |
uploadtree_pk |
|
) |
| |
Given an uploadtree_pk of a container, find the uploadtree_pk of it's children (i.e. scan down through artifacts to get the children's parent.
- Parameters
-
pgConn | Database connection object |
uploadtree_pk | Upload tree id for container |
- Returns
- uploadtree_pk of children's parent.
Or 0 if there are no children (empty container or non-container)
- Note
- This function writes error to stdout
Definition at line 639 of file inits.c.
◆ getBucketpool_pk()
FUNCTION int getBucketpool_pk |
( |
PGconn * |
pgConn, |
|
|
char * |
bucketpool_name |
|
) |
| |
Get a bucketpool_pk based on the bucketpool_name.
- Parameters
-
pgConn | Database connection object |
bucketpool_name | Bucket pool name |
- Returns
- active bucketpool_pk or 0 if error
Definition at line 23 of file inits.c.
◆ getLicsInStr()
FUNCTION int* getLicsInStr |
( |
PGconn * |
pgConn, |
|
|
char * |
nameStr, |
|
|
cacheroot_t * |
pcroot |
|
) |
| |
Given a string with | separated license names return an integer array of rf_pk's.
- Parameters
-
pgConn | Database connection object |
nameStr | String of lic names eg "bsd | gpl" |
pcroot | License cache |
- Returns
- an array of rf_pk's that match the names in nameStr
- Note
- If nameStr contains a license name that is not in the license_ref file, then 0 is returned since there is no way to match all the listed licenses.
Definition at line 529 of file inits.c.
◆ getMatchEvery()
FUNCTION int** getMatchEvery |
( |
PGconn * |
pgConn, |
|
|
int |
bucketpool_pk, |
|
|
char * |
filename, |
|
|
cacheroot_t * |
pcroot |
|
) |
| |
Read the match every file filename, for bucket type 1.
- Parameters
-
pgConn | Database connection object |
bucketpool_pk | Bucket pool id |
filename | File name to match against |
pcroot | License cache |
- Returns
- an array of arrays of rf_pk's that define a match_every combination or 0 if error.
Definition at line 269 of file inits.c.
◆ getMatchOnly()
FUNCTION int* getMatchOnly |
( |
PGconn * |
pgConn, |
|
|
int |
bucketpool_pk, |
|
|
char * |
filename, |
|
|
cacheroot_t * |
pcroot |
|
) |
| |
Read the match only file (bucket type 2)
- Parameters
-
pgConn | Database connection object |
bucketpool_pk | Bucket pool id |
filename | File name of match_only file |
pcroot | Look up cache root |
- Returns
- an array of rf_pk's that match the licenses in filename or 0 if error.
Definition at line 185 of file inits.c.
◆ getRegexFile()
Parse filename, for bucket type 5 REGEX-FILE Lines are in format:
{regex1} {op} {ftype2} {regex2}
ftype is either "license" or "filename"
op is either "and" (1) or "or" (2) or "not" (3)
The op clause is optional.
For example:
license (GPL_?v3|Affero_v3) and filename .*mypkg
- Parameters
-
pgConn | Database connection object |
bucketpool_pk | Bucket pool id |
filename | Filename to be parsed |
pcroot | License cache |
- Returns
- an array of arrays of regex_file_t's that represent the rows in filename.
or 0 if error.
Definition at line 360 of file inits.c.
◆ getRegexFiletype()
FUNCTION int getRegexFiletype |
( |
char * |
token, |
|
|
char * |
filepath |
|
) |
| |
Given a filetype token from REGEX-FILE return the token int representation.
- Parameters
-
token | Token to convert |
filepath | Path of REGEX-FILE data file. used for error reporting only. |
- Returns
- 1=filename, 2=license
Definition at line 504 of file inits.c.
◆ initBuckets()
Initialize the bucket definition list. If an error occured, write the error to stdout.
- Parameters
-
pgConn | Database connection object |
bucketpool_pk | Bucket pool id |
pcroot | License cache root |
- Returns
- an array of bucket definitions (in eval order) or 0 if error.
Definition at line 52 of file inits.c.
◆ LatestNomosAgent()
FUNCTION int LatestNomosAgent |
( |
PGconn * |
pgConn, |
|
|
int |
upload_pk |
|
) |
| |
Get the latest nomos agent_pk that has data for this this uploadtree.
- Parameters
-
pgConn | Database connection object |
upload_pk | Upload id |
- Returns
- nomos_agent_pk of the latest version of the nomos agent that has data for this upload.
Or 0 if there is no license data available
- Note
- This function writes error to stdout
Definition at line 603 of file inits.c.
◆ debug
Print debug messages
Definition at line 57 of file buckets.c.