-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* progress intermediate commit * add progress for download * remove unused code * remove batch sent callbacks * multi-threaded deserialize works * Progress for download and deserialization * Fix tests * Have less indeterminate deserialization * fix deserialization * make download faster with buffered stream * put local receive back * remove unused callback * fmt * Progress for serialization and upload * fix uploading * clean up from progress * merge fixes and fmt
- Loading branch information
1 parent
0f116ad
commit 4c3e572
Showing
19 changed files
with
83 additions
and
166 deletions.
There are no files selected for viewing
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,26 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Security.Cryptography; | ||
|
||
namespace Speckle.Sdk.Models; | ||
|
||
public static class HashUtility | ||
{ | ||
public enum HashingFunctions | ||
{ | ||
SHA256, | ||
MD5 | ||
} | ||
|
||
public const int HASH_LENGTH = 32; | ||
|
||
[SuppressMessage("Security", "CA5351:Do Not Use Broken Cryptographic Algorithms")] | ||
public static string HashFile(string filePath, HashingFunctions func = HashingFunctions.SHA256) | ||
{ | ||
using HashAlgorithm hashAlgorithm = func == HashingFunctions.MD5 ? MD5.Create() : SHA256.Create(); | ||
|
||
using var stream = File.OpenRead(filePath); | ||
|
||
var hash = hashAlgorithm.ComputeHash(stream); | ||
return BitConverter.ToString(hash, 0, HASH_LENGTH).Replace("-", "").ToLowerInvariant(); | ||
} | ||
} |
This file was deleted.
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
10 changes: 10 additions & 0 deletions
10
src/Speckle.Sdk/Serialisation/SpeckleDeserializeException.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,10 @@ | ||
namespace Speckle.Sdk.Serialisation; | ||
|
||
public class SpeckleDeserializeException : SpeckleException | ||
{ | ||
public SpeckleDeserializeException(string message, Exception? inner = null) | ||
: base(message, inner) { } | ||
|
||
public SpeckleDeserializeException(string message) | ||
: base(message) { } | ||
} |
17 changes: 1 addition & 16 deletions
17
src/Speckle.Sdk/Serialisation/SpeckleSerializerException.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 |
---|---|---|
@@ -1,25 +1,10 @@ | ||
using Speckle.Sdk.Logging; | ||
|
||
namespace Speckle.Sdk.Serialisation; | ||
namespace Speckle.Sdk.Serialisation; | ||
|
||
public class SpeckleSerializeException : SpeckleException | ||
{ | ||
public SpeckleSerializeException() { } | ||
|
||
public SpeckleSerializeException(string message, Exception? inner = null) | ||
: base(message, inner) { } | ||
|
||
public SpeckleSerializeException(string message) | ||
: base(message) { } | ||
} | ||
|
||
public class SpeckleDeserializeException : SpeckleException | ||
{ | ||
public SpeckleDeserializeException() { } | ||
|
||
public SpeckleDeserializeException(string message, Exception? inner = null) | ||
: base(message, inner) { } | ||
|
||
public SpeckleDeserializeException(string message) | ||
: base(message) { } | ||
} |
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
2 changes: 1 addition & 1 deletion
2
...n/SerializationUtilities/ClosureParser.cs → .../Serialisation/Utilities/ClosureParser.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
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,23 @@ | ||
namespace Speckle.Sdk.Serialisation.Utilities; | ||
|
||
internal readonly struct OperationTask<T> | ||
where T : struct | ||
{ | ||
public readonly T OperationType; | ||
public readonly object? InputValue; | ||
public readonly TaskCompletionSource<object?>? Tcs; | ||
|
||
public OperationTask(T operationType, object? inputValue = null, TaskCompletionSource<object?>? tcs = null) | ||
{ | ||
OperationType = operationType; | ||
InputValue = inputValue; | ||
Tcs = tcs; | ||
} | ||
|
||
public void Deconstruct(out T operationType, out object? inputValue, out TaskCompletionSource<object?>? tcs) | ||
{ | ||
operationType = OperationType; | ||
inputValue = InputValue; | ||
tcs = Tcs; | ||
} | ||
} |
26 changes: 2 additions & 24 deletions
26
...n/SerializationUtilities/OperationTask.cs → ...on/Utilities/ParallelOperationExecutor.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
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
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
Oops, something went wrong.