async Task <int> UpdateRecs_0to1() { var toUpgrade = await FilesToUpgrade("recs", 0); V0UpdateTime = DateTime.Parse("2019-11-02T13:50:00Z").ToUniversalTime(); await toUpgrade.BlockAction(async f => { var existingJs = await Jsonl(f); var upgradedJs = existingJs.GroupBy(j => j["FromVideoId"].Value <string>()).SelectMany(g => { return(g.Select((j, i) => { var newJ = j.DeepClone(); newJ["Updated"] = V0UpdateTime; newJ["Rank"] = i + 1; return newJ; })); }); var newPath = StoreFileMd.FilePath(f.Path.Parent, V0UpdateTime.FileSafeTimestamp(), "1"); await ReplaceJsonLFile(f, newPath, upgradedJs); }, Cfg.DefaultParallel); return(toUpgrade.Count); }
static StringPath NewFilePath(StoreFileMd f, int version) => StoreFileMd.FilePath(f.Path.Parent, StoreFileMd.GetTs(f.Path), version.ToString());