seekia/internal/databaseJobs/databaseJobs.go

49 lines
1.8 KiB
Go

// databaseJobs provides functions to perform database jobs
// These are jobs that must be performed in the background
// An example is pruning the database of content we no longer need to store
// These functions are called by backgroundJobs
package databaseJobs
//TODO: Build this package
// We need to add more jobs:
// -Update inbox messages lists
// -Update reviews/reports lists
// -Delete all of a Mate user's profiles if their newest profile does not fulfill our desires/criteria (and they are not an outlier/in our host range/in our moderation range)
// -This is needed, because we will not attempt to retrieve the viewable statuses of profiles whose author's newest profile does not fulfill our desires/criteria
// -Without this job, we will continue to show a user Mate profiles as matches for users whose newest profiles do not fulfill our desires,
// because those newer profiles cannot be shown to the user due to not having their viewable status downloaded
// -The decision to use our desires/criteria depends on if we are in desires pruning mode or not.
func UpdateDatabaseIdentityProfilesLists(identityType string)error{
//TODO: Will update the identityProfileHashes lists within badgerDatabase
return nil
}
func PruneProfileMetadata(profileType string)error{
// TODO
// Delete all metadata for...
// -Profiles whose author's identity is expired
// -profiles with no reviews that are not downloaded
// If one identity has more than X profile metadatas which cannot be deleted due to above rules
// Delete the profiles with the least reviews first? deal with canonical profiles as well
return nil
}
func PruneMessageMetadata()error{
// TODO
// Delete all metadata for...
// -Messages that are expired
// -Messages with neither reviews nor reports that are not downloaded
return nil
}