b6be7a351f
* First pass * First pass adding service registraiton * Finished up service registration * Json exception * Moved to the right place * Fixed tests * Added some missing docs strings * Reflecting Gergo's specklepy changes * Correct the DI registration * Readme * No warn beta packages * Format * renamed misleading variable * Fixed lock files * Disable SQLite for automate
59 lines
1.8 KiB
C#
59 lines
1.8 KiB
C#
using System.Collections.Concurrent;
|
|
using Microsoft.Extensions.Logging;
|
|
using Speckle.InterfaceGenerator;
|
|
using Speckle.Sdk.Serialisation.V2.Receive;
|
|
using Speckle.Sdk.SQLite;
|
|
using Speckle.Sdk.Transports;
|
|
|
|
namespace Speckle.Sdk.Serialisation.V2;
|
|
|
|
/// <seealso cref="DeserializeProcessFactoryNoCache"/>
|
|
/// <seealso cref="DeserializeProcess"/>
|
|
[GenerateAutoInterface]
|
|
public class DeserializeProcessFactory(
|
|
IBaseDeserializer baseDeserializer,
|
|
ISqLiteJsonCacheManagerFactory sqLiteJsonCacheManagerFactory,
|
|
IServerObjectManagerFactory serverObjectManagerFactory,
|
|
ILoggerFactory loggerFactory
|
|
) : IDeserializeProcessFactory
|
|
{
|
|
public IDeserializeProcess CreateDeserializeProcess(
|
|
Uri url,
|
|
string streamId,
|
|
string? authorizationToken,
|
|
IProgress<ProgressArgs>? progress,
|
|
CancellationToken cancellationToken,
|
|
DeserializeProcessOptions? options = null
|
|
)
|
|
{
|
|
var sqLiteJsonCacheManager = sqLiteJsonCacheManagerFactory.CreateFromStream(streamId);
|
|
var serverObjectManager = serverObjectManagerFactory.Create(url, streamId, authorizationToken);
|
|
return new DeserializeProcess(
|
|
sqLiteJsonCacheManager,
|
|
serverObjectManager,
|
|
progress,
|
|
baseDeserializer,
|
|
loggerFactory,
|
|
cancellationToken,
|
|
options
|
|
);
|
|
}
|
|
|
|
public IDeserializeProcess CreateDeserializeProcess(
|
|
ConcurrentDictionary<Id, Json> jsonCache,
|
|
ConcurrentDictionary<string, string> objects,
|
|
IProgress<ProgressArgs>? progress,
|
|
CancellationToken cancellationToken,
|
|
DeserializeProcessOptions? options = null
|
|
) =>
|
|
new DeserializeProcess(
|
|
new MemoryJsonCacheManager(jsonCache),
|
|
new MemoryServerObjectManager(objects),
|
|
progress,
|
|
baseDeserializer,
|
|
loggerFactory,
|
|
cancellationToken,
|
|
options
|
|
);
|
|
}
|