FOSSology  4.4.0
Open Source License Compliance by Open Source Software
maintagent.h
1 /*
2  SPDX-FileCopyrightText: © 2013 Hewlett-Packard Development Company, L.P.
3  SPDX-FileCopyrightText: © 2019 Siemens AG
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 
8 #ifndef _MAINTAGENT_H
9 #define _MAINTAGENT_H 1
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <libgen.h>
13 #include <unistd.h>
14 #include <string.h>
15 #include <strings.h>
16 #include <ctype.h>
17 #include <getopt.h>
18 #include <errno.h>
19 #include <time.h>
20 #include <sys/types.h>
21 #include <sys/stat.h>
22 
23 #include <libfossology.h>
24 #define FUNCTION
25 
26 /* for DB */
27 extern PGconn* pgConn;
28 extern fo_dbManager* dbManager;
29 
33 #define myBUFSIZ 2048
34 
38 #define MAXSQL 1024
39 
40 /* File utils.c */
41 void exitNow(int exitVal);
42 void recurseDir(const char* type, char* path, int level);
43 void checkPFileExists(char* sha1, char* md5, long fsize, const char* type);
44 void deleteRepoFile(char* sha1, char* md5, long fsize, const char* type);
45 
46 /* File usage.c */
47 void usage(char *name);
48 
49 /* File process.c */
50 void vacAnalyze();
51 void validateFolders();
52 void verifyFilePerms(int fix);
53 void removeUploads();
54 void removeTemps();
55 void processExpired();
56 void removeOrphanedFiles();
57 void deleteOrphanGold();
59 void reIndexAllTables();
60 void removeOrphanedRows();
62 void removeExpiredTokens();
63 void deleteOldGold(char* date);
64 void removeOldLogFiles(const char* olderThan);
65 
66 #endif /* _MAINTAGENT_H */
PGconn * pgConn
Database connection.
Definition: adj2nest.c:86
void exitNow(int exitVal)
Exit function. This does all cleanup and should be used instead of calling exit() or main() return.
Definition: util.c:1131
The main FOSSology C library.
FUNCTION void removeOrphanedRows()
remove orphaned rows from fossology database
Definition: process.c:366
FUNCTION void verifyFilePerms(int fix)
Verify and optionally fix file permissions.
Definition: process.c:128
FUNCTION void deleteOldGold(char *date)
Delete gold files which are older than specified date.
Definition: process.c:581
FUNCTION void removeTemps()
Remove orphaned temp tables from deprecated pkgmettagetta and old delagent.
Definition: process.c:183
fo_dbManager * dbManager
fo_dbManager object
Definition: process.c:16
FUNCTION void reIndexAllTables()
reindex of all indexes in fossology database
Definition: process.c:338
FUNCTION void removeOldLogFiles(const char *olderThan)
Definition: process.c:660
FUNCTION void removeUploads()
Remove Uploads with no pfiles.
Definition: process.c:155
FUNCTION void removeOrphanedLogFiles()
Definition: process.c:469
FUNCTION void processExpired()
Process expired uploads (slow)
Definition: process.c:221
FUNCTION void removeExpiredTokens(long int retentionPeriod)
remove expired personal access tokens from fossology database
Definition: process.c:542
FUNCTION void validateFolders()
Validate folder and foldercontents tables.
Definition: process.c:75
FUNCTION void removeOrphanedFiles()
Remove orphaned files from the repository (slow) Loop through each file in the repository and make su...
Definition: process.c:246
FUNCTION void vacAnalyze()
Do database vacuum and analyze.
Definition: process.c:53
FUNCTION void deleteOrphanGold()
Delete orphaned gold files from the repository.
Definition: process.c:281
FUNCTION void normalizeUploadPriorities()
Normalize priority of Uploads.
Definition: process.c:313
FUNCTION void usage(char *name)
Definition: usage.c:18
FUNCTION void checkPFileExists(char *sha1, char *md5, long fsize, const char *type)
Check if given checksums exists in DB, if not call deleteRepoFile()
Definition: utils.c:130
FUNCTION void deleteRepoFile(char *sha1, char *md5, long fsize, const char *type)
Take a file checksum, generate repo path and call unlink()
Definition: utils.c:177
FUNCTION void recurseDir(const char *type, char *path, int level)
Recursively read directory till level is 0.
Definition: utils.c:67