/// <summary> /// Find the service from the path. /// </summary> public static ServiceNames GetServiceName(ISleetFile file) { var path = GetRelativePath(file).Trim('/').Split('/')[0].ToLowerInvariant(); switch (path) { case "badges": return(ServiceNames.Badges); case "registration": return(ServiceNames.Registrations); case "catalog": return(ServiceNames.Catalog); case "autocomplete": return(ServiceNames.AutoComplete); case "search": return(ServiceNames.Search); case "symbols": return(ServiceNames.Symbols); default: return(ServiceNames.Unknown); } }
public PackageFile(string fileName, string hash, ZipArchiveEntry zipEntry, ISleetFile assetFile, ISleetFile indexFile) { AssetFile = assetFile; FileName = fileName; Hash = hash; ZipEntry = zipEntry; IndexFile = indexFile; }
public PackageFile(string fileName, string hash, MemoryStream stream, ISleetFile assetFile, ISleetFile indexFile) { AssetFile = assetFile; FileName = fileName; Hash = hash; Stream = stream; IndexFile = indexFile; }
/// <summary> /// file/hash/index -> package /// </summary> private Task AddAssemblyToPackageIndexAsync(PackageInput package, ISleetFile indexFile, bool isSymbolsPackage) { var index = new PackageIndexFile(_context, indexFile, persistWhenEmpty: false); if (isSymbolsPackage) { return(index.AddSymbolsPackageAsync(package)); } else { return(index.AddPackageAsync(package)); } }
/// <summary> /// Get the relative path of a file /// </summary> public static string GetRelativePath(ISleetFile file) { if (file is null) { throw new ArgumentNullException(nameof(file)); } var fileSystemBase = file.FileSystem as FileSystemBase; if (fileSystemBase != null) { return(fileSystemBase.GetRelativePath(file.EntityUri)); } else { return(UriUtility.GetRelativePath(file.FileSystem.BaseURI, file.EntityUri)); } }
private static Func <Task> GetCommitFileFunc(ISleetFile file, ILogger log, CancellationToken token) { return(new Func <Task>(() => file.Push(log, token))); }
public PackageIndexFile(SleetContext context, ISleetFile file, bool persistWhenEmpty) : base(context, file, persistWhenEmpty) { }
public static PerfEntryWrapper <PerfFileEntry> CreateModifyTimer(ISleetFile file, SleetContext context) { return(CreateModifyTimer(file, context.PerfTracker)); }
public static PerfEntryWrapper <PerfFileEntry> CreateFileTimer(ISleetFile file, IPerfTracker tracker, PerfFileEntry.FileOperation operation) { return(new PerfEntryWrapper <PerfFileEntry>(tracker, (time) => new PerfFileEntry(time, file.EntityUri, operation))); }
public static PerfEntryWrapper <PerfFileEntry> CreateModifyTimer(ISleetFile file, IPerfTracker tracker) { return(CreateFileTimer(file, tracker, PerfFileEntry.FileOperation.Modify)); }
protected IndexFileBase(SleetContext context, ISleetFile file, bool persistWhenEmpty) { Context = context ?? throw new ArgumentNullException(nameof(context)); File = file ?? throw new ArgumentNullException(nameof(file)); PersistWhenEmpty = persistWhenEmpty; }