diff --git a/Directory.Packages.props b/Directory.Packages.props index 50cd34fe..dae26d06 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -30,5 +30,6 @@ + diff --git a/build/packages.lock.json b/build/packages.lock.json index 2e558cd4..0df0a81a 100644 --- a/build/packages.lock.json +++ b/build/packages.lock.json @@ -42,6 +42,12 @@ "resolved": "12.0.0", "contentHash": "ptxlWtxC8vM6Y6e3h9ZTxBBkOWnWrm/Sa1HT+2i1xcXY3Hx2hmKDZP5RShPf8Xr9D+ivlrXNy57ktzyH8kyt+Q==" }, + "Speckle.InterfaceGenerator": { + "type": "Direct", + "requested": "[0.9.5, )", + "resolved": "0.9.5", + "contentHash": "oU/L7pN1R7q8KkbrpQ3WJnHirPHqn+9DEA7asOcUiggV5dzVg1A/VYs7GOSusD24njxXh03tE3a2oTLOjt3cVg==" + }, "Microsoft.Build.Tasks.Git": { "type": "Transitive", "resolved": "8.0.0", diff --git a/src/Speckle.Core/Transports/IServerTransport.cs b/src/Speckle.Core/Transports/IServerTransport.cs new file mode 100644 index 00000000..4e59f03a --- /dev/null +++ b/src/Speckle.Core/Transports/IServerTransport.cs @@ -0,0 +1,10 @@ +namespace Speckle.Core.Transports; + +public interface IServerTransport : IDisposable, ITransport, IBlobCapableTransport, ICloneable +{ + int TotalSentBytes { get; } + Credentials.Account Account { get; } + string BaseUri { get; } + string StreamId { get; } + int TimeoutSeconds { get; set; } +} diff --git a/src/Speckle.Core/Transports/ServerTransportFactory.cs b/src/Speckle.Core/Transports/ServerTransportFactory.cs new file mode 100644 index 00000000..2c7c2e8e --- /dev/null +++ b/src/Speckle.Core/Transports/ServerTransportFactory.cs @@ -0,0 +1,13 @@ +using System.Diagnostics.CodeAnalysis; +using Speckle.Core.Credentials; +using Speckle.InterfaceGenerator; + +namespace Speckle.Core.Transports; + +[GenerateAutoInterface] +[ExcludeFromCodeCoverage] //factories don't need coverage +public class ServerTransportFactory : IServerTransportFactory +{ + public IServerTransport Create(Account account, string streamId, int timeoutSeconds, string? blobStorageFolder) => + new ServerTransport(account, streamId, timeoutSeconds, blobStorageFolder); +} diff --git a/src/Speckle.Core/Transports/ServerV2.cs b/src/Speckle.Core/Transports/ServerV2.cs index ff1baa2e..26aded46 100644 --- a/src/Speckle.Core/Transports/ServerV2.cs +++ b/src/Speckle.Core/Transports/ServerV2.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; using Speckle.Core.Credentials; using Speckle.Core.Helpers; using Speckle.Core.Logging; @@ -14,12 +8,8 @@ namespace Speckle.Core.Transports; -public sealed class ServerTransport : IDisposable, ICloneable, ITransport, IBlobCapableTransport +public sealed class ServerTransport : IServerTransport { - // POC: autofac uses this to construct a factory in place if this delegate and this can then be injected and parameters passed - // this should, and I think can, come out of this class, because I think autofac does magic based on the return type - public delegate ITransport Factory(Account account, string streamId, int timeoutSeconds, string? blobStorageFolder); - private readonly object _elapsedLock = new(); private Exception? _exception; diff --git a/src/Speckle.Core/packages.lock.json b/src/Speckle.Core/packages.lock.json index 3959963f..37406b44 100644 --- a/src/Speckle.Core/packages.lock.json +++ b/src/Speckle.Core/packages.lock.json @@ -163,6 +163,12 @@ "resolved": "4.0.1", "contentHash": "MzEQ1Im0zTja+tEsdRIk/WlPiKqb22NmTOJcR1ZKm/mz46pezyyID3/wRz6vJUELMpSLnG7LhsxBL+nxbr7V0w==" }, + "Speckle.InterfaceGenerator": { + "type": "Direct", + "requested": "[0.9.5, )", + "resolved": "0.9.5", + "contentHash": "oU/L7pN1R7q8KkbrpQ3WJnHirPHqn+9DEA7asOcUiggV5dzVg1A/VYs7GOSusD24njxXh03tE3a2oTLOjt3cVg==" + }, "Speckle.Newtonsoft.Json": { "type": "Direct", "requested": "[13.0.2, )", diff --git a/src/Speckle.Objects/Speckle.Objects.csproj b/src/Speckle.Objects/Speckle.Objects.csproj index d17fe670..9f715ac3 100644 --- a/src/Speckle.Objects/Speckle.Objects.csproj +++ b/src/Speckle.Objects/Speckle.Objects.csproj @@ -7,7 +7,7 @@ Speckle.Objects Objects is the default object model for Speckle $(PackageTags), objects - System.Runtime.CompilerServices.IsExternalInit;System.Runtime.CompilerServices.RequiresLocationAttribute + System.Runtime.CompilerServices.RequiresLocationAttribute Debug;Release;Local diff --git a/src/Speckle.Objects/packages.lock.json b/src/Speckle.Objects/packages.lock.json index 851ddffc..355cd9d4 100644 --- a/src/Speckle.Objects/packages.lock.json +++ b/src/Speckle.Objects/packages.lock.json @@ -33,6 +33,12 @@ "resolved": "1.14.1", "contentHash": "mOOmFYwad3MIOL14VCjj02LljyF1GNw1wP0YVlxtcPvqdxjGGMNdNJJxHptlry3MOd8b40Flm8RPOM8JOlN2sQ==" }, + "Speckle.InterfaceGenerator": { + "type": "Direct", + "requested": "[0.9.5, )", + "resolved": "0.9.5", + "contentHash": "oU/L7pN1R7q8KkbrpQ3WJnHirPHqn+9DEA7asOcUiggV5dzVg1A/VYs7GOSusD24njxXh03tE3a2oTLOjt3cVg==" + }, "GraphQL.Client.Abstractions": { "type": "Transitive", "resolved": "6.0.0", diff --git a/src/Speckle.Transports.Disk/packages.lock.json b/src/Speckle.Transports.Disk/packages.lock.json index 851ddffc..355cd9d4 100644 --- a/src/Speckle.Transports.Disk/packages.lock.json +++ b/src/Speckle.Transports.Disk/packages.lock.json @@ -33,6 +33,12 @@ "resolved": "1.14.1", "contentHash": "mOOmFYwad3MIOL14VCjj02LljyF1GNw1wP0YVlxtcPvqdxjGGMNdNJJxHptlry3MOd8b40Flm8RPOM8JOlN2sQ==" }, + "Speckle.InterfaceGenerator": { + "type": "Direct", + "requested": "[0.9.5, )", + "resolved": "0.9.5", + "contentHash": "oU/L7pN1R7q8KkbrpQ3WJnHirPHqn+9DEA7asOcUiggV5dzVg1A/VYs7GOSusD24njxXh03tE3a2oTLOjt3cVg==" + }, "GraphQL.Client.Abstractions": { "type": "Transitive", "resolved": "6.0.0", diff --git a/src/Speckle.Transports.MongoDB/packages.lock.json b/src/Speckle.Transports.MongoDB/packages.lock.json index b726bba8..96f6973a 100644 --- a/src/Speckle.Transports.MongoDB/packages.lock.json +++ b/src/Speckle.Transports.MongoDB/packages.lock.json @@ -45,6 +45,12 @@ "resolved": "1.14.1", "contentHash": "mOOmFYwad3MIOL14VCjj02LljyF1GNw1wP0YVlxtcPvqdxjGGMNdNJJxHptlry3MOd8b40Flm8RPOM8JOlN2sQ==" }, + "Speckle.InterfaceGenerator": { + "type": "Direct", + "requested": "[0.9.5, )", + "resolved": "0.9.5", + "contentHash": "oU/L7pN1R7q8KkbrpQ3WJnHirPHqn+9DEA7asOcUiggV5dzVg1A/VYs7GOSusD24njxXh03tE3a2oTLOjt3cVg==" + }, "AWSSDK.Core": { "type": "Transitive", "resolved": "3.7.100.14", diff --git a/tests/Speckle.Core.Serialization.Tests/packages.lock.json b/tests/Speckle.Core.Serialization.Tests/packages.lock.json index 524379d1..2cdd87f5 100644 --- a/tests/Speckle.Core.Serialization.Tests/packages.lock.json +++ b/tests/Speckle.Core.Serialization.Tests/packages.lock.json @@ -62,6 +62,12 @@ "EmptyFiles": "4.4.0" } }, + "Speckle.InterfaceGenerator": { + "type": "Direct", + "requested": "[0.9.5, )", + "resolved": "0.9.5", + "contentHash": "oU/L7pN1R7q8KkbrpQ3WJnHirPHqn+9DEA7asOcUiggV5dzVg1A/VYs7GOSusD24njxXh03tE3a2oTLOjt3cVg==" + }, "DiffEngine": { "type": "Transitive", "resolved": "11.3.0", diff --git a/tests/Speckle.Core.Tests.Integration/packages.lock.json b/tests/Speckle.Core.Tests.Integration/packages.lock.json index aa8beddd..0756a2f1 100644 --- a/tests/Speckle.Core.Tests.Integration/packages.lock.json +++ b/tests/Speckle.Core.Tests.Integration/packages.lock.json @@ -62,6 +62,12 @@ "EmptyFiles": "4.4.0" } }, + "Speckle.InterfaceGenerator": { + "type": "Direct", + "requested": "[0.9.5, )", + "resolved": "0.9.5", + "contentHash": "oU/L7pN1R7q8KkbrpQ3WJnHirPHqn+9DEA7asOcUiggV5dzVg1A/VYs7GOSusD24njxXh03tE3a2oTLOjt3cVg==" + }, "DiffEngine": { "type": "Transitive", "resolved": "11.3.0", diff --git a/tests/Speckle.Core.Tests.Unit/packages.lock.json b/tests/Speckle.Core.Tests.Unit/packages.lock.json index 8df4c1ff..f3914bf3 100644 --- a/tests/Speckle.Core.Tests.Unit/packages.lock.json +++ b/tests/Speckle.Core.Tests.Unit/packages.lock.json @@ -52,6 +52,12 @@ "resolved": "1.14.1", "contentHash": "mOOmFYwad3MIOL14VCjj02LljyF1GNw1wP0YVlxtcPvqdxjGGMNdNJJxHptlry3MOd8b40Flm8RPOM8JOlN2sQ==" }, + "Speckle.InterfaceGenerator": { + "type": "Direct", + "requested": "[0.9.5, )", + "resolved": "0.9.5", + "contentHash": "oU/L7pN1R7q8KkbrpQ3WJnHirPHqn+9DEA7asOcUiggV5dzVg1A/VYs7GOSusD24njxXh03tE3a2oTLOjt3cVg==" + }, "GraphQL.Client.Abstractions": { "type": "Transitive", "resolved": "6.0.0", diff --git a/tests/Speckle.Objects.Tests.Unit/Speckle.Objects.Tests.Unit.csproj b/tests/Speckle.Objects.Tests.Unit/Speckle.Objects.Tests.Unit.csproj index 46af1feb..09920fb8 100644 --- a/tests/Speckle.Objects.Tests.Unit/Speckle.Objects.Tests.Unit.csproj +++ b/tests/Speckle.Objects.Tests.Unit/Speckle.Objects.Tests.Unit.csproj @@ -3,6 +3,7 @@ net8.0 true + System.Runtime.CompilerServices.IsExternalInit diff --git a/tests/Speckle.Objects.Tests.Unit/packages.lock.json b/tests/Speckle.Objects.Tests.Unit/packages.lock.json index ab7e99a2..f324abf5 100644 --- a/tests/Speckle.Objects.Tests.Unit/packages.lock.json +++ b/tests/Speckle.Objects.Tests.Unit/packages.lock.json @@ -52,6 +52,12 @@ "resolved": "1.14.1", "contentHash": "mOOmFYwad3MIOL14VCjj02LljyF1GNw1wP0YVlxtcPvqdxjGGMNdNJJxHptlry3MOd8b40Flm8RPOM8JOlN2sQ==" }, + "Speckle.InterfaceGenerator": { + "type": "Direct", + "requested": "[0.9.5, )", + "resolved": "0.9.5", + "contentHash": "oU/L7pN1R7q8KkbrpQ3WJnHirPHqn+9DEA7asOcUiggV5dzVg1A/VYs7GOSusD24njxXh03tE3a2oTLOjt3cVg==" + }, "GraphQL.Client.Abstractions": { "type": "Transitive", "resolved": "6.0.0",