-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
689 additions
and
448 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
Source/tusdotnet.benchmark/Benchmarks/UploadConcatParserBenchmark.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using BenchmarkDotNet.Attributes; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using tusdotnet.Models.Concatenation; | ||
|
||
namespace tusdotnet.benchmark.Benchmarks | ||
{ | ||
[MemoryDiagnoser] | ||
public class UploadConcatParserBenchmark | ||
{ | ||
private const string _uploadConcatHeader = "final;/files/partial1 http://localhost:1321/files/partial2"; | ||
private const string _urlPath = "/files"; | ||
|
||
[Benchmark(Baseline = true)] | ||
public FileConcat UploadConcatParserStringBased() | ||
{ | ||
return Parsers.UploadConcatParserHelpers.UploadConcatParserStringBased.ParseAndValidate(_uploadConcatHeader, _urlPath).Type; | ||
} | ||
|
||
[Benchmark()] | ||
public FileConcat UploadConcatParserSpanBased() | ||
{ | ||
return Parsers.UploadConcatParserHelpers.UploadConcatParserSpanBased.ParseAndValidate(_uploadConcatHeader, _urlPath).Type; | ||
} | ||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using tusdotnet.Parsers.UploadConcatParserHelpers; | ||
|
||
namespace tusdotnet.Parsers | ||
{ | ||
internal static class UploadConcatParser | ||
{ | ||
internal static UploadConcatParserResult ParseAndValidate(string uploadConcatHeader, string urlPath) | ||
{ | ||
#if NETCOREAPP3_1_OR_GREATER | ||
|
||
return UploadConcatParserSpanBased.ParseAndValidate(uploadConcatHeader, urlPath); | ||
#else | ||
return UploadConcatParserStringBased.ParseAndValidate(uploadConcatHeader, urlPath); | ||
|
||
#endif | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
Source/tusdotnet/Parsers/UploadConcatParserHelpers/UploadConcatParserErrorTexts.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using tusdotnet.Constants; | ||
|
||
namespace tusdotnet.Parsers.UploadConcatParserHelpers | ||
{ | ||
internal class UploadConcatParserErrorTexts | ||
{ | ||
internal static string HEADER_IS_INVALID = $"Header {HeaderConstants.UploadConcat}: Header is invalid. Valid values are \"partial\" and \"final\" followed by a list of file urls to concatenate"; | ||
} | ||
} |
Oops, something went wrong.