FOSSology  4.4.0
Open Source License Compliance by Open Source Software
process.c File Reference

Functions to process a single file and process an upload. More...

#include "maintagent.h"
Include dependency graph for process.c:

Go to the source code of this file.

Functions

PGresult * PQexecCheck (int exitNumber, char *SQL, char *file, const int line)
 simple wrapper which includes PQexec and fo_checkPQcommand More...
 
FUNCTION void PQexecCheckClear (int exitNumber, char *SQL, char *file, const int line)
 Execute SQL query and create the result and clear the result. More...
 
FUNCTION void vacAnalyze ()
 Do database vacuum and analyze. More...
 
FUNCTION void validateFolders ()
 Validate folder and foldercontents tables. More...
 
FUNCTION void verifyFilePerms (int fix)
 Verify and optionally fix file permissions. More...
 
FUNCTION void removeUploads ()
 Remove Uploads with no pfiles. More...
 
FUNCTION void removeTemps ()
 Remove orphaned temp tables from deprecated pkgmettagetta and old delagent. More...
 
FUNCTION void processExpired ()
 Process expired uploads (slow) More...
 
FUNCTION void removeOrphanedFiles ()
 Remove orphaned files from the repository (slow) Loop through each file in the repository and make sure there is a pfile table entry. Then make sure the pfile_pk is used by uploadtree. More...
 
FUNCTION void deleteOrphanGold ()
 Delete orphaned gold files from the repository. More...
 
FUNCTION void normalizeUploadPriorities ()
 Normalize priority of Uploads. More...
 
FUNCTION void reIndexAllTables ()
 reindex of all indexes in fossology database More...
 
FUNCTION void removeOrphanedRows ()
 remove orphaned rows from fossology database More...
 
FUNCTION void removeOrphanedLogFiles ()
 
FUNCTION void removeExpiredTokens (long int retentionPeriod)
 remove expired personal access tokens from fossology database More...
 
FUNCTION void deleteOldGold (char *date)
 Delete gold files which are older than specified date. More...
 
FUNCTION void removeOldLogFiles (const char *olderThan)
 

Variables

PGconn * pgConn = NULL
 the connection to Database More...
 
fo_dbManagerdbManager
 fo_dbManager object
 

Detailed Description

Functions to process a single file and process an upload.

Definition in file process.c.

Function Documentation

◆ deleteOldGold()

FUNCTION void deleteOldGold ( char *  date)

Delete gold files which are older than specified date.

List all pfiles which are older than given date and are not used by other upload. Delete all such pfiles from the repository.

Returns
void but writes status to stdout

Definition at line 581 of file process.c.

◆ deleteOrphanGold()

FUNCTION void deleteOrphanGold ( )

Delete orphaned gold files from the repository.

Loop through each gold file in the repository and make sure there is a pfile entry in the upload table.

Returns
void but writes status to stdout

< Path to fossology repository

< Path to gold directory

Definition at line 281 of file process.c.

◆ normalizeUploadPriorities()

FUNCTION void normalizeUploadPriorities ( )

Normalize priority of Uploads.

Returns
void but writes status to stdout

Definition at line 313 of file process.c.

◆ PQexecCheck()

PGresult* PQexecCheck ( int  exitNumber,
char *  SQL,
char *  file,
const int  line 
)

simple wrapper which includes PQexec and fo_checkPQcommand

Parameters
exitNumberexit number
SQLSQL command executed
filesource file name
linesource line number
Returns
PQexec query result

Definition at line 26 of file process.c.

◆ PQexecCheckClear()

FUNCTION void PQexecCheckClear ( int  exitNumber,
char *  SQL,
char *  file,
const int  line 
)

Execute SQL query and create the result and clear the result.

See also
PQexecCheck()

Definition at line 42 of file process.c.

◆ processExpired()

FUNCTION void processExpired ( )

Process expired uploads (slow)

Returns
void but writes status to stdout
Todo:
Process expired uploads is not implemented yet

Definition at line 221 of file process.c.

◆ reIndexAllTables()

FUNCTION void reIndexAllTables ( )

reindex of all indexes in fossology database

Returns
void but writes status to stdout

Definition at line 338 of file process.c.

◆ removeExpiredTokens()

FUNCTION void removeExpiredTokens ( long int  retentionPeriod)

remove expired personal access tokens from fossology database

Returns
void but writes status to stdout

Definition at line 542 of file process.c.

◆ removeOldLogFiles()

FUNCTION void removeOldLogFiles ( const char *  olderThan)

< Now

< Target time

< Difference between now and target time in days

< Input time

< Command to run

< Number of files removed

< Return value of find

Definition at line 660 of file process.c.

◆ removeOrphanedFiles()

FUNCTION void removeOrphanedFiles ( )

Remove orphaned files from the repository (slow) Loop through each file in the repository and make sure there is a pfile table entry. Then make sure the pfile_pk is used by uploadtree.

Returns
void but writes status to stdout

< Path to fossology repository

< Path to files directory

Definition at line 246 of file process.c.

◆ removeOrphanedLogFiles()

FUNCTION void removeOrphanedLogFiles ( )

Remove orphan log files created to store the logs from agents on disk.

Returns
void but writes status to stdout

Definition at line 469 of file process.c.

◆ removeOrphanedRows()

FUNCTION void removeOrphanedRows ( )

remove orphaned rows from fossology database

Returns
void but writes status to stdout

Definition at line 366 of file process.c.

◆ removeTemps()

FUNCTION void removeTemps ( )

Remove orphaned temp tables from deprecated pkgmettagetta and old delagent.

Returns
void but writes status to stdout

Definition at line 183 of file process.c.

◆ removeUploads()

FUNCTION void removeUploads ( )

Remove Uploads with no pfiles.

Returns
void but writes status to stdout
Todo:
Optimize query

Definition at line 155 of file process.c.

◆ vacAnalyze()

FUNCTION void vacAnalyze ( )

Do database vacuum and analyze.

Returns
void but writes status to stdout

Definition at line 53 of file process.c.

◆ validateFolders()

FUNCTION void validateFolders ( )

Validate folder and foldercontents tables.

Returns
void but writes status to stdout

Definition at line 75 of file process.c.

◆ verifyFilePerms()

FUNCTION void verifyFilePerms ( int  fix)

Verify and optionally fix file permissions.

/usr/share/fossology drwxr-sr-x 15 fossy fossy
/srv/repostitory
path /srv/fossology/repository drwxrws--- 3 fossy fossy
/etc/fossology drwxr-sr-x 4 fossy fossy
/usr/local/lib/fossology/ drwxr-sr-x 2 fossy fossy
Parameters
fix0 to report bad permissions, 1 to report and fix them
Returns
void but writes status to stdout
Todo:
Verify file permissions is not implemented yet

Definition at line 128 of file process.c.

Variable Documentation

◆ pgConn

PGconn* pgConn = NULL

the connection to Database

DB connection.

Database connection.

Definition at line 15 of file process.c.