private static IEnumerable <(ShortHash hash, long size)> GetSortedDatabaseEntriesWithLocalLocationOld(OperationContext context, RocksDbContentLocationDatabase db, int index) { foreach (var hash in db.EnumerateSortedKeys(context.Token)) { if (db.TryGetEntry(context, hash, out var entry)) { if (entry.Locations[index]) { // Entry is present on the local machine yield return(hash, entry.ContentSize); } } } }
private static IEnumerable <(ShortHash hash, long size)> GetSortedDatabaseEntriesWithLocalLocationOld(OperationContext context, RocksDbContentLocationDatabase db, int index) { // Originally, this was db.EnumerateSortedKeys(context), but that method is since private. This is left // here in case further work is required in the future. foreach (var hash in new ShortHash[] { }) { if (db.TryGetEntry(context, hash, out var entry)) { if (entry.Locations[index]) { // Entry is present on the local machine yield return(hash, entry.ContentSize); } } } }
/// <nodoc /> public IReadOnlyList <string> GetTargetMachines(OperationContext context, string path) { var pathHash = ComputePathHash(path); if (_database.TryGetEntry(context, pathHash, out var entry)) { return(entry.Locations.Select(machineId => { if (_clusterState.TryResolve(machineId, out var location)) { return location.Path; } return null; }).Where(path => path != null).ToList()); } return(CollectionUtilities.EmptyArray <string>()); }