0b1de566df
* Use Concurrent Dictionaries and ignore case on them to avoid ToLower * remove single array allocation * allocate GetClosures differently * Use JsonReader for closures * add comment * use isdefined * more readonly with less allocations * sorts * fmt * use element type when making an array * first pass * Fix reading for object and array * serialization works? * Fix closure parsing * things are way faster * Deserialize is async * fmt * renames * remove deserialize threads * fmt * faster to use ordinal compare * serialization looks okay * fix closure writing * fixes * use possibly different values for compute id * use closure parser on download * memory test for blobs * decompose serialization * fmt * fmt * for decomposing, values should be used instead of original * set id after computing it * redo more closure parsing * fix memory test * don't throw on try get deserialized * fmt * fix integration tests * fix tests * disable memory blob storage by default * put back ? * merge fixes and delete worker threads * fmt * serialization of old floats pass * serialization of old floats pass * rename class * Use async/await on GetObject * await deserialization * fmt * uncomment and fix tests * don't allow things to exist in the closure table that doesn't exist * detach blob tests * rename serializer * async more correct * revert * fix merge * fix blob tests again * more fixes * Fix building * async fixes * more async fixes * fix tests? * rename GetId to GetIdAsync * clean up * more cleanup * fmt * fix test * fix analyzer errors * use ConcurrentDictionary to be thread safe
46 lines
1.4 KiB
C#
46 lines
1.4 KiB
C#
using Speckle.Sdk.Transports;
|
|
|
|
namespace Speckle.Sdk.Serialization.Tests;
|
|
|
|
public class TestTransport : ITransport
|
|
{
|
|
public IDictionary<string, string> Objects { get; }
|
|
|
|
public TestTransport(IDictionary<string, string> objects)
|
|
{
|
|
Objects = objects;
|
|
}
|
|
|
|
public string TransportName
|
|
{
|
|
get => "Test";
|
|
set { }
|
|
}
|
|
|
|
public Dictionary<string, object> TransportContext { get; }
|
|
public TimeSpan Elapsed { get; }
|
|
public int SavedObjectCount { get; }
|
|
public CancellationToken CancellationToken { get; set; }
|
|
public Action<ProgressArgs>? OnProgressAction { get; set; }
|
|
public Action<string, Exception>? OnErrorAction { get; set; }
|
|
|
|
public void BeginWrite() => throw new NotImplementedException();
|
|
|
|
public void EndWrite() => throw new NotImplementedException();
|
|
|
|
public void SaveObject(string id, string serializedObject) => Objects[id] = serializedObject;
|
|
|
|
public Task WriteComplete() => throw new NotImplementedException();
|
|
|
|
public Task<string?> GetObject(string id) => Task.FromResult(Objects.TryGetValue(id, out string? o) ? o : null);
|
|
|
|
public Task<string> CopyObjectAndChildren(
|
|
string id,
|
|
ITransport targetTransport,
|
|
Action<int>? onTotalChildrenCountKnown = null
|
|
) => throw new NotImplementedException();
|
|
|
|
public Task<Dictionary<string, bool>> HasObjects(IReadOnlyList<string> objectIds) =>
|
|
throw new NotImplementedException();
|
|
}
|