endpoint + tests for getVideoLabels

This commit is contained in:
Michael C
2022-03-31 03:47:06 -04:00
parent fe0afd58bc
commit e6bf20937d
5 changed files with 390 additions and 1 deletions

View File

@@ -36,4 +36,14 @@ export function shaHashKey(singleIter: HashedValue): string {
}
export const tempVIPKey = (userID: HashedUserID): string =>
`vip.temp.${userID}`;
`vip.temp.${userID}`;
export const videoLabelsKey = (videoID: VideoID, service: Service): string =>
`labels.v1.${service}.videoID.${videoID}`;
export function videoLabelsHashKey(hashedVideoIDPrefix: VideoIDHash, service: Service): string {
hashedVideoIDPrefix = hashedVideoIDPrefix.substring(0, 4) as VideoIDHash;
if (hashedVideoIDPrefix.length !== 4) Logger.warn(`Redis skip segment hash-prefix key is not length 4! ${hashedVideoIDPrefix}`);
return `labels.v1.${service}.${hashedVideoIDPrefix}`;
}