f163b2822e
* First pass of ObjectSaver and better in-memory usage * fix some tests * add commit to match deserialize process * correct more tests * format * make a deserialize factory * fix tests? and format * use distinct * Fix mismerge * Fix serialization issues with tests * fix merges * follow copilot suggestions * remove disables
57 lines
1.7 KiB
C#
57 lines
1.7 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;
|
|
|
|
[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
|
|
);
|
|
}
|