From b6bd9d843b78c25f12ec9a31a693ee5d958e2f6b Mon Sep 17 00:00:00 2001 From: halgari Date: Wed, 18 Sep 2024 09:02:15 -0600 Subject: [PATCH 1/9] WIP --- .../Attribute.cs | 38 +++--- .../AttributeCache.cs | 57 +++++++++ .../AttributeResolver.cs | 15 +++ .../Attributes/BlobAttribute.cs | 2 +- .../Attributes/CardinalityAttribute.cs | 2 +- .../Attributes/HashedBlobAttribute.cs | 2 +- .../Datom.cs | 49 +++----- .../DatomKey.cs | 16 +-- .../IAttribute.cs | 2 +- .../IConnection.cs | 11 +- .../IDatomStore.cs | 2 +- src/NexusMods.MnemonicDB.Abstractions/IDb.cs | 6 +- .../IndexSegments/IndexSegment.cs | 32 ++---- .../IndexSegments/IndexSegmentBuilder.cs | 16 ++- .../IndexSegments/Values.cs | 4 +- .../Models/ReadOnlyModel.cs | 3 +- .../Query/ObservableDatoms.cs | 37 +++--- .../Query/SliceDescriptor.cs | 108 +++++++++--------- .../TxFunctions/ExtensionMethods.cs | 15 ++- .../ValueSerializer.cs | 8 +- src/NexusMods.MnemonicDB/AsOfSnapshot.cs | 10 +- .../Caching/IndexSegmentCache.cs | 14 +-- src/NexusMods.MnemonicDB/Connection.cs | 11 +- src/NexusMods.MnemonicDB/Db.cs | 28 +++-- .../Storage/DatomStore.cs | 64 +++++------ .../Storage/InMemoryBackend/Backend.cs | 10 +- .../Storage/InMemoryBackend/IndexStore.cs | 4 +- .../Storage/InMemoryBackend/Snapshot.cs | 10 +- .../Storage/NextIdCache.cs | 8 +- .../Storage/RocksDbBackend/Backend.cs | 4 +- .../Storage/RocksDbBackend/Snapshot.cs | 2 +- src/NexusMods.MnemonicDB/Transaction.cs | 4 +- 32 files changed, 316 insertions(+), 278 deletions(-) create mode 100644 src/NexusMods.MnemonicDB.Abstractions/AttributeCache.cs create mode 100644 src/NexusMods.MnemonicDB.Abstractions/AttributeResolver.cs diff --git a/src/NexusMods.MnemonicDB.Abstractions/Attribute.cs b/src/NexusMods.MnemonicDB.Abstractions/Attribute.cs index 5bf6431c..018db0c6 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/Attribute.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/Attribute.cs @@ -51,7 +51,7 @@ protected Attribute( /// /// Converts a low-level value to a high-level value /// - protected virtual TValueType FromLowLevel(byte value, ValueTags tags, RegistryId registryId) + protected virtual TValueType FromLowLevel(byte value, ValueTags tags, AttributeResolver resolver) { throw new NotSupportedException("Unsupported low-level type " + value + " on attribute " + Id); } @@ -59,7 +59,7 @@ protected virtual TValueType FromLowLevel(byte value, ValueTags tags, RegistryId /// /// Converts a low-level value to a high-level value /// - protected virtual TValueType FromLowLevel(ushort value, ValueTags tags, RegistryId registryId) + protected virtual TValueType FromLowLevel(ushort value, ValueTags tags, AttributeResolver resolver) { throw new NotSupportedException("Unsupported low-level type " + value + " on attribute " + Id); } @@ -67,7 +67,7 @@ protected virtual TValueType FromLowLevel(ushort value, ValueTags tags, Registry /// /// Converts a low-level value to a high-level value /// - protected virtual TValueType FromLowLevel(uint value, ValueTags tags, RegistryId registryId) + protected virtual TValueType FromLowLevel(uint value, ValueTags tags, AttributeResolver resolver) { throw new NotSupportedException("Unsupported low-level type " + value + " on attribute " + Id); } @@ -76,7 +76,7 @@ protected virtual TValueType FromLowLevel(uint value, ValueTags tags, RegistryId /// /// Converts a low-level value to a high-level value /// - protected virtual TValueType FromLowLevel(string value, ValueTags tag, RegistryId registryId) + protected virtual TValueType FromLowLevel(string value, ValueTags tag, AttributeResolver resolver) { throw new NotSupportedException("Unsupported low-level type " + value + " on attribute " + Id); } @@ -84,7 +84,7 @@ protected virtual TValueType FromLowLevel(string value, ValueTags tag, RegistryI /// /// Converts a low-level value to a high-level value /// - protected virtual TValueType FromLowLevel(ReadOnlySpan value, ValueTags tag, RegistryId registryId) + protected virtual TValueType FromLowLevel(ReadOnlySpan value, ValueTags tag, AttributeResolver resolver) { throw new NotSupportedException("Unsupported low-level type " + tag + " on attribute " + Id); } @@ -93,7 +93,7 @@ protected virtual TValueType FromLowLevel(ReadOnlySpan value, ValueTags ta /// /// Converts a low-level value to a high-level value /// - protected virtual TValueType FromLowLevel(ulong value, ValueTags tags, RegistryId registryId) + protected virtual TValueType FromLowLevel(ulong value, ValueTags tags, AttributeResolver resolver) { throw new NotSupportedException("Unsupported low-level type " + value + " on attribute " + Id); } @@ -102,7 +102,7 @@ protected virtual TValueType FromLowLevel(ulong value, ValueTags tags, RegistryI /// /// Converts a low-level value to a high-level value /// - protected virtual TValueType FromLowLevel(UInt128 value, ValueTags tags, RegistryId registryId) + protected virtual TValueType FromLowLevel(UInt128 value, ValueTags tags, AttributeResolver resolver) { throw new NotSupportedException("Unsupported low-level type " + value + " on attribute " + Id); } @@ -110,7 +110,7 @@ protected virtual TValueType FromLowLevel(UInt128 value, ValueTags tags, Registr /// /// Converts a low-level value to a high-level value /// - protected virtual TValueType FromLowLevel(short value, ValueTags tags, RegistryId registryId) + protected virtual TValueType FromLowLevel(short value, ValueTags tags, AttributeResolver resolver) { throw new NotSupportedException("Unsupported low-level type " + value + " on attribute " + Id); } @@ -118,7 +118,7 @@ protected virtual TValueType FromLowLevel(short value, ValueTags tags, RegistryI /// /// Converts a low-level value to a high-level value /// - protected virtual TValueType FromLowLevel(int value, ValueTags tags, RegistryId registryId) + protected virtual TValueType FromLowLevel(int value, ValueTags tags, AttributeResolver resolver) { throw new NotSupportedException("Unsupported low-level type " + value + " on attribute " + Id); } @@ -126,7 +126,7 @@ protected virtual TValueType FromLowLevel(int value, ValueTags tags, RegistryId /// /// Converts a low-level value to a high-level value /// - protected virtual TValueType FromLowLevel(long value, ValueTags tags, RegistryId registryId) + protected virtual TValueType FromLowLevel(long value, ValueTags tags, AttributeResolver resolver) { throw new NotSupportedException("Unsupported low-level type " + value + " on attribute " + Id); } @@ -134,7 +134,7 @@ protected virtual TValueType FromLowLevel(long value, ValueTags tags, RegistryId /// /// Converts a low-level value to a high-level value /// - protected virtual TValueType FromLowLevel(Int128 value, ValueTags tags, RegistryId registryId) + protected virtual TValueType FromLowLevel(Int128 value, ValueTags tags, AttributeResolver resolver) { throw new NotSupportedException("Unsupported low-level type " + value + " on attribute " + Id); } @@ -142,7 +142,7 @@ protected virtual TValueType FromLowLevel(Int128 value, ValueTags tags, Registry /// /// Converts a low-level value to a high-level value /// - protected virtual TValueType FromLowLevel(float value, ValueTags tags, RegistryId registryId) + protected virtual TValueType FromLowLevel(float value, ValueTags tags, AttributeResolver resolver) { throw new NotSupportedException("Unsupported low-level type " + value + " on attribute " + Id); } @@ -150,7 +150,7 @@ protected virtual TValueType FromLowLevel(float value, ValueTags tags, RegistryI /// /// Converts a low-level value to a high-level value /// - protected virtual TValueType FromLowLevel(double value, ValueTags tags, RegistryId registryId) + protected virtual TValueType FromLowLevel(double value, ValueTags tags, AttributeResolver resolver) { throw new NotSupportedException("Unsupported low-level type " + value + " on attribute " + Id); } @@ -195,26 +195,26 @@ public AttributeId GetDbId(RegistryId id) public bool IsReference => LowLevelType == ValueTags.Reference; /// - IReadDatom IAttribute.Resolve(in KeyPrefix prefix, ReadOnlySpan valueSpan, RegistryId registryId) + IReadDatom IAttribute.Resolve(in KeyPrefix prefix, ReadOnlySpan valueSpan, AttributeResolver resolver) { - return new ReadDatom(in prefix, ReadValue(valueSpan, prefix.ValueTag, registryId), this); + return new ReadDatom(in prefix, ReadValue(valueSpan, prefix.ValueTag, resolver), this); } /// /// Resolves the value from the given value span into a high-level ReadDatom /// - public ReadDatom Resolve(in KeyPrefix prefix, ReadOnlySpan valueSpan, RegistryId registryId) + public ReadDatom Resolve(in KeyPrefix prefix, ReadOnlySpan valueSpan, AttributeResolver resolver) { - return new ReadDatom(in prefix, ReadValue(valueSpan, prefix.ValueTag, registryId), this); + return new ReadDatom(in prefix, ReadValue(valueSpan, prefix.ValueTag, resolver), this); } /// /// Resolves the low-level Datom into a high-level ReadDatom /// - public ReadDatom Resolve(in Datom datom, RegistryId id) + public ReadDatom Resolve(in Datom datom, AttributeResolver resolver) { var prefix = datom.Prefix; - return new ReadDatom(in prefix, ReadValue(datom.ValueSpan, datom.Prefix.ValueTag, id), this); + return new ReadDatom(in prefix, ReadValue(datom.ValueSpan, datom.Prefix.ValueTag, resolver), this); } /// diff --git a/src/NexusMods.MnemonicDB.Abstractions/AttributeCache.cs b/src/NexusMods.MnemonicDB.Abstractions/AttributeCache.cs new file mode 100644 index 00000000..2b1d0794 --- /dev/null +++ b/src/NexusMods.MnemonicDB.Abstractions/AttributeCache.cs @@ -0,0 +1,57 @@ +namespace NexusMods.MnemonicDB.Abstractions; + +/// +/// The authoritative source of attribute definitions is the database itself, this class provides a cache +/// of these definitions for use in the rest of the code routines +/// +public sealed class AttributeCache +{ + /// + /// Resets the cache, causing it to re-query the database for the latest definitions. + /// + /// + public void Reset(IDb idb) + { + throw new System.NotImplementedException(); + } + + /// + /// Returns true if the attribute is a reference attribute. + /// + public bool IsReference(AttributeId attrId) + { + throw new System.NotImplementedException(); + } + + /// + /// Returns true if the attribute is indexed. + /// + public bool IsIndexed(AttributeId attrId) + { + throw new System.NotImplementedException(); + } + + /// + /// Returns true if the attribute is `NoHistory`. + /// + public bool IsNoHistory(AttributeId attrId) + { + throw new System.NotImplementedException(); + } + + /// + /// Returns true if the attribute cardinality is many. + /// + public bool IsCardinalityMany(AttributeId attrId) + { + throw new System.NotImplementedException(); + } + + /// + /// Get the AttributeId (DB attribute id) for the given attribute name + /// + public AttributeId GetAttributeId(Symbol attribute) + { + throw new System.NotImplementedException(); + } +} diff --git a/src/NexusMods.MnemonicDB.Abstractions/AttributeResolver.cs b/src/NexusMods.MnemonicDB.Abstractions/AttributeResolver.cs new file mode 100644 index 00000000..c87d9a65 --- /dev/null +++ b/src/NexusMods.MnemonicDB.Abstractions/AttributeResolver.cs @@ -0,0 +1,15 @@ +using NexusMods.MnemonicDB.Abstractions.DatomIterators; + +namespace NexusMods.MnemonicDB.Abstractions; + +/// +/// Occasionally we need to turn the raw datoms from the database into a IReadDatom, this class +/// provides the mappings from AttributeId to IAttribute +/// +public sealed class AttributeResolver +{ + public IReadDatom Resolve(Datom datom) + { + throw new System.NotImplementedException(); + } +} diff --git a/src/NexusMods.MnemonicDB.Abstractions/Attributes/BlobAttribute.cs b/src/NexusMods.MnemonicDB.Abstractions/Attributes/BlobAttribute.cs index b5fac155..cc4e232b 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/Attributes/BlobAttribute.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/Attributes/BlobAttribute.cs @@ -27,7 +27,7 @@ protected override byte[] ToLowLevel(TValue value) /// /// Overwrite this method to read the value from the reader /// - protected abstract override TValue FromLowLevel(ReadOnlySpan value, ValueTags tags, RegistryId registryId); + protected abstract override TValue FromLowLevel(ReadOnlySpan value, ValueTags tags, AttributeResolver resolver); /// /// Overwrite this method to write the value to the writer diff --git a/src/NexusMods.MnemonicDB.Abstractions/Attributes/CardinalityAttribute.cs b/src/NexusMods.MnemonicDB.Abstractions/Attributes/CardinalityAttribute.cs index 63428079..b7fd4640 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/Attributes/CardinalityAttribute.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/Attributes/CardinalityAttribute.cs @@ -14,7 +14,7 @@ protected override byte ToLowLevel(Cardinality value) } /// - protected override Cardinality FromLowLevel(byte value, ValueTags tags, RegistryId registryId) + protected override Cardinality FromLowLevel(byte value, ValueTags tags, AttributeResolver resolver) { return (Cardinality)value; } diff --git a/src/NexusMods.MnemonicDB.Abstractions/Attributes/HashedBlobAttribute.cs b/src/NexusMods.MnemonicDB.Abstractions/Attributes/HashedBlobAttribute.cs index b7b081b4..8aece139 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/Attributes/HashedBlobAttribute.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/Attributes/HashedBlobAttribute.cs @@ -36,7 +36,7 @@ protected override byte[] ToLowLevel(TValue value) /// /// Overwrite this method to read the value from the reader /// - protected abstract override TValue FromLowLevel(ReadOnlySpan value, ValueTags tags, RegistryId registryId); + protected abstract override TValue FromLowLevel(ReadOnlySpan value, ValueTags tags, AttributeResolver resolver); /// /// Overwrite this method to write the value to the writer diff --git a/src/NexusMods.MnemonicDB.Abstractions/Datom.cs b/src/NexusMods.MnemonicDB.Abstractions/Datom.cs index d228860c..d2a26b99 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/Datom.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/Datom.cs @@ -13,14 +13,12 @@ public readonly struct Datom { private readonly KeyPrefix _prefix; private readonly ReadOnlyMemory _valueBlob; - private readonly IAttributeRegistry _registry; /// /// Create a new datom from the given prefix and value /// - public Datom(in KeyPrefix prefix, ReadOnlyMemory value, IAttributeRegistry registry) + public Datom(in KeyPrefix prefix, ReadOnlyMemory value) { - _registry = registry; _prefix = prefix; _valueBlob = value; } @@ -28,9 +26,8 @@ public Datom(in KeyPrefix prefix, ReadOnlyMemory value, IAttributeRegistry /// /// Create a new datom from the given datom memory span and registry /// - public Datom(ReadOnlyMemory datom, IAttributeRegistry registry) + public Datom(ReadOnlyMemory datom) { - _registry = registry; _prefix = KeyPrefix.Read(datom.Span); _valueBlob = datom[KeyPrefix.Size..]; } @@ -61,11 +58,6 @@ public byte[] ToArray() /// public ReadOnlyMemory ValueMemory => _valueBlob; - /// - /// Resolves this datom into the IReadDatom form - /// - public IReadDatom Resolved => _registry.Resolve(_prefix, _valueBlob.Span); - /// /// EntityId of the datom /// @@ -91,7 +83,7 @@ public byte[] ToArray() /// public Datom Clone() { - return new Datom(_prefix, _valueBlob.ToArray(), _registry); + return new Datom(_prefix, _valueBlob.ToArray()); } /// @@ -102,7 +94,7 @@ public Datom Clone() /// public override string ToString() { - return Resolved.ToString()!; + throw new NotImplementedException(); } /// @@ -111,25 +103,20 @@ public override string ToString() /// public int Compare(Datom other, IndexType indexType) { - switch (indexType) + return indexType switch { - case IndexType.TxLog: - return DatomComparators.TxLogComparator.Compare(this, other); - case IndexType.EAVTCurrent: - case IndexType.EAVTHistory: - return DatomComparators.EAVTComparator.Compare(this, other); - case IndexType.AEVTCurrent: - case IndexType.AEVTHistory: - return DatomComparators.AEVTComparator.Compare(this, other); - case IndexType.AVETCurrent: - case IndexType.AVETHistory: - return DatomComparators.AVETComparator.Compare(this, other); - case IndexType.VAETCurrent: - case IndexType.VAETHistory: - return DatomComparators.VAETComparator.Compare(this, other); - default: - throw new ArgumentOutOfRangeException(nameof(indexType), indexType, "Unknown index type"); - } + IndexType.TxLog => DatomComparators.TxLogComparator.Compare(this, other), + IndexType.EAVTCurrent or IndexType.EAVTHistory => DatomComparators.EAVTComparator.Compare(this, other), + IndexType.AEVTCurrent or IndexType.AEVTHistory => DatomComparators.AEVTComparator.Compare(this, other), + IndexType.AVETCurrent or IndexType.AVETHistory => DatomComparators.AVETComparator.Compare(this, other), + IndexType.VAETCurrent or IndexType.VAETHistory => DatomComparators.VAETComparator.Compare(this, other), + _ => ThrowArgumentOutOfRange(indexType) + }; + } + + private static int ThrowArgumentOutOfRange(IndexType indexType) + { + throw new ArgumentOutOfRangeException(nameof(indexType), indexType, "Unknown index type"); } /// @@ -138,6 +125,6 @@ public int Compare(Datom other, IndexType indexType) /// public Datom Retract() { - return new Datom(_prefix with {IsRetract = true, T = TxId.Tmp}, _valueBlob, _registry); + return new Datom(_prefix with {IsRetract = true, T = TxId.Tmp}, _valueBlob); } } diff --git a/src/NexusMods.MnemonicDB.Abstractions/DatomKey.cs b/src/NexusMods.MnemonicDB.Abstractions/DatomKey.cs index 9e4c259d..6884c5e2 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/DatomKey.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/DatomKey.cs @@ -12,16 +12,16 @@ namespace NexusMods.MnemonicDB.Abstractions; public readonly struct DatomKey : IEqualityComparer { private readonly EntityId _eid; - private readonly IAttribute _attribute; + private readonly AttributeId _attributeId; private readonly ReadOnlyMemory _valueMemory; /// /// Initializes a new instance of the struct. /// - public DatomKey(EntityId eid, IAttribute attribute, ReadOnlyMemory valueMemory) + public DatomKey(EntityId eid, AttributeId attributeId, ReadOnlyMemory valueMemory) { _eid = eid; - _attribute = attribute; + _attributeId = attributeId; _valueMemory = valueMemory; } @@ -33,7 +33,7 @@ public DatomKey(EntityId eid, IAttribute attribute, ReadOnlyMemory valueMe /// /// The attribute of the datom. /// - public IAttribute A => _attribute; + public AttributeId A => _attributeId; /// public bool Equals(DatomKey x, DatomKey y) @@ -41,7 +41,7 @@ public bool Equals(DatomKey x, DatomKey y) if (x._eid != y._eid) return false; - if (x._attribute != y._attribute) + if (x._attributeId != y._attributeId) return false; if (x._valueMemory.IsEmpty && y._valueMemory.IsEmpty) @@ -55,7 +55,7 @@ public int GetHashCode(DatomKey obj) { var hash = new HashCode(); hash.Add(obj._eid); - hash.Add(obj._attribute); + hash.Add(obj._attributeId); hash.AddBytes(obj._valueMemory.Span); return hash.ToHashCode(); } @@ -63,8 +63,8 @@ public int GetHashCode(DatomKey obj) public override string ToString() { if (_valueMemory.IsEmpty) - return $"({_eid}, {_attribute})"; - return $"({_eid}, {_attribute}, {ToHexString(_valueMemory)})"; + return $"({_eid}, {_attributeId})"; + return $"({_eid}, {_attributeId}, {ToHexString(_valueMemory)})"; } private static string ToHexString(ReadOnlyMemory memory) diff --git a/src/NexusMods.MnemonicDB.Abstractions/IAttribute.cs b/src/NexusMods.MnemonicDB.Abstractions/IAttribute.cs index 4ab7b225..2dbe1ac4 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/IAttribute.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/IAttribute.cs @@ -69,7 +69,7 @@ public interface IAttribute /// /// Converts the given values into a typed datom /// - IReadDatom Resolve(in KeyPrefix prefix, ReadOnlySpan valueSpan, RegistryId registryId); + IReadDatom Resolve(in KeyPrefix prefix, ReadOnlySpan valueSpan, AttributeResolver resolver); /// /// Adds the value to the transaction on the given entity/attribute, assumes the value is of the correct type diff --git a/src/NexusMods.MnemonicDB.Abstractions/IConnection.cs b/src/NexusMods.MnemonicDB.Abstractions/IConnection.cs index e3645fe5..e73345f4 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/IConnection.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/IConnection.cs @@ -30,11 +30,16 @@ public interface IConnection /// Gets the current database. /// public IDb Db { get; } - + + /// + /// The associated attribute resolver. + /// + AttributeResolver AttributeResolver { get; } + /// - /// The attribute registry for this connection + /// The attribute cache for this connection. /// - public IAttributeRegistry Registry { get; } + AttributeCache AttributeCache { get; } /// /// Gets the most recent transaction id. diff --git a/src/NexusMods.MnemonicDB.Abstractions/IDatomStore.cs b/src/NexusMods.MnemonicDB.Abstractions/IDatomStore.cs index a0214c78..50671c9a 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/IDatomStore.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/IDatomStore.cs @@ -27,7 +27,7 @@ public interface IDatomStore : IDisposable /// /// The Attribute Registry for this store /// - IAttributeRegistry Registry { get; } + AttributeCache Registry { get; } /// /// Transacts (adds) the given datoms into the store. diff --git a/src/NexusMods.MnemonicDB.Abstractions/IDb.cs b/src/NexusMods.MnemonicDB.Abstractions/IDb.cs index 2ddd6b2c..44a0cbd2 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/IDb.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/IDb.cs @@ -36,10 +36,10 @@ public interface IDb : IEquatable ISnapshot Snapshot { get; } /// - /// The registry that this database is based on. + /// The attribute cache for this database. /// - IAttributeRegistry Registry { get; } - + AttributeCache AttributeCache { get; } + /// /// Gets the index segment for the given entity id. /// diff --git a/src/NexusMods.MnemonicDB.Abstractions/IndexSegments/IndexSegment.cs b/src/NexusMods.MnemonicDB.Abstractions/IndexSegments/IndexSegment.cs index 0a2bebb9..46922131 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/IndexSegments/IndexSegment.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/IndexSegments/IndexSegment.cs @@ -22,16 +22,16 @@ namespace NexusMods.MnemonicDB.Abstractions.IndexSegments; [PublicAPI] public readonly struct IndexSegment : IReadOnlyList { - private readonly IAttributeRegistry _registry; + private readonly AttributeCache _attributeCache; private readonly int _rowCount; private readonly ReadOnlyMemory _data; /// /// Construct a new index segment from the given data and offsets /// - public IndexSegment(ReadOnlySpan data, ReadOnlySpan offsets, IAttributeRegistry registry) + public IndexSegment(ReadOnlySpan data, ReadOnlySpan offsets, AttributeCache attributeCache) { - _registry = registry; + _attributeCache = attributeCache; if (data.Length == 0) { @@ -117,12 +117,7 @@ private static void ReprocessData(int rowCount, ReadOnlySpan data, ReadOnl /// The number of datoms in this segment /// public int Count => _rowCount; - - /// - /// The assigned registry id - /// - public RegistryId RegistryId => _registry.Id; - + /// /// Get the datom of the given index /// @@ -136,7 +131,7 @@ public Datom this[int idx] var valueSlice = _data.Slice(fromOffset, toOffset - fromOffset); - return new Datom(new KeyPrefix(Uppers[idx], Lowers[idx]), valueSlice, _registry); + return new Datom(new KeyPrefix(Uppers[idx], Lowers[idx]), valueSlice); } } @@ -145,7 +140,7 @@ public Datom this[int idx] /// public bool Contains(IAttribute attribute) { - var id = attribute.GetDbId(_registry.Id); + var id = _attributeCache.GetAttributeId(attribute.Id); foreach (var datom in this) if (datom.A == id) return true; @@ -162,22 +157,13 @@ public bool Contains(IAttribute attribute) /// IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); - - /// - /// Resolves all the datoms in this segment - /// - public IEnumerable Resolved() - { - return this.Select(d => d.Resolved); - } - - + /// /// Create a new index segment from the given datoms /// - public static IndexSegment From(IAttributeRegistry registry, IReadOnlyCollection datoms) + public static IndexSegment From(AttributeCache attributeCache, IReadOnlyCollection datoms) { - using var builder = new IndexSegmentBuilder(registry, datoms.Count); + using var builder = new IndexSegmentBuilder(attributeCache, datoms.Count); builder.Add(datoms); return builder.Build(); } diff --git a/src/NexusMods.MnemonicDB.Abstractions/IndexSegments/IndexSegmentBuilder.cs b/src/NexusMods.MnemonicDB.Abstractions/IndexSegments/IndexSegmentBuilder.cs index fbfa7653..d8a6d8f6 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/IndexSegments/IndexSegmentBuilder.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/IndexSegments/IndexSegmentBuilder.cs @@ -14,16 +14,14 @@ namespace NexusMods.MnemonicDB.Abstractions.IndexSegments; { private readonly List _offsets; private readonly PooledMemoryBufferWriter _data; - private readonly RegistryId _registryId; - private readonly IAttributeRegistry _registry; + private readonly AttributeCache _attributeCache; /// /// Create a new index segment builder /// - public IndexSegmentBuilder(IAttributeRegistry registry, int capacity = 1024) + public IndexSegmentBuilder(AttributeCache attributeCache, int capacity = 1024) { - _registry = registry; - _registryId = registry.Id; + _attributeCache = attributeCache; _offsets = new List(); _data = new PooledMemoryBufferWriter(capacity); } @@ -72,7 +70,7 @@ public void Add(in Datom datom) public void Add(EntityId entityId, Attribute attribute, TValue value, TxId txId, bool isRetract) { _offsets.Add(_data.Length); - attribute.Write(entityId, _registryId, value, txId, isRetract, _data); + attribute.Write(entityId, _attributeCache, value, txId, isRetract, _data); } /// @@ -81,7 +79,7 @@ public void Add(EntityId entityId, Attribute(EntityId entityId, Attribute attribute, TValue value) { _offsets.Add(_data.Length); - attribute.Write(entityId, _registryId, value, TxId.Tmp, false, _data); + attribute.Write(entityId, _attributeCache, value, TxId.Tmp, false, _data); } /// @@ -90,7 +88,7 @@ public void Add(EntityId entityId, Attribute(EntityId entityId, Attribute attribute, TValue value, bool isRetract) { _offsets.Add(_data.Length); - attribute.Write(entityId, _registryId, value, TxId.Tmp, isRetract, _data); + attribute.Write(entityId, _attributeCache, value, TxId.Tmp, isRetract, _data); } /// @@ -109,7 +107,7 @@ public void Add(ReadOnlySpan rawData) public IndexSegment Build() { _offsets.Add(_data.Length); - return new IndexSegment(_data.GetWrittenSpan(), _offsets.ToArray(), _registry); + return new IndexSegment(_data.GetWrittenSpan(), _offsets.ToArray(), _attributeCache); } /// diff --git a/src/NexusMods.MnemonicDB.Abstractions/IndexSegments/Values.cs b/src/NexusMods.MnemonicDB.Abstractions/IndexSegments/Values.cs index eec17e01..2ffa4f00 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/IndexSegments/Values.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/IndexSegments/Values.cs @@ -7,7 +7,7 @@ namespace NexusMods.MnemonicDB.Abstractions.IndexSegments; /// /// A subview of an IndexSegment that returns a specific value type /// -public struct Values(IndexSegment segment, int start, int end, Attribute attribute) : +public struct Values(IndexSegment segment, int start, int end, Attribute attribute, AttributeResolver resolver) : IEnumerable, IIndexSegment { /// @@ -18,7 +18,7 @@ public TValueType this[int idx] get { var datom = segment[idx + start]; - return attribute.ReadValue(datom.ValueSpan, datom.Prefix.ValueTag, segment.RegistryId); + return attribute.ReadValue(datom.ValueSpan, datom.Prefix.ValueTag, resolver); } } diff --git a/src/NexusMods.MnemonicDB.Abstractions/Models/ReadOnlyModel.cs b/src/NexusMods.MnemonicDB.Abstractions/Models/ReadOnlyModel.cs index 2514edb5..1e7d0bf5 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/Models/ReadOnlyModel.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/Models/ReadOnlyModel.cs @@ -35,9 +35,10 @@ public ReadOnlyModel(IDb db, EntityId id) public IEnumerator GetEnumerator() { var segment = IndexSegment; + var resolver = Db.Connection.AttributeResolver; for (var i = 0; i < segment.Count; i++) { - yield return segment[i].Resolved; + yield return resolver.Resolve(segment[i]); } } diff --git a/src/NexusMods.MnemonicDB.Abstractions/Query/ObservableDatoms.cs b/src/NexusMods.MnemonicDB.Abstractions/Query/ObservableDatoms.cs index 8c5b33de..e077f2a0 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/Query/ObservableDatoms.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/Query/ObservableDatoms.cs @@ -53,7 +53,7 @@ public static IObservable> ObserveDatoms(this IConne if (idx == 0) return Setup(rev, descriptor); - return Diff(conn.Registry, rev.RecentlyAdded, descriptor); + return Diff(conn.AttributeCache, rev.RecentlyAdded, descriptor); }); } @@ -62,7 +62,7 @@ public static IObservable> ObserveDatoms(this IConne /// public static IObservable> ObserveDatoms(this IConnection conn, EntityId id) { - return conn.ObserveDatoms(SliceDescriptor.Create(id, conn.Registry)); + return conn.ObserveDatoms(SliceDescriptor.Create(id)); } /// @@ -70,8 +70,8 @@ public static IObservable> ObserveDatoms(this IConne /// public static IObservable> ObserveDatoms(this IConnection conn, EntityId id, IAttribute attribute) { - - return conn.Revisions.DelayUntilFirstValue(() => conn.ObserveDatoms(SliceDescriptor.Create(id, attribute.GetDbId(conn.Registry.Id), conn.Registry))); + var aid = conn.AttributeCache.GetAttributeId(attribute.Id); + return conn.Revisions.DelayUntilFirstValue(() => conn.ObserveDatoms(SliceDescriptor.Create(id, aid))); } /// @@ -79,7 +79,7 @@ public static IObservable> ObserveDatoms(this IConne /// public static IObservable> ObserveDatoms(this IConnection conn, ReferenceAttribute attribute, EntityId id) { - return conn.Revisions.DelayUntilFirstValue(() => conn.ObserveDatoms(SliceDescriptor.Create(attribute, id, conn.Registry))); + return conn.Revisions.DelayUntilFirstValue(() => conn.ObserveDatoms(SliceDescriptor.Create(attribute, id, conn.AttributeCache))); } /// @@ -87,7 +87,7 @@ public static IObservable> ObserveDatoms(this IConne /// public static IObservable> ObserveDatoms(this IConnection conn, IAttribute attribute) { - return conn.Revisions.DelayUntilFirstValue(() => conn.ObserveDatoms(SliceDescriptor.Create(attribute, conn.Registry))); + return conn.Revisions.DelayUntilFirstValue(() => conn.ObserveDatoms(SliceDescriptor.Create(attribute, conn.AttributeCache))); } /// @@ -109,24 +109,23 @@ public static IObservable> AsEntityIds(this IObserva }); } - private static IChangeSet Diff(IAttributeRegistry registry, IndexSegment updates, SliceDescriptor descriptor) + private static IChangeSet Diff(AttributeCache cache, IndexSegment updates, SliceDescriptor descriptor) { var changes = new ChangeSet(); AttributeId previousAid = default; - IAttribute attr = default!; - bool isMany = false; + for (int i = 0; i < updates.Count; i++) { var datom = updates[i]; if (!descriptor.Includes(datom)) continue; - UpdateAttrCache(registry, datom.A, ref previousAid, ref attr, ref isMany); + var isMany = cache.IsCardinalityMany(datom.A); + var attr = datom.A; if (datom.IsRetract) { - - + // If the attribute is cardinality many, we can just remove the datom if (isMany) { @@ -166,17 +165,13 @@ private static IChangeSet Diff(IAttributeRegistry registry, Ind private static ChangeSet Setup(IDb db, SliceDescriptor descriptor) { var datoms = db.Datoms(descriptor); - var registry = db.Registry; + var cache = db.AttributeCache; var changes = new ChangeSet(); - AttributeId previousAid = default; - IAttribute attr = default!; - bool isMany = false; - foreach (var datom in datoms) { - UpdateAttrCache(registry, datom.A, ref previousAid, ref attr, ref isMany); - changes.Add(new Change(ChangeReason.Add, CreateKey(datom, attr, isMany), datom)); + var isMany = cache.IsCardinalityMany(datom.A); + changes.Add(new Change(ChangeReason.Add, CreateKey(datom, datom.A, isMany), datom)); } if (changes.Count == 0) @@ -185,9 +180,9 @@ private static ChangeSet Setup(IDb db, SliceDescriptor descript } [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static DatomKey CreateKey(Datom datom, IAttribute attribute, bool isMany = false) + private static DatomKey CreateKey(Datom datom, AttributeId attrId, bool isMany = false) { - return new DatomKey(datom.E, attribute, isMany ? datom.ValueMemory : Memory.Empty); + return new DatomKey(datom.E, attrId, isMany ? datom.ValueMemory : Memory.Empty); } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/src/NexusMods.MnemonicDB.Abstractions/Query/SliceDescriptor.cs b/src/NexusMods.MnemonicDB.Abstractions/Query/SliceDescriptor.cs index 938f338e..6f979d26 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/Query/SliceDescriptor.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/Query/SliceDescriptor.cs @@ -65,65 +65,65 @@ public bool Includes(in Datom datom) /// /// Creates a slice descriptor for the given entity in the current EAVT index /// - public static SliceDescriptor Create(EntityId e, IAttributeRegistry registry) + public static SliceDescriptor Create(EntityId e) { return new SliceDescriptor { Index = IndexType.EAVTCurrent, - From = Datom(e, AttributeId.Min, TxId.MinValue, false, registry), - To = Datom(e, AttributeId.Max, TxId.MaxValue, false, registry) + From = Datom(e, AttributeId.Min, TxId.MinValue, false), + To = Datom(e, AttributeId.Max, TxId.MaxValue, false) }; } /// /// Creates a slice descriptor for the given transaction in the TxLog index /// - public static SliceDescriptor Create(TxId tx, IAttributeRegistry registry) + public static SliceDescriptor Create(TxId tx) { return new SliceDescriptor { Index = IndexType.TxLog, - From = Datom(EntityId.MinValueNoPartition, AttributeId.Min, tx, false, registry), - To = Datom(EntityId.MaxValueNoPartition, AttributeId.Max, tx, false, registry) + From = Datom(EntityId.MinValueNoPartition, AttributeId.Min, tx, false), + To = Datom(EntityId.MaxValueNoPartition, AttributeId.Max, tx, false) }; } /// /// Creates a slice descriptor for the given attribute in the current AVET index /// - public static SliceDescriptor Create(Attribute attr, THighLevel value, IAttributeRegistry registry) + public static SliceDescriptor Create(Attribute attr, THighLevel value, AttributeCache attributeCache) { return new SliceDescriptor { Index = attr.IsReference ? IndexType.VAETCurrent : IndexType.AVETCurrent, - From = Datom(EntityId.MinValueNoPartition, attr, value, TxId.MinValue, false, registry), - To = Datom(EntityId.MaxValueNoPartition, attr, value, TxId.MaxValue, false, registry) + From = Datom(EntityId.MinValueNoPartition, attr, value, TxId.MinValue, false, attributeCache), + To = Datom(EntityId.MaxValueNoPartition, attr, value, TxId.MaxValue, false, attributeCache) }; } /// /// Creates a slice descriptor for the given attribute in the current AVET index for the given range /// - public static SliceDescriptor Create(Attribute attr, THighLevel fromValue, THighLevel toValue, IAttributeRegistry registry) + public static SliceDescriptor Create(Attribute attr, THighLevel fromValue, THighLevel toValue, AttributeCache attributeCache) { return new SliceDescriptor { Index = IndexType.AVETCurrent, - From = Datom(EntityId.MinValueNoPartition, attr, fromValue, TxId.MinValue, false, registry), - To = Datom(EntityId.MaxValueNoPartition, attr, toValue, TxId.MaxValue, false, registry) + From = Datom(EntityId.MinValueNoPartition, attr, fromValue, TxId.MinValue, false, attributeCache), + To = Datom(EntityId.MaxValueNoPartition, attr, toValue, TxId.MaxValue, false, attributeCache) }; } /// /// Creates a slice descriptor for the given reference attribute and entity that is being pointed to. /// - public static SliceDescriptor Create(ReferenceAttribute attr, EntityId value, IAttributeRegistry registry) + public static SliceDescriptor Create(ReferenceAttribute attr, EntityId value, AttributeCache attributeCache) { return new SliceDescriptor { Index = IndexType.VAETCurrent, - From = Datom(EntityId.MinValueNoPartition, attr, value, TxId.MinValue, false, registry), - To = Datom(EntityId.MaxValueNoPartition, attr, value, TxId.MaxValue, false, registry) + From = Datom(EntityId.MinValueNoPartition, attr, value, TxId.MinValue, false, attributeCache), + To = Datom(EntityId.MaxValueNoPartition, attr, value, TxId.MaxValue, false, attributeCache) }; } @@ -131,13 +131,13 @@ public static SliceDescriptor Create(ReferenceAttribute attr, EntityId value, IA /// Creates a slice descriptor for the given reference attribute and entity that is being pointed to, this is a /// reverse lookup. /// - public static SliceDescriptor Create(AttributeId referenceAttribute, EntityId pointingTo, IAttributeRegistry dbRegistry) + public static SliceDescriptor Create(AttributeId referenceAttribute, EntityId pointingTo) { return new SliceDescriptor { Index = IndexType.VAETCurrent, - From = Datom(EntityId.MinValueNoPartition, referenceAttribute, pointingTo, TxId.MinValue, false, dbRegistry), - To = Datom(EntityId.MaxValueNoPartition, referenceAttribute, pointingTo, TxId.MaxValue, false, dbRegistry) + From = Datom(EntityId.MinValueNoPartition, referenceAttribute, pointingTo, TxId.MinValue, false), + To = Datom(EntityId.MaxValueNoPartition, referenceAttribute, pointingTo, TxId.MaxValue, false) }; } @@ -145,13 +145,13 @@ public static SliceDescriptor Create(AttributeId referenceAttribute, EntityId po /// Creates a slice descriptor for the given attribute from the current AEVT index /// reverse lookup. /// - public static SliceDescriptor Create(AttributeId referenceAttribute, IAttributeRegistry dbRegistry) + public static SliceDescriptor Create(AttributeId referenceAttribute) { return new SliceDescriptor { Index = IndexType.AEVTCurrent, - From = Datom(EntityId.MinValueNoPartition, referenceAttribute, TxId.MinValue, false, dbRegistry), - To = Datom(EntityId.MaxValueNoPartition, referenceAttribute, TxId.MaxValue, false, dbRegistry) + From = Datom(EntityId.MinValueNoPartition, referenceAttribute, TxId.MinValue, false), + To = Datom(EntityId.MaxValueNoPartition, referenceAttribute, TxId.MaxValue, false) }; } @@ -159,42 +159,42 @@ public static SliceDescriptor Create(AttributeId referenceAttribute, IAttributeR /// /// Creates a slice descriptor for the given attribute and entity from the EAVT index /// - public static SliceDescriptor Create(EntityId e, AttributeId a, IAttributeRegistry dbRegistry) + public static SliceDescriptor Create(EntityId e, AttributeId a) { return new SliceDescriptor { Index = IndexType.EAVTCurrent, - From = Datom(e, a, TxId.MinValue, false, dbRegistry), - To = Datom(e, AttributeId.From((ushort)(a.Value + 1)), TxId.MaxValue, false, dbRegistry) + From = Datom(e, a, TxId.MinValue, false), + To = Datom(e, AttributeId.From((ushort)(a.Value + 1)), TxId.MaxValue, false) }; } /// /// Creates a slice descriptor that points only to the specific attribute /// - public static SliceDescriptor Create(IndexType index, ReadOnlySpan span, IAttributeRegistry registry) + public static SliceDescriptor Create(IndexType index, ReadOnlySpan span) { var array = span.ToArray(); return new SliceDescriptor { Index = index, - From = new Datom(array, registry), - To = new Datom(array, registry) + From = new Datom(array), + To = new Datom(array) }; } /// /// Creates a slice descriptor for the given exactly from the given index /// - public static SliceDescriptor Exact(IndexType index, ReadOnlySpan span, IAttributeRegistry registry) + public static SliceDescriptor Exact(IndexType index, ReadOnlySpan span) { var from = span.ToArray(); var to = span.ToArray(); return new SliceDescriptor { Index = index, - From = new Datom(from, registry), - To = new Datom(to, registry) + From = new Datom(from), + To = new Datom(to) }; } @@ -202,14 +202,14 @@ public static SliceDescriptor Exact(IndexType index, ReadOnlySpan span, IA /// /// Creates a slice descriptor for the given attribute in the current AEVT index /// - public static SliceDescriptor Create(IAttribute attr, IAttributeRegistry registry) + public static SliceDescriptor Create(IAttribute attr, AttributeCache attributeCache) { - var attrId = attr.GetDbId(registry.Id); + var attrId = attributeCache.GetAttributeId(attr.Id); return new SliceDescriptor { Index = IndexType.AEVTCurrent, - From = Datom(EntityId.MinValueNoPartition, attrId, TxId.MinValue, false, registry), - To = Datom(EntityId.MaxValueNoPartition, attrId, TxId.MaxValue, false, registry) + From = Datom(EntityId.MinValueNoPartition, attrId, TxId.MinValue, false), + To = Datom(EntityId.MaxValueNoPartition, attrId, TxId.MaxValue, false) }; } @@ -217,13 +217,13 @@ public static SliceDescriptor Create(IAttribute attr, IAttributeRegistry registr /// /// Creates a slice descriptor for datoms that reference the given entity via the VAET index /// - public static SliceDescriptor CreateReferenceTo(EntityId pointingTo, IAttributeRegistry dbRegistry) + public static SliceDescriptor CreateReferenceTo(EntityId pointingTo) { return new SliceDescriptor { Index = IndexType.VAETCurrent, - From = Datom(EntityId.MinValueNoPartition, AttributeId.Min, pointingTo, TxId.MinValue, false, dbRegistry), - To = Datom(EntityId.MaxValueNoPartition, AttributeId.Max, pointingTo, TxId.MaxValue, false, dbRegistry) + From = Datom(EntityId.MinValueNoPartition, AttributeId.Min, pointingTo, TxId.MinValue, false), + To = Datom(EntityId.MaxValueNoPartition, AttributeId.Max, pointingTo, TxId.MaxValue, false) }; } @@ -231,7 +231,7 @@ public static SliceDescriptor CreateReferenceTo(EntityId pointingTo, IAttributeR /// /// Creates a slice descriptor for the entire index /// - public static SliceDescriptor Create(IndexType index, IAttributeRegistry registry) + public static SliceDescriptor Create(IndexType index) { if (index is IndexType.VAETCurrent or IndexType.VAETHistory) { @@ -253,8 +253,8 @@ public static SliceDescriptor Create(IndexType index, IAttributeRegistry registr return new SliceDescriptor { Index = index, - From = new Datom(from, registry), - To = new Datom(to, registry) + From = new Datom(from), + To = new Datom(to) }; } else @@ -266,8 +266,8 @@ public static SliceDescriptor Create(IndexType index, IAttributeRegistry registr return new SliceDescriptor { Index = index, - From = new Datom(from, registry), - To = new Datom(to, registry) + From = new Datom(from), + To = new Datom(to) }; } @@ -276,48 +276,46 @@ public static SliceDescriptor Create(IndexType index, IAttributeRegistry registr /// /// Creates a datom with no value from the given parts /// - public static Datom Datom(EntityId e, AttributeId a, TxId id, bool isRetract, IAttributeRegistry registry) + public static Datom Datom(EntityId e, AttributeId a, TxId id, bool isRetract) { - var data = GC.AllocateUninitializedArray(KeyPrefix.Size); - var prefix = new KeyPrefix(e, a, id, isRetract, ValueTags.Null); - MemoryMarshal.Write(data, prefix); - return new Datom(data, registry); + KeyPrefix prefix = new(e, a, id, isRetract, ValueTags.Null); + return new Datom(prefix, ReadOnlyMemory.Empty); } /// /// Creates a with a value from the given attribute and value /// - public static Datom Datom(EntityId e, Attribute a, THighLevel value, TxId tx, bool isRetract, IAttributeRegistry registry) + public static Datom Datom(EntityId e, Attribute a, THighLevel value, TxId tx, bool isRetract, AttributeCache attributeCache) { using var pooled = new PooledMemoryBufferWriter(); - a.Write(e, registry.Id, value, tx, isRetract, pooled); - return new Datom(pooled.WrittenMemory.ToArray(), registry); + a.Write(e, attributeCache, value, tx, isRetract, pooled); + return new Datom(pooled.WrittenMemory.ToArray()); } /// /// Creates a slice descriptor for the given entity range, for the current EAVT index /// - public static SliceDescriptor Create(EntityId from, EntityId to, IAttributeRegistry dbRegistry) + public static SliceDescriptor Create(EntityId from, EntityId to) { return new SliceDescriptor { Index = IndexType.EAVTCurrent, - From = Datom(from, AttributeId.Min, TxId.MinValue, false, dbRegistry), - To = Datom(to, AttributeId.Max, TxId.MaxValue, false, dbRegistry) + From = Datom(from, AttributeId.Min, TxId.MinValue, false), + To = Datom(to, AttributeId.Max, TxId.MaxValue, false) }; } /// /// Creates a datom with no value from the given parts /// - public static Datom Datom(EntityId e, AttributeId a, EntityId value, TxId id, bool isRetract, IAttributeRegistry registry) + public static Datom Datom(EntityId e, AttributeId a, EntityId value, TxId id, bool isRetract) { var data = new Memory(GC.AllocateUninitializedArray(KeyPrefix.Size + sizeof(ulong))); var span = data.Span; var prefix = new KeyPrefix(e, a, id, isRetract, ValueTags.Reference); MemoryMarshal.Write(span, prefix); MemoryMarshal.Write(span.SliceFast(KeyPrefix.Size), value); - return new Datom(data, registry); + return new Datom(data); } } diff --git a/src/NexusMods.MnemonicDB.Abstractions/TxFunctions/ExtensionMethods.cs b/src/NexusMods.MnemonicDB.Abstractions/TxFunctions/ExtensionMethods.cs index b28f2f4a..1a57c7f5 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/TxFunctions/ExtensionMethods.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/TxFunctions/ExtensionMethods.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using NexusMods.MnemonicDB.Abstractions.DatomIterators; using NexusMods.MnemonicDB.Abstractions.IndexSegments; namespace NexusMods.MnemonicDB.Abstractions.TxFunctions; @@ -46,6 +47,7 @@ private static void DeleteRecursive(ITransaction tx, IDb db, EntityId eid) HashSet seen = []; Stack remain = new(); remain.Push(eid); + var cache = db.AttributeCache; while (remain.Count > 0) { @@ -60,16 +62,15 @@ private static void DeleteRecursive(ITransaction tx, IDb db, EntityId eid) if (!seen.Add(reference.E)) continue; - var resolved = reference.Resolved; // If recursive, add it to the list of entities to delete - if (ShouldRecursiveDelete(db, resolved)) + if (ShouldRecursiveDelete(db, cache, reference)) { remain.Push(reference.E); } else { // Otherwise, just delete the reference - resolved.Retract(tx); + tx.Add(reference.Retract()); } } } @@ -79,15 +80,13 @@ private static void DeleteRecursive(ITransaction tx, IDb db, EntityId eid) /// Decide if the entity that contains the given datom should be deleted recursively if this /// datom needs to be removed. /// - private static bool ShouldRecursiveDelete(IDb db, IReadDatom referenceDatom) + private static bool ShouldRecursiveDelete(IDb db, AttributeCache cache, Datom referenceDatom) { // If the reference is not a collection, then we can delete the whole thing as it's a child of this entity - if (referenceDatom.A.Cardinalty != Cardinality.Many) - return true; - // We can get more detailed, but for now we assume that if the reference is a collection, we should not delete it // because it's likely a root of some other system. - return false; + return !cache.IsCardinalityMany(referenceDatom.A); + } private static void DeleteThisOnly(ITransaction tx, IDb db, EntityId eid) diff --git a/src/NexusMods.MnemonicDB.Abstractions/ValueSerializer.cs b/src/NexusMods.MnemonicDB.Abstractions/ValueSerializer.cs index 30d9d240..b5d6fcd6 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/ValueSerializer.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/ValueSerializer.cs @@ -143,12 +143,12 @@ private static void WriteUtf8(string s, TWriter writer) where TWriter : } - public virtual TValueType ReadValue(ReadOnlySpan span, ValueTags tag, RegistryId registryId) + public virtual TValueType ReadValue(ReadOnlySpan span, ValueTags tag, AttributeResolver resolver) { return LowLevelType switch { ValueTags.Null => NullFromLowLevel(), - ValueTags.UInt8 => FromLowLevel(ReadUnmanaged(span, out _), tag, registryId), + ValueTags.UInt8 => FromLowLevel(ReadUnmanaged(span, out _), tag, resolver), ValueTags.UInt16 => FromLowLevel(ReadUnmanaged(span, out _), tag, registryId), ValueTags.UInt32 => FromLowLevel(ReadUnmanaged(span, out _), tag, registryId), ValueTags.UInt64 => FromLowLevel(ReadUnmanaged(span, out _), tag, registryId), @@ -241,11 +241,11 @@ private TValue ReadUnmanaged(ReadOnlySpan span, out int size) /// /// Write a datom for this attribute to the given writer /// - public virtual void Write(EntityId entityId, RegistryId registryId, TValueType value, TxId txId, bool isRetract, TWriter writer) + public virtual void Write(EntityId entityId, AttributeCache cache, TValueType value, TxId txId, bool isRetract, TWriter writer) where TWriter : IBufferWriter { Debug.Assert(LowLevelType != ValueTags.Blob, "Blobs should overwrite this method and throw when ToLowLevel is called"); - var prefix = new KeyPrefix(entityId, GetDbId(registryId), txId, isRetract, LowLevelType); + var prefix = new KeyPrefix(entityId, cache.GetAttributeId(Id), txId, isRetract, LowLevelType); var span = writer.GetSpan(KeyPrefix.Size); MemoryMarshal.Write(span, prefix); writer.Advance(KeyPrefix.Size); diff --git a/src/NexusMods.MnemonicDB/AsOfSnapshot.cs b/src/NexusMods.MnemonicDB/AsOfSnapshot.cs index d757dc6d..8d331639 100644 --- a/src/NexusMods.MnemonicDB/AsOfSnapshot.cs +++ b/src/NexusMods.MnemonicDB/AsOfSnapshot.cs @@ -17,7 +17,7 @@ namespace NexusMods.MnemonicDB; /// id, this requires merging two indexes together, and then the deduplication of the merged index (retractions /// removing assertions). /// -internal class AsOfSnapshot(ISnapshot inner, TxId asOfTxId, AttributeRegistry registry) : ISnapshot +internal class AsOfSnapshot(ISnapshot inner, TxId asOfTxId, AttributeCache attributeCache) : ISnapshot { public IndexSegment Datoms(SliceDescriptor descriptor) { @@ -26,7 +26,7 @@ public IndexSegment Datoms(SliceDescriptor descriptor) var history = inner.Datoms(descriptor with {Index = descriptor.Index.HistoryVariant()}); var comparatorFn = descriptor.Index.GetComparator(); - using var builder = new IndexSegmentBuilder(registry); + using var builder = new IndexSegmentBuilder(attributeCache); var merged = current.Merge(history, (dCurrent, dHistory) => comparatorFn.CompareInstance(dCurrent, dHistory)); @@ -49,7 +49,7 @@ public IEnumerable DatomsChunked(SliceDescriptor descriptor, int c var history = inner.DatomsChunked(descriptor with {Index = descriptor.Index.HistoryVariant()}, chunkSize).SelectMany(c => c); var comparatorFn = descriptor.Index.GetComparator(); - using var builder = new IndexSegmentBuilder(registry); + using var builder = new IndexSegmentBuilder(attributeCache); var merged = current.Merge(history, (dCurrent, dHistory) => comparatorFn.CompareInstance(dCurrent, dHistory)); @@ -109,13 +109,13 @@ public IEnumerable ApplyRetracts(IEnumerable src) continue; } - yield return new Datom(lastDatom.WrittenMemory, registry); + yield return new Datom(lastDatom.WrittenMemory); lastDatom.Reset(); lastDatom.Write(entry); } if (havePrevious) { - yield return new Datom(lastDatom.WrittenMemory, registry); + yield return new Datom(lastDatom.WrittenMemory); } } diff --git a/src/NexusMods.MnemonicDB/Caching/IndexSegmentCache.cs b/src/NexusMods.MnemonicDB/Caching/IndexSegmentCache.cs index 8ac60a4b..03237b4f 100644 --- a/src/NexusMods.MnemonicDB/Caching/IndexSegmentCache.cs +++ b/src/NexusMods.MnemonicDB/Caching/IndexSegmentCache.cs @@ -163,9 +163,9 @@ private ImmutableDictionary PurgeEntries(ImmutableDictionar /// /// Evict cache entries for datoms in the given transaction log. /// - public CacheRoot EvictNew(StoreResult result, IAttributeRegistry registry, out IndexSegment newDatoms) + public CacheRoot EvictNew(StoreResult result, out IndexSegment newDatoms) { - newDatoms = result.Snapshot.Datoms(SliceDescriptor.Create(result.AssignedTxId, registry)); + newDatoms = result.Snapshot.Datoms(SliceDescriptor.Create(result.AssignedTxId)); var editable = _entries.ToBuilder(); foreach (var datom in newDatoms) @@ -221,7 +221,7 @@ public IndexSegment Get(EntityId entityId, IDb db) if (_root.TryGetValue(key, out var segment)) return segment; - segment = db.Snapshot.Datoms(SliceDescriptor.Create(entityId, db.Registry)); + segment = db.Snapshot.Datoms(SliceDescriptor.Create(entityId)); UpdateEntry(key, segment); return segment; } @@ -235,7 +235,7 @@ public IndexSegment GetReverse(AttributeId attributeId, EntityId entityId, IDb d if (_root.TryGetValue(key, out var segment)) return segment; - segment = db.Snapshot.Datoms(SliceDescriptor.Create(attributeId, entityId, db.Registry)); + segment = db.Snapshot.Datoms(SliceDescriptor.Create(attributeId, entityId)); UpdateEntry(key, segment); return segment; } @@ -249,7 +249,7 @@ public IndexSegment GetReferences(EntityId entityId, IDb db) if (_root.TryGetValue(key, out var segment)) return segment; - segment = db.Snapshot.Datoms(SliceDescriptor.CreateReferenceTo(entityId, db.Registry)); + segment = db.Snapshot.Datoms(SliceDescriptor.CreateReferenceTo(entityId)); UpdateEntry(key, segment); return segment; } @@ -257,9 +257,9 @@ public IndexSegment GetReferences(EntityId entityId, IDb db) /// /// Creates a copy of the cache with the given datoms evicted, and the new datoms added. /// - public IndexSegmentCache ForkAndEvict(StoreResult result, IAttributeRegistry registry, out IndexSegment newDatoms) + public IndexSegmentCache ForkAndEvict(StoreResult result, AttributeCache attributeCache, out IndexSegment newDatoms) { - var newRoot = _root.EvictNew(result, registry, out newDatoms); + var newRoot = _root.EvictNew(result, out newDatoms); return new IndexSegmentCache { _root = newRoot }; } diff --git a/src/NexusMods.MnemonicDB/Connection.cs b/src/NexusMods.MnemonicDB/Connection.cs index 8413ace4..47395458 100644 --- a/src/NexusMods.MnemonicDB/Connection.cs +++ b/src/NexusMods.MnemonicDB/Connection.cs @@ -37,6 +37,8 @@ public class Connection : IConnection public Connection(ILogger logger, IDatomStore store, IServiceProvider provider, IEnumerable declaredAttributes, IEnumerable analyzers) { ServiceProvider = provider; + AttributeCache = store.AttributeCache; + AttributeResolver = new AttributeResolver(); _logger = logger; _declaredAttributes = declaredAttributes.ToDictionary(a => a.Id); _store = store; @@ -99,7 +101,10 @@ public IDb Db } /// - public IAttributeRegistry Registry => _store.Registry; + public AttributeResolver AttributeResolver { get; } + + /// + public AttributeCache AttributeCache { get; } private static void ThrowNullDb() { @@ -113,7 +118,7 @@ private static void ThrowNullDb() /// public IDb AsOf(TxId txId) { - var snapshot = new AsOfSnapshot(_store.GetSnapshot(), txId, (AttributeRegistry)_store.Registry); + var snapshot = new AsOfSnapshot(_store.GetSnapshot(), txId, ); return new Db(snapshot, txId, (AttributeRegistry)_store.Registry) { Connection = this @@ -123,7 +128,7 @@ public IDb AsOf(TxId txId) /// public ITransaction BeginTransaction() { - return new Transaction(this, _store.Registry); + return new Transaction(this); } /// diff --git a/src/NexusMods.MnemonicDB/Db.cs b/src/NexusMods.MnemonicDB/Db.cs index 11b94ff1..2b7a82c0 100644 --- a/src/NexusMods.MnemonicDB/Db.cs +++ b/src/NexusMods.MnemonicDB/Db.cs @@ -16,7 +16,6 @@ namespace NexusMods.MnemonicDB; internal class Db : IDb { - private readonly AttributeRegistry _registry; private readonly IndexSegmentCache _cache; private readonly RegistryId _registryId; @@ -27,26 +26,25 @@ internal class Db : IDb /// private IConnection? _connection; public ISnapshot Snapshot { get; } - public IAttributeRegistry Registry => _registry; + public AttributeCache AttributeCache { get; } public IndexSegment RecentlyAdded { get; } internal Dictionary AnalyzerData { get; } = new(); - public Db(ISnapshot snapshot, TxId txId, AttributeRegistry registry) + public Db(ISnapshot snapshot, TxId txId, AttributeCache attributeCache) { Debug.Assert(snapshot != null, $"{nameof(snapshot)} cannot be null"); - _registryId = registry.Id; - _registry = registry; + AttributeCache = attributeCache; _cache = new IndexSegmentCache(); Snapshot = snapshot; BasisTxId = txId; - RecentlyAdded = snapshot.Datoms(SliceDescriptor.Create(txId, registry)); + RecentlyAdded = snapshot.Datoms(SliceDescriptor.Create(txId)); } - private Db(ISnapshot snapshot, TxId txId, AttributeRegistry registry, RegistryId registryId, IConnection connection, IndexSegmentCache newCache, IndexSegment recentlyAdded) + private Db(ISnapshot snapshot, TxId txId, AttributeCache attributeCache, RegistryId registryId, IConnection connection, IndexSegmentCache newCache, IndexSegment recentlyAdded) { - _registry = registry; + AttributeCache = attributeCache; _registryId = registryId; _cache = newCache; _connection = connection; @@ -61,8 +59,8 @@ private Db(ISnapshot snapshot, TxId txId, AttributeRegistry registry, RegistryId /// internal Db WithNext(StoreResult storeResult, TxId txId) { - var newCache = _cache.ForkAndEvict(storeResult, _registry, out var newDatoms); - return new Db(storeResult.Snapshot, txId, _registry, _registryId, _connection!, newCache, newDatoms); + var newCache = _cache.ForkAndEvict(storeResult, AttributeCache, out var newDatoms); + return new Db(storeResult.Snapshot, txId, AttributeCache, _registryId, _connection!, newCache, newDatoms); } private IndexSegment EntityDatoms(IDb db, EntityId id) @@ -72,7 +70,7 @@ private IndexSegment EntityDatoms(IDb db, EntityId id) private static IndexSegment ReverseDatoms(IDb db, (EntityId, AttributeId) key) { - return db.Snapshot.Datoms(SliceDescriptor.Create(key.Item2, key.Item1, db.Registry)); + return db.Snapshot.Datoms(SliceDescriptor.Create(key.Item2, key.Item1)); } public TxId BasisTxId { get; } @@ -119,12 +117,12 @@ TReturn IDb.AnalyzerData() public IndexSegment Datoms(Attribute attribute, TValue value) { - return Datoms(SliceDescriptor.Create(attribute, value, _registry)); + return Datoms(SliceDescriptor.Create(attribute, value, AttributeCache)); } public IndexSegment Datoms(ReferenceAttribute attribute, EntityId value) { - return Datoms(SliceDescriptor.Create(attribute, value, _registry)); + return Datoms(SliceDescriptor.Create(attribute, value, AttributeCache)); } public IndexSegment Datoms(EntityId entityId) @@ -134,7 +132,7 @@ public IndexSegment Datoms(EntityId entityId) public IndexSegment Datoms(IAttribute attribute) { - return Snapshot.Datoms(SliceDescriptor.Create(attribute, _registry)); + return Snapshot.Datoms(SliceDescriptor.Create(attribute, AttributeCache)); } public IndexSegment Datoms(SliceDescriptor sliceDescriptor) @@ -144,7 +142,7 @@ public IndexSegment Datoms(SliceDescriptor sliceDescriptor) public IndexSegment Datoms(TxId txId) { - return Snapshot.Datoms(SliceDescriptor.Create(txId, _registry)); + return Snapshot.Datoms(SliceDescriptor.Create(txId)); } public bool Equals(IDb? other) diff --git a/src/NexusMods.MnemonicDB/Storage/DatomStore.cs b/src/NexusMods.MnemonicDB/Storage/DatomStore.cs index 7026cc62..e49bde66 100644 --- a/src/NexusMods.MnemonicDB/Storage/DatomStore.cs +++ b/src/NexusMods.MnemonicDB/Storage/DatomStore.cs @@ -34,7 +34,7 @@ public class DatomStore : IDatomStore private readonly IIndex _eavtHistory; private readonly ILogger _logger; private readonly PooledMemoryBufferWriter _retractWriter; - private readonly AttributeRegistry _registry; + private readonly AttributeCache _attributeCache; private readonly DatomStoreSettings _settings; private readonly BlockingCollection _pendingTransactions; @@ -67,7 +67,7 @@ public class DatomStore : IDatomStore /// /// DI constructor /// - public DatomStore(ILogger logger, AttributeRegistry registry, DatomStoreSettings settings, + public DatomStore(ILogger logger, AttributeCache attributeCache, DatomStoreSettings settings, IStoreBackend backend) { _pendingTransactions = new BlockingCollection(new ConcurrentQueue()); @@ -80,7 +80,7 @@ public DatomStore(ILogger logger, AttributeRegistry registry, DatomS _logger = logger; _settings = settings; - _registry = registry; + _attributeCache = attributeCache; _backend.DeclareEAVT(IndexType.EAVTCurrent); _backend.DeclareEAVT(IndexType.EAVTHistory); @@ -103,18 +103,13 @@ public DatomStore(ILogger logger, AttributeRegistry registry, DatomS _vaetHistory = _backend.GetIndex(IndexType.VAETHistory); _avetCurrent = _backend.GetIndex(IndexType.AVETCurrent); _avetHistory = _backend.GetIndex(IndexType.AVETHistory); - - registry.Populate(AttributeDefinition.HardcodedDbAttributes); - + Bootstrap(); } /// public TxId AsOfTxId => _asOfTx; - - /// - public IAttributeRegistry Registry => _registry; - + /// public async Task<(StoreResult, IDb)> TransactAsync(IndexSegment datoms, HashSet? txFunctions = null) { @@ -171,16 +166,16 @@ public Observable TxLog /// public void RegisterAttributes(IEnumerable newAttrs) { - var datoms = new IndexSegmentBuilder(_registry); + var datoms = new IndexSegmentBuilder(_attributeCache); var newAttrsArray = newAttrs.ToArray(); var internalTx = new InternalTransaction(null!, datoms); foreach (var attribute in newAttrsArray) AttributeDefinition.Insert(internalTx, attribute.Attribute, attribute.AttrEntityId.Value); internalTx.ProcessTemporaryEntities(); - Transact(datoms.Build()); - - _registry.Populate(newAttrsArray); + var (result, idb) = Transact(datoms.Build()); + + _attributeCache.Reset(idb); } /// @@ -270,12 +265,12 @@ private void Bootstrap() try { var snapshot = _backend.GetSnapshot(); - var lastTx = TxId.From(_nextIdCache.LastEntityInPartition(snapshot, PartitionId.Transactions, _registry).Value); + var lastTx = TxId.From(_nextIdCache.LastEntityInPartition(snapshot, PartitionId.Transactions, _attributeCache).Value); if (lastTx.Value == TxId.MinValue) { _logger.LogInformation("Bootstrapping the datom store no existing state found"); - using var builder = new IndexSegmentBuilder(_registry); + using var builder = new IndexSegmentBuilder(_attributeCache); var internalTx = new InternalTransaction(null!, builder); AttributeDefinition.AddInitial(internalTx); internalTx.ProcessTemporaryEntities(); @@ -302,7 +297,7 @@ private void Bootstrap() throw; } - _currentDb = new Db(_currentSnapshot, _asOfTx, _registry); + _currentDb = new Db(_currentSnapshot, _asOfTx, _attributeCache); _updatesSubject = new BehaviorSubject(_currentDb); _loggerThread = new Thread(ConsumeTransactions) { @@ -329,7 +324,7 @@ private EntityId MaybeRemap(ISnapshot snapshot, EntityId id, Dictionary> 40 & 0xFF)); - var assignedId = _nextIdCache.NextId(snapshot, partitionId, _registry); + var assignedId = _nextIdCache.NextId(snapshot, partitionId, _attributeCache); remaps.Add(id, assignedId); return assignedId; } @@ -345,7 +340,7 @@ private EntityId MaybeRemap(ISnapshot snapshot, EntityId id, Dictionary(); var remapFn = (Func)(id => MaybeRemap(currentSnapshot, id, remaps, thisTx)); @@ -355,7 +350,7 @@ private void Log(PendingTransaction pendingTransaction, out StoreResult result) - var secondaryBuilder = new IndexSegmentBuilder(_registry); + var secondaryBuilder = new IndexSegmentBuilder(_attributeCache); var txId = EntityId.From(thisTx.Value); secondaryBuilder.Add(txId, MnemonicDB.Abstractions.BuiltInEntities.Transaction.Timestamp, DateTime.UtcNow); @@ -385,9 +380,9 @@ private void Log(PendingTransaction pendingTransaction, out StoreResult result) _writer.Reset(); var isRemapped = datom.E.InPartition(PartitionId.Temp); - var attr = _registry.GetAttribute(datom.A); var currentPrefix = datom.Prefix; + var attrId = currentPrefix.A; var newE = isRemapped ? remapFn(currentPrefix.E) : currentPrefix.E; var keyPrefix = currentPrefix with {E = newE, T = thisTx}; @@ -405,7 +400,7 @@ private void Log(PendingTransaction pendingTransaction, out StoreResult result) if (keyPrefix.IsRetract) { - ProcessRetract(batch, attr, newSpan, currentSnapshot); + ProcessRetract(batch, attrId, newSpan, currentSnapshot); continue; } @@ -459,7 +454,7 @@ private void SwitchPrevToRetraction(TxId thisTx) MemoryMarshal.Write(_retractWriter.GetWrittenSpanWritable(), prevKey); } - private void ProcessRetract(IWriteBatch batch, IAttribute attribute, ReadOnlySpan datom, ISnapshot iterator) + private void ProcessRetract(IWriteBatch batch, AttributeId attrId, ReadOnlySpan datom, ISnapshot iterator) { _prevWriter.Reset(); _prevWriter.Write(datom); @@ -468,11 +463,11 @@ private void ProcessRetract(IWriteBatch batch, IAttribute attribute, ReadOnlySpa prevKey = prevKey with {T = TxId.MinValue, IsRetract = false}; MemoryMarshal.Write(_prevWriter.GetWrittenSpanWritable(), prevKey); - var low = new Datom(_prevWriter.GetWrittenSpan().ToArray(), Registry); + var low = new Datom(_prevWriter.GetWrittenSpan().ToArray()); prevKey = prevKey with {T = TxId.MaxValue, IsRetract = false}; MemoryMarshal.Write(_prevWriter.GetWrittenSpanWritable(), prevKey); - var high = new Datom(_prevWriter.GetWrittenSpan().ToArray(), Registry); + var high = new Datom(_prevWriter.GetWrittenSpan().ToArray()); var sliceDescriptor = new SliceDescriptor { @@ -507,13 +502,14 @@ private void ProcessRetract(IWriteBatch batch, IAttribute attribute, ReadOnlySpa _eavtCurrent.Delete(batch, prevDatom); _aevtCurrent.Delete(batch, prevDatom); - if (attribute.IsReference) + if (_attributeCache.IsReference(attrId)) _vaetCurrent.Delete(batch, prevDatom); - if (attribute.IsIndexed) + if (_attributeCache.IsIndexed(attrId)) _avetCurrent.Delete(batch, prevDatom); _txLog.Put(batch, datom); - if (attribute.NoHistory) return; + if (_attributeCache.IsNoHistory(attrId)) + return; // Move the datom to the history index and also record the retraction _eavtHistory.Put(batch, prevDatom); @@ -523,13 +519,13 @@ private void ProcessRetract(IWriteBatch batch, IAttribute attribute, ReadOnlySpa _aevtHistory.Put(batch, prevDatom); _aevtHistory.Put(batch, datom); - if (attribute.IsReference) + if (_attributeCache.IsReference(attrId)) { _vaetHistory.Put(batch, prevDatom); _vaetHistory.Put(batch, datom); } - if (attribute.IsIndexed) + if (_attributeCache.IsIndexed(attrId)) { _avetHistory.Put(batch, prevDatom); _avetHistory.Put(batch, datom); @@ -554,15 +550,15 @@ enum PrevState Duplicate } - private unsafe PrevState GetPreviousState(bool isRemapped, IAttribute attribute, ISnapshot snapshot, ReadOnlySpan span) + private unsafe PrevState GetPreviousState(bool isRemapped, AttributeId attrId, ISnapshot snapshot, ReadOnlySpan span) { if (isRemapped) return PrevState.NotExists; var keyPrefix = MemoryMarshal.Read(span); - if (attribute.Cardinalty == Cardinality.Many) + if (_attributeCache.IsCardinalityMany(attrId)) { - var sliceDescriptor = SliceDescriptor.Exact(IndexType.EAVTCurrent, span, _registry); + var sliceDescriptor = SliceDescriptor.Exact(IndexType.EAVTCurrent, span); var found = snapshot.Datoms(sliceDescriptor) .FirstOrDefault(); if (!found.Valid) return PrevState.NotExists; @@ -581,7 +577,7 @@ private unsafe PrevState GetPreviousState(bool isRemapped, IAttribute attribute, else { - var descriptor = SliceDescriptor.Create(keyPrefix.E, keyPrefix.A, _registry); + var descriptor = SliceDescriptor.Create(keyPrefix.E, keyPrefix.A); var datom = snapshot.Datoms(descriptor) .FirstOrDefault(); diff --git a/src/NexusMods.MnemonicDB/Storage/InMemoryBackend/Backend.cs b/src/NexusMods.MnemonicDB/Storage/InMemoryBackend/Backend.cs index 7c69bbf1..fbf6cc7d 100644 --- a/src/NexusMods.MnemonicDB/Storage/InMemoryBackend/Backend.cs +++ b/src/NexusMods.MnemonicDB/Storage/InMemoryBackend/Backend.cs @@ -14,12 +14,12 @@ public class Backend : IStoreBackend { private readonly IIndex[] _indexes; - private readonly AttributeRegistry _registry; + private readonly AttributeCache _attributeCache; private readonly IndexStore[] _stores; - public Backend(AttributeRegistry registry) + public Backend(AttributeCache attributeCache) { - _registry = registry; + _attributeCache = attributeCache; _stores = new IndexStore[Enum.GetValues().Select(i => (int)i).Max() + 1]; _indexes = new IIndex[Enum.GetValues().Select(i => (int)i).Max() + 1]; } @@ -34,7 +34,7 @@ public void Init(AbsolutePath location) { } public void DeclareIndex(IndexType name) where TComparator : IDatomComparator { - var store = new IndexStore(name, _registry); + var store = new IndexStore(name); _stores[(int)name] = store; var index = new Index(store); store.Init(index); @@ -50,7 +50,7 @@ public ISnapshot GetSnapshot() { return new Snapshot(_indexes .Select(i => i == null ? ImmutableSortedSet.Empty : ((IInMemoryIndex)i).Set).ToArray(), - _registry); + _attributeCache); } public void Dispose() { } diff --git a/src/NexusMods.MnemonicDB/Storage/InMemoryBackend/IndexStore.cs b/src/NexusMods.MnemonicDB/Storage/InMemoryBackend/IndexStore.cs index 2ea6238c..28762c0a 100644 --- a/src/NexusMods.MnemonicDB/Storage/InMemoryBackend/IndexStore.cs +++ b/src/NexusMods.MnemonicDB/Storage/InMemoryBackend/IndexStore.cs @@ -8,11 +8,9 @@ namespace NexusMods.MnemonicDB.Storage.InMemoryBackend; public class IndexStore : IIndexStore { - private readonly AttributeRegistry _registry; - public IndexStore(IndexType type, AttributeRegistry registry) + public IndexStore(IndexType type) { - _registry = registry; Type = type; Set = ImmutableSortedSet.Empty; } diff --git a/src/NexusMods.MnemonicDB/Storage/InMemoryBackend/Snapshot.cs b/src/NexusMods.MnemonicDB/Storage/InMemoryBackend/Snapshot.cs index 7657b7d1..0ab686b6 100644 --- a/src/NexusMods.MnemonicDB/Storage/InMemoryBackend/Snapshot.cs +++ b/src/NexusMods.MnemonicDB/Storage/InMemoryBackend/Snapshot.cs @@ -10,11 +10,11 @@ namespace NexusMods.MnemonicDB.Storage.InMemoryBackend; public class Snapshot : ISnapshot { private readonly ImmutableSortedSet[] _indexes; - private readonly AttributeRegistry _registry; + private readonly AttributeCache _attributeCache; - public Snapshot(ImmutableSortedSet[] indexes, AttributeRegistry registry) + public Snapshot(ImmutableSortedSet[] indexes, AttributeCache attributeCache) { - _registry = registry; + _attributeCache = attributeCache; _indexes = indexes; } @@ -54,7 +54,7 @@ public IndexSegment Datoms(SliceDescriptor descriptor) (lowerExact, upperExact) = (upperExact, lowerExact); } - using var segmentBuilder = new IndexSegmentBuilder(_registry); + using var segmentBuilder = new IndexSegmentBuilder(_attributeCache); if (descriptor.IsReverse) { @@ -101,7 +101,7 @@ public IEnumerable DatomsChunked(SliceDescriptor descriptor, int c reverse = true; } - using var segmentBuilder = new IndexSegmentBuilder(_registry); + using var segmentBuilder = new IndexSegmentBuilder(_attributeCache); var index = _indexes[(int)descriptor.Index]; if (!reverse) diff --git a/src/NexusMods.MnemonicDB/Storage/NextIdCache.cs b/src/NexusMods.MnemonicDB/Storage/NextIdCache.cs index 0dd42ca1..fb21f4e3 100644 --- a/src/NexusMods.MnemonicDB/Storage/NextIdCache.cs +++ b/src/NexusMods.MnemonicDB/Storage/NextIdCache.cs @@ -22,12 +22,12 @@ public struct NextIdCache /// /// Gets the next id for the given partition /// - public EntityId NextId(ISnapshot snapshot, PartitionId partitionId, IAttributeRegistry registry) + public EntityId NextId(ISnapshot snapshot, PartitionId partitionId) { var partition = partitionId.Value; if (this[partition] == 0) { - var lastEnt = LastEntityInPartition(snapshot, partitionId, registry); + var lastEnt = LastEntityInPartition(snapshot, partitionId); this[partition] = lastEnt.Value; } @@ -38,7 +38,7 @@ public EntityId NextId(ISnapshot snapshot, PartitionId partitionId, IAttributeRe /// /// Gets the last recorded entity in the partition in the snapshot /// - public EntityId LastEntityInPartition(ISnapshot snapshot, PartitionId partitionId, IAttributeRegistry registry) + public EntityId LastEntityInPartition(ISnapshot snapshot, PartitionId partitionId) { var partition = partitionId.Value; if (this[partition] != 0) @@ -46,7 +46,7 @@ public EntityId LastEntityInPartition(ISnapshot snapshot, PartitionId partitionI return partitionId.MakeEntityId(this[partition]); } - var descriptor = SliceDescriptor.Create(partitionId.MakeEntityId(ulong.MaxValue), partitionId.MakeEntityId(0), registry); + var descriptor = SliceDescriptor.Create(partitionId.MakeEntityId(ulong.MaxValue), partitionId.MakeEntityId(0)); var lastEnt = snapshot.DatomsChunked(descriptor, 1) .SelectMany(c => c) diff --git a/src/NexusMods.MnemonicDB/Storage/RocksDbBackend/Backend.cs b/src/NexusMods.MnemonicDB/Storage/RocksDbBackend/Backend.cs index 5f91a6d9..1918cadf 100644 --- a/src/NexusMods.MnemonicDB/Storage/RocksDbBackend/Backend.cs +++ b/src/NexusMods.MnemonicDB/Storage/RocksDbBackend/Backend.cs @@ -8,7 +8,7 @@ namespace NexusMods.MnemonicDB.Storage.RocksDbBackend; -public class Backend(AttributeRegistry registry) : IStoreBackend +public class Backend(AttributeCache attributeCache) : IStoreBackend { private readonly ColumnFamilies _columnFamilies = new(); private readonly Dictionary _indexes = new(); @@ -37,7 +37,7 @@ public IIndex GetIndex(IndexType name) public ISnapshot GetSnapshot() { - return new Snapshot(this, registry); + return new Snapshot(this, attributeCache); } public void Init(AbsolutePath location) diff --git a/src/NexusMods.MnemonicDB/Storage/RocksDbBackend/Snapshot.cs b/src/NexusMods.MnemonicDB/Storage/RocksDbBackend/Snapshot.cs index 592ebbb5..5cffc67b 100644 --- a/src/NexusMods.MnemonicDB/Storage/RocksDbBackend/Snapshot.cs +++ b/src/NexusMods.MnemonicDB/Storage/RocksDbBackend/Snapshot.cs @@ -8,7 +8,7 @@ namespace NexusMods.MnemonicDB.Storage.RocksDbBackend; -internal class Snapshot(Backend backend, AttributeRegistry registry) : ISnapshot +internal class Snapshot(Backend backend, AttributeCache registry) : ISnapshot { private readonly RocksDbSharp.Snapshot _snapshot = backend.Db!.CreateSnapshot(); diff --git a/src/NexusMods.MnemonicDB/Transaction.cs b/src/NexusMods.MnemonicDB/Transaction.cs index a0c27edf..29725eae 100644 --- a/src/NexusMods.MnemonicDB/Transaction.cs +++ b/src/NexusMods.MnemonicDB/Transaction.cs @@ -14,9 +14,9 @@ namespace NexusMods.MnemonicDB; /// -internal class Transaction(Connection connection, IAttributeRegistry registry) : ITransaction +internal class Transaction(Connection connection) : ITransaction { - private readonly IndexSegmentBuilder _datoms = new(registry); + private readonly IndexSegmentBuilder _datoms = new(connection.AttributeCache); private HashSet? _txFunctions; // No reason to create the hashset if we don't need it private List? _tempEntities; private ulong _tempId = PartitionId.Temp.MakeEntityId(1).Value; From 6c5c5e8e11038881b370db1c30b882266493e3c1 Mon Sep 17 00:00:00 2001 From: halgari Date: Wed, 18 Sep 2024 21:27:17 -0600 Subject: [PATCH 2/9] Most of the core is updated --- .../Attribute.cs | 9 +- .../Attributes/BlobAttribute.cs | 4 +- .../Attributes/CollectionAttribute.cs | 12 +- .../Attributes/HashedBlobAttribute.cs | 4 +- .../Attributes/MarkerAttribute.cs | 2 +- .../Attributes/ReferenceAttribute.cs | 2 +- .../Attributes/ReferencesAttribute.cs | 2 +- .../Attributes/ScalarAttribute.cs | 12 +- .../Attributes/StringAttribute.cs | 2 +- .../Attributes/SymbolAttribute.cs | 2 +- .../Attributes/TimestampAttribute.cs | 2 +- .../Attributes/TupleAttribute.cs | 14 +- .../Attributes/UnknownAttribute.cs | 166 ------------------ .../Attributes/ValuesTagAttribute.cs | 2 +- .../IDatomStore.cs | 4 +- .../Internals/IAttributeRegistry.cs | 58 ------ .../ValueSerializer.cs | 41 ++--- src/NexusMods.MnemonicDB/Connection.cs | 9 +- src/NexusMods.MnemonicDB/IndexSegmentCache.cs | 29 --- src/NexusMods.MnemonicDB/Services.cs | 1 - .../Storage/AttributeRegistry.cs | 104 ----------- .../Storage/DatomStore.cs | 58 +++--- 22 files changed, 94 insertions(+), 445 deletions(-) delete mode 100644 src/NexusMods.MnemonicDB.Abstractions/Attributes/UnknownAttribute.cs delete mode 100644 src/NexusMods.MnemonicDB.Abstractions/Internals/IAttributeRegistry.cs delete mode 100644 src/NexusMods.MnemonicDB/IndexSegmentCache.cs delete mode 100644 src/NexusMods.MnemonicDB/Storage/AttributeRegistry.cs diff --git a/src/NexusMods.MnemonicDB.Abstractions/Attribute.cs b/src/NexusMods.MnemonicDB.Abstractions/Attribute.cs index 018db0c6..4dbab7d8 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/Attribute.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/Attribute.cs @@ -292,17 +292,10 @@ public override string ToString() /// protected IServiceProvider GetServiceProvider(RegistryId registryId) { + throw new NotImplementedException(); return AttributeRegistryRegistry.Registries[registryId.Value]!.ServiceProvider; } - /// - /// Gets the registry for the given registry id - /// - protected IAttributeRegistry GetRegistry(RegistryId registryId) - { - return AttributeRegistryRegistry.Registries[registryId.Value]!; - } - /// /// Typed datom for this attribute /// diff --git a/src/NexusMods.MnemonicDB.Abstractions/Attributes/BlobAttribute.cs b/src/NexusMods.MnemonicDB.Abstractions/Attributes/BlobAttribute.cs index cc4e232b..0727c84a 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/Attributes/BlobAttribute.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/Attributes/BlobAttribute.cs @@ -13,9 +13,9 @@ public abstract class BlobAttribute(string ns, string name) : ScalarAttr where TValue : notnull { /// - public override void Write(EntityId entityId, RegistryId registryId, TValue value, TxId txId, bool isRetract, TWriter writer) + public override void Write(EntityId entityId, AttributeCache cache, TValue value, TxId txId, bool isRetract, TWriter writer) { - WritePrefix(entityId, registryId, txId, isRetract, writer); + WritePrefix(entityId, cache, txId, isRetract, writer); WriteValue(value, writer); } diff --git a/src/NexusMods.MnemonicDB.Abstractions/Attributes/CollectionAttribute.cs b/src/NexusMods.MnemonicDB.Abstractions/Attributes/CollectionAttribute.cs index 8d14f9dd..8a7c1e85 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/Attributes/CollectionAttribute.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/Attributes/CollectionAttribute.cs @@ -19,7 +19,7 @@ public abstract class CollectionAttribute(ValueTags tag, stri public Values Get(IHasIdAndIndexSegment ent) { var segment = ent.IndexSegment; - var dbId = Cache[segment.RegistryId.Value]; + var dbId = ent.Db.AttributeCache.GetAttributeId(Id); for (var i = 0; i < segment.Count; i++) { var datom = segment[i]; @@ -30,9 +30,9 @@ public Values Get(IHasIdAndIndexSegment ent) { i++; } - return new Values(segment, start, i, this); + return new Values(segment, start, i, this, ent.Db.Connection.AttributeResolver); } - return new Values(segment, 0, 0, this); + return new Values(segment, 0, 0, this, ent.Db.Connection.AttributeResolver); } /// @@ -42,7 +42,7 @@ public Values Get(IHasIdAndIndexSegment ent) protected Values Get(IHasEntityIdAndDb ent) { var segment = ent.Db.Get(ent.Id); - var dbId = Cache[segment.RegistryId.Value]; + var dbId = ent.Db.AttributeCache.GetAttributeId(Id); for (var i = 0; i < segment.Count; i++) { var datom = segment[i]; @@ -53,9 +53,9 @@ protected Values Get(IHasEntityIdAndDb ent) { i++; } - return new Values(segment, start, i, this); + return new Values(segment, start, i, this, ent.Db.Connection.AttributeResolver); } - return new Values(segment, 0, 0, this); + return new Values(segment, 0, 0, this, ent.Db.Connection.AttributeResolver); } /// diff --git a/src/NexusMods.MnemonicDB.Abstractions/Attributes/HashedBlobAttribute.cs b/src/NexusMods.MnemonicDB.Abstractions/Attributes/HashedBlobAttribute.cs index 8aece139..4612c3a5 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/Attributes/HashedBlobAttribute.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/Attributes/HashedBlobAttribute.cs @@ -10,10 +10,10 @@ namespace NexusMods.MnemonicDB.Abstractions.Attributes; public abstract class HashedBlobAttribute(string ns, string name) : ScalarAttribute(ValueTags.HashedBlob, ns, name) where TValue : notnull { - public override void Write(EntityId entityId, RegistryId registryId, TValue value, TxId txId, bool isRetract, TWriter writer) + public override void Write(EntityId entityId, AttributeCache attributeCache, TValue value, TxId txId, bool isRetract, TWriter writer) { using var innerWriter = new PooledMemoryBufferWriter(); - WritePrefix(entityId, registryId, txId, isRetract, writer); + WritePrefix(entityId, attributeCache, txId, isRetract, writer); WriteValue(value, innerWriter); var valueSpan = innerWriter.GetWrittenSpan(); diff --git a/src/NexusMods.MnemonicDB.Abstractions/Attributes/MarkerAttribute.cs b/src/NexusMods.MnemonicDB.Abstractions/Attributes/MarkerAttribute.cs index 1d03b8ec..4a733349 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/Attributes/MarkerAttribute.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/Attributes/MarkerAttribute.cs @@ -23,7 +23,7 @@ protected override Null ToLowLevel(Null value) public bool Contains(IHasIdAndIndexSegment entity) { var segment = entity.IndexSegment; - var dbId = Cache[segment.RegistryId.Value]; + var dbId = entity.Db.Connection.AttributeCache.GetAttributeId(Id); for (var i = 0; i < segment.Count; i++) { var datom = segment[i]; diff --git a/src/NexusMods.MnemonicDB.Abstractions/Attributes/ReferenceAttribute.cs b/src/NexusMods.MnemonicDB.Abstractions/Attributes/ReferenceAttribute.cs index 8a4590af..76851254 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/Attributes/ReferenceAttribute.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/Attributes/ReferenceAttribute.cs @@ -12,7 +12,7 @@ public class ReferenceAttribute(string ns, string name) : ScalarAttribute value.Value; /// - protected override EntityId FromLowLevel(ulong lowLevelType, ValueTags tags, RegistryId registryId) + protected override EntityId FromLowLevel(ulong lowLevelType, ValueTags tags, AttributeResolver resolver) => EntityId.From(lowLevelType); } diff --git a/src/NexusMods.MnemonicDB.Abstractions/Attributes/ReferencesAttribute.cs b/src/NexusMods.MnemonicDB.Abstractions/Attributes/ReferencesAttribute.cs index 79bc5401..518397e8 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/Attributes/ReferencesAttribute.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/Attributes/ReferencesAttribute.cs @@ -12,7 +12,7 @@ public class ReferencesAttribute(string ns, string name) : CollectionAttribute value.Value; /// - protected override EntityId FromLowLevel(ulong value, ValueTags tags, RegistryId registryId) + protected override EntityId FromLowLevel(ulong value, ValueTags tags, AttributeResolver resolver) => EntityId.From(value); } diff --git a/src/NexusMods.MnemonicDB.Abstractions/Attributes/ScalarAttribute.cs b/src/NexusMods.MnemonicDB.Abstractions/Attributes/ScalarAttribute.cs index 4ff7afbe..b78b84f9 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/Attributes/ScalarAttribute.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/Attributes/ScalarAttribute.cs @@ -26,12 +26,12 @@ public bool IsOptional public TValue Get(IHasIdAndIndexSegment entity) { var segment = entity.IndexSegment; - var dbId = Cache[segment.RegistryId.Value]; + var dbId = entity.Db.AttributeCache.GetAttributeId(Id); for (var i = 0; i < segment.Count; i++) { var datom = segment[i]; if (datom.A != dbId) continue; - return ReadValue(datom.ValueSpan, datom.Prefix.ValueTag, segment.RegistryId); + return ReadValue(datom.ValueSpan, datom.Prefix.ValueTag, entity.Db.Connection.AttributeResolver); } if (DefaultValue.HasValue) @@ -48,12 +48,12 @@ public TValue Get(IHasIdAndIndexSegment entity) protected TValue Get(IHasEntityIdAndDb entity) { var segment = entity.Db.Get(entity.Id); - var dbId = Cache[segment.RegistryId.Value]; + var dbId = entity.Db.AttributeCache.GetAttributeId(Id); for (var i = 0; i < segment.Count; i++) { var datom = segment[i]; if (datom.A != dbId) continue; - return ReadValue(datom.ValueSpan, datom.Prefix.ValueTag, segment.RegistryId); + return ReadValue(datom.ValueSpan, datom.Prefix.ValueTag, entity.Db.Connection.AttributeResolver); } if (DefaultValue.HasValue) @@ -82,12 +82,12 @@ private void ThrowKeyNotfoundException(IHasEntityIdAndDb entity) public bool TryGet(IHasIdAndIndexSegment entity, out TValue value) { var segment = entity.IndexSegment; - var dbId = Cache[segment.RegistryId.Value]; + var dbId = entity.Db.AttributeCache.GetAttributeId(Id); for (var i = 0; i < segment.Count; i++) { var datom = segment[i]; if (datom.A != dbId) continue; - value = ReadValue(datom.ValueSpan, datom.Prefix.ValueTag, segment.RegistryId); + value = ReadValue(datom.ValueSpan, datom.Prefix.ValueTag, entity.Db.Connection.AttributeResolver); return true; } diff --git a/src/NexusMods.MnemonicDB.Abstractions/Attributes/StringAttribute.cs b/src/NexusMods.MnemonicDB.Abstractions/Attributes/StringAttribute.cs index 27e631d4..39f4c3e5 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/Attributes/StringAttribute.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/Attributes/StringAttribute.cs @@ -11,6 +11,6 @@ public class StringAttribute(string ns, string name) : ScalarAttribute value; /// - protected override string FromLowLevel(string lowLevelType, ValueTags tags, RegistryId registryId) + protected override string FromLowLevel(string lowLevelType, ValueTags tags, AttributeResolver resolver) => lowLevelType; } diff --git a/src/NexusMods.MnemonicDB.Abstractions/Attributes/SymbolAttribute.cs b/src/NexusMods.MnemonicDB.Abstractions/Attributes/SymbolAttribute.cs index c4f0ebee..5dc02ea0 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/Attributes/SymbolAttribute.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/Attributes/SymbolAttribute.cs @@ -11,7 +11,7 @@ public class SymbolAttribute(string ns, string name) : ScalarAttribute value.Id; /// - protected override Symbol FromLowLevel(string value, ValueTags tags, RegistryId registryId) + protected override Symbol FromLowLevel(string value, ValueTags tags, AttributeResolver resolver) => Symbol.InternPreSanitized(value); } diff --git a/src/NexusMods.MnemonicDB.Abstractions/Attributes/TimestampAttribute.cs b/src/NexusMods.MnemonicDB.Abstractions/Attributes/TimestampAttribute.cs index bb8a96d0..65c3f8d5 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/Attributes/TimestampAttribute.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/Attributes/TimestampAttribute.cs @@ -13,7 +13,7 @@ public class TimestampAttribute(string ns, string name) : ScalarAttribute value.ToFileTimeUtc(); /// - protected override DateTime FromLowLevel(long value, ValueTags tags, RegistryId registryId) + protected override DateTime FromLowLevel(long value, ValueTags tags, AttributeResolver resolver) { return DateTime.FromFileTimeUtc(value); } diff --git a/src/NexusMods.MnemonicDB.Abstractions/Attributes/TupleAttribute.cs b/src/NexusMods.MnemonicDB.Abstractions/Attributes/TupleAttribute.cs index df6d9408..c58b7c2b 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/Attributes/TupleAttribute.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/Attributes/TupleAttribute.cs @@ -22,7 +22,7 @@ public TupleAttribute(ValueTags tag1, ValueTags tag2, string ns, string name) : } /// - public override (T1HighLevel, T2HighLevel) ReadValue(ReadOnlySpan span, ValueTags tag, RegistryId registryId) + public override (T1HighLevel, T2HighLevel) ReadValue(ReadOnlySpan span, ValueTags tag, AttributeResolver resolver) { if (tag != ValueTags.Tuple2) throw new ArgumentException($"Expected tag {ValueTags.Tuple2}, but got {tag}"); @@ -33,8 +33,8 @@ public override (T1HighLevel, T2HighLevel) ReadValue(ReadOnlySpan span, Va if (type1 != (byte)_tag1 || type2 != (byte)_tag2) throw new ArgumentException($"Expected tag {_tag1} and {_tag2}, but got {type1} and {type2}"); - var valA = ReadValue(span.SliceFast(2), _tag1, registryId, out var sizeA); - var valB = ReadValue(span.SliceFast(2 + sizeA), _tag2, registryId, out _); + var valA = ReadValue(span.SliceFast(2), _tag1, resolver, out var sizeA); + var valB = ReadValue(span.SliceFast(2 + sizeA), _tag2, resolver, out _); return FromLowLevel((valA, valB)); } @@ -98,7 +98,7 @@ public TupleAttribute(ValueTags tag1, ValueTags tag2, ValueTags tag3, string ns, } /// - public override (T1HighLevel, T2HighLevel, T3HighLevel) ReadValue(ReadOnlySpan span, ValueTags tag, RegistryId registryId) + public override (T1HighLevel, T2HighLevel, T3HighLevel) ReadValue(ReadOnlySpan span, ValueTags tag, AttributeResolver resolver) { if (tag != ValueTags.Tuple3) throw new ArgumentException($"Expected tag {ValueTags.Tuple3}, but got {tag}"); @@ -110,9 +110,9 @@ public override (T1HighLevel, T2HighLevel, T3HighLevel) ReadValue(ReadOnlySpan(span.SliceFast(3), _tag1, registryId, out var sizeA); - var valB = ReadValue(span.SliceFast(3 + sizeA), _tag2, registryId, out var sizeB); - var valC = ReadValue(span.SliceFast(3 + sizeA + sizeB), _tag3, registryId, out _); + var valA = ReadValue(span.SliceFast(3), _tag1, resolver, out var sizeA); + var valB = ReadValue(span.SliceFast(3 + sizeA), _tag2, resolver, out var sizeB); + var valC = ReadValue(span.SliceFast(3 + sizeA + sizeB), _tag3, resolver, out _); return FromLowLevel((valA, valB, valC)); } diff --git a/src/NexusMods.MnemonicDB.Abstractions/Attributes/UnknownAttribute.cs b/src/NexusMods.MnemonicDB.Abstractions/Attributes/UnknownAttribute.cs deleted file mode 100644 index e47b8082..00000000 --- a/src/NexusMods.MnemonicDB.Abstractions/Attributes/UnknownAttribute.cs +++ /dev/null @@ -1,166 +0,0 @@ -using System; -using NexusMods.MnemonicDB.Abstractions.ElementComparers; - -namespace NexusMods.MnemonicDB.Abstractions.Attributes; - -/// -/// An unknown attribute is an attribute that exists in the database but is not known to the application. This is -/// either because the attribute was removed, or didn't show up in the DI system. -/// -/// -/// -public class UnknownAttribute(DbAttribute dbAttribute) : - Attribute(dbAttribute.LowLevelType, dbAttribute.UniqueId.Namespace, dbAttribute.UniqueId.Name) -{ - /// - protected override TLowLevel ToLowLevel(TLowLevel value) - { - return value; - } - - /// - protected override TLowLevel FromLowLevel(byte value, ValueTags tags, RegistryId registryId) - { - if (tags != LowLevelType) - { - throw new ArgumentException($"Cannot convert {tags} to {LowLevelType}"); - } - - return (TLowLevel)(object)value; - } - - /// - protected override TLowLevel FromLowLevel(ushort value, ValueTags tags, RegistryId registryId) - { - if (tags != LowLevelType) - { - throw new ArgumentException($"Cannot convert {tags} to {LowLevelType}"); - } - - return (TLowLevel)(object)value; - } - - /// - protected override TLowLevel FromLowLevel(uint value, ValueTags tags, RegistryId registryId) - { - if (tags != LowLevelType) - { - throw new ArgumentException($"Cannot convert {tags} to {LowLevelType}"); - } - - return (TLowLevel)(object)value; - } - - - /// - protected override TLowLevel FromLowLevel(ulong value, ValueTags tags, RegistryId registryId) - { - if (tags != LowLevelType) - { - throw new ArgumentException($"Cannot convert {tags} to {LowLevelType}"); - } - - return (TLowLevel)(object)value; - } - - /// - protected override TLowLevel FromLowLevel(short value, ValueTags tags, RegistryId registryId) - { - if (tags != LowLevelType) - { - throw new ArgumentException($"Cannot convert {tags} to {LowLevelType}"); - } - - return (TLowLevel)(object)value; - } - - /// - protected override TLowLevel FromLowLevel(int value, ValueTags tags, RegistryId registryId) - { - if (tags != LowLevelType) - { - throw new ArgumentException($"Cannot convert {tags} to {LowLevelType}"); - } - - return (TLowLevel)(object)value; - } - - /// - protected override TLowLevel FromLowLevel(long value, ValueTags tags, RegistryId registryId) - { - if (tags != LowLevelType) - { - throw new ArgumentException($"Cannot convert {tags} to {LowLevelType}"); - } - - return (TLowLevel)(object)value; - } - - /// - protected override TLowLevel FromLowLevel(float value, ValueTags tags, RegistryId registryId) - { - if (tags != LowLevelType) - { - throw new ArgumentException($"Cannot convert {tags} to {LowLevelType}"); - } - - return (TLowLevel)(object)value; - } - - /// - protected override TLowLevel FromLowLevel(double value, ValueTags tags, RegistryId registryId) - { - if (tags != LowLevelType) - { - throw new ArgumentException($"Cannot convert {tags} to {LowLevelType}"); - } - - return (TLowLevel)(object)value; - } - - /// - protected override TLowLevel FromLowLevel(string value, ValueTags tags, RegistryId registryId) - { - if (tags != LowLevelType) - { - throw new ArgumentException($"Cannot convert {tags} to {LowLevelType}"); - } - - return (TLowLevel)(object)value; - } -} - -/// -/// Helper class to create unknown attributes -/// -public static class UnknownAttribute -{ - /// - /// Creates an unknown attribute from a database attribute - /// - public static IAttribute Create(DbAttribute dbAttribute) - { - return dbAttribute.LowLevelType switch - { - ValueTags.Null => new UnknownAttribute(dbAttribute), - ValueTags.UInt8 => new UnknownAttribute(dbAttribute), - ValueTags.UInt16 => new UnknownAttribute(dbAttribute), - ValueTags.UInt32 => new UnknownAttribute(dbAttribute), - ValueTags.UInt64 => new UnknownAttribute(dbAttribute), - ValueTags.UInt128 => new UnknownAttribute(dbAttribute), - ValueTags.Int16 => new UnknownAttribute(dbAttribute), - ValueTags.Int32 => new UnknownAttribute(dbAttribute), - ValueTags.Int64 => new UnknownAttribute(dbAttribute), - ValueTags.Int128 => new UnknownAttribute(dbAttribute), - ValueTags.Float32 => new UnknownAttribute(dbAttribute), - ValueTags.Float64 => new UnknownAttribute(dbAttribute), - ValueTags.Ascii => new UnknownAttribute(dbAttribute), - ValueTags.Utf8 => new UnknownAttribute(dbAttribute), - ValueTags.Utf8Insensitive => new UnknownAttribute(dbAttribute), - ValueTags.Blob => new UnknownAttribute(dbAttribute), - ValueTags.HashedBlob => new UnknownAttribute(dbAttribute), - ValueTags.Reference => new UnknownAttribute(dbAttribute), - _ => throw new ArgumentOutOfRangeException(nameof(dbAttribute.LowLevelType), dbAttribute.LowLevelType, null) - }; - } -} diff --git a/src/NexusMods.MnemonicDB.Abstractions/Attributes/ValuesTagAttribute.cs b/src/NexusMods.MnemonicDB.Abstractions/Attributes/ValuesTagAttribute.cs index a13391af..a9c9e762 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/Attributes/ValuesTagAttribute.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/Attributes/ValuesTagAttribute.cs @@ -11,6 +11,6 @@ public class ValuesTagAttribute(string ns, string name) : ScalarAttribute (byte)value; /// - protected override ValueTags FromLowLevel(byte lowLevelType, ValueTags tags, RegistryId registryId) + protected override ValueTags FromLowLevel(byte lowLevelType, ValueTags tags, AttributeResolver resolver) => (ValueTags)lowLevelType; } diff --git a/src/NexusMods.MnemonicDB.Abstractions/IDatomStore.cs b/src/NexusMods.MnemonicDB.Abstractions/IDatomStore.cs index 50671c9a..cc8c2c51 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/IDatomStore.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/IDatomStore.cs @@ -25,9 +25,9 @@ public interface IDatomStore : IDisposable public TxId AsOfTxId { get; } /// - /// The Attribute Registry for this store + /// The Attribute Cache the store is using. /// - AttributeCache Registry { get; } + AttributeCache AttributeCache { get; } /// /// Transacts (adds) the given datoms into the store. diff --git a/src/NexusMods.MnemonicDB.Abstractions/Internals/IAttributeRegistry.cs b/src/NexusMods.MnemonicDB.Abstractions/Internals/IAttributeRegistry.cs deleted file mode 100644 index bb01c5ef..00000000 --- a/src/NexusMods.MnemonicDB.Abstractions/Internals/IAttributeRegistry.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Buffers; -using System.Collections.Generic; - -namespace NexusMods.MnemonicDB.Abstractions.Internals; - -/// -/// A registry of attributes and serializers that supports operations that requires converting -/// between the database IDs, the code-level attributes and the native values -/// -public interface IAttributeRegistry -{ - /// - /// Resolve the given KeyPrefix + Value into a datom - /// - /// - /// - public IReadDatom Resolve(in KeyPrefix prefix, ReadOnlySpan datom); - - - /// - /// Resolve the given attribute id into an attribute - /// - public IAttribute GetAttribute(AttributeId attributeId); - - /// - /// Populates the registry with the given attributes, mostly used for - /// internal registration of attributes - /// - /// - public void Populate(IEnumerable attributes); - - /// - /// The registry id of the registry, this can be used to link attributes to attribute ids. - /// A separate registry id is used for each registry instance and backing datom store. - /// - public RegistryId Id { get; } - - /// - /// This is used by various attributes who need a service provider specific to a registry - /// - public IServiceProvider ServiceProvider { get; } -} - -/// -/// No it's not a AbstractSingletonProxyFactoryBean, it's registry of attribute registries -/// -public static class AttributeRegistryRegistry -{ - /// - /// All the registries currently active for this program, noramlly this is only one, but during tests, database - /// migrations or the like, there may be more than one. This is used so that we can pass around a very small number - /// (A byte) to reference the correct registry, as well as globally look up all the registries. Writing to this - /// collection should never be done outside of the AttributeRegistry class. Reading can be done by anyone who has a - /// valid registry id. - /// - public static readonly IAttributeRegistry?[] Registries = new IAttributeRegistry[8]; -} diff --git a/src/NexusMods.MnemonicDB.Abstractions/ValueSerializer.cs b/src/NexusMods.MnemonicDB.Abstractions/ValueSerializer.cs index b5d6fcd6..b0107e67 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/ValueSerializer.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/ValueSerializer.cs @@ -149,22 +149,22 @@ public virtual TValueType ReadValue(ReadOnlySpan span, ValueTags tag, Attr { ValueTags.Null => NullFromLowLevel(), ValueTags.UInt8 => FromLowLevel(ReadUnmanaged(span, out _), tag, resolver), - ValueTags.UInt16 => FromLowLevel(ReadUnmanaged(span, out _), tag, registryId), - ValueTags.UInt32 => FromLowLevel(ReadUnmanaged(span, out _), tag, registryId), - ValueTags.UInt64 => FromLowLevel(ReadUnmanaged(span, out _), tag, registryId), - ValueTags.UInt128 => FromLowLevel(ReadUnmanaged(span, out _), tag, registryId), - ValueTags.Int16 => FromLowLevel(ReadUnmanaged(span, out _), tag, registryId), - ValueTags.Int32 => FromLowLevel(ReadUnmanaged(span, out _), tag, registryId), - ValueTags.Int64 => FromLowLevel(ReadUnmanaged(span, out _), tag, registryId), - ValueTags.Int128 => FromLowLevel(ReadUnmanaged(span, out _), tag, registryId), - ValueTags.Float32 => FromLowLevel(ReadUnmanaged(span, out _), tag, registryId), - ValueTags.Float64 => FromLowLevel(ReadUnmanaged(span, out _), tag, registryId), - ValueTags.Reference => FromLowLevel(ReadUnmanaged(span, out _), tag, registryId), - ValueTags.Ascii => FromLowLevel(ReadAscii(span, out _), tag, registryId), - ValueTags.Utf8 => FromLowLevel(ReadUtf8(span, out _), tag, registryId), - ValueTags.Utf8Insensitive => FromLowLevel(ReadUtf8(span, out _), tag, registryId), - ValueTags.Blob => FromLowLevel(span, tag, registryId), - ValueTags.HashedBlob => FromLowLevel(span.SliceFast(sizeof(ulong)), tag, registryId), + ValueTags.UInt16 => FromLowLevel(ReadUnmanaged(span, out _), tag, resolver), + ValueTags.UInt32 => FromLowLevel(ReadUnmanaged(span, out _), tag, resolver), + ValueTags.UInt64 => FromLowLevel(ReadUnmanaged(span, out _), tag, resolver), + ValueTags.UInt128 => FromLowLevel(ReadUnmanaged(span, out _), tag, resolver), + ValueTags.Int16 => FromLowLevel(ReadUnmanaged(span, out _), tag, resolver), + ValueTags.Int32 => FromLowLevel(ReadUnmanaged(span, out _), tag, resolver), + ValueTags.Int64 => FromLowLevel(ReadUnmanaged(span, out _), tag, resolver), + ValueTags.Int128 => FromLowLevel(ReadUnmanaged(span, out _), tag, resolver), + ValueTags.Float32 => FromLowLevel(ReadUnmanaged(span, out _), tag, resolver), + ValueTags.Float64 => FromLowLevel(ReadUnmanaged(span, out _), tag, resolver), + ValueTags.Reference => FromLowLevel(ReadUnmanaged(span, out _), tag, resolver), + ValueTags.Ascii => FromLowLevel(ReadAscii(span, out _), tag, resolver), + ValueTags.Utf8 => FromLowLevel(ReadUtf8(span, out _), tag, resolver), + ValueTags.Utf8Insensitive => FromLowLevel(ReadUtf8(span, out _), tag, resolver), + ValueTags.Blob => FromLowLevel(span, tag, resolver), + ValueTags.HashedBlob => FromLowLevel(span.SliceFast(sizeof(ulong)), tag, resolver), _ => throw new UnsupportedLowLevelReadType(tag) }; } @@ -172,7 +172,7 @@ public virtual TValueType ReadValue(ReadOnlySpan span, ValueTags tag, Attr /// /// Reads a low-level value of a specific type from the given span /// - protected TLowLevel ReadValue(ReadOnlySpan span, ValueTags tag, RegistryId registryId, out int size) + protected TLowLevel ReadValue(ReadOnlySpan span, ValueTags tag, AttributeResolver resolver, out int size) { size = sizeof(ulong); return tag switch @@ -193,7 +193,7 @@ protected TLowLevel ReadValue(ReadOnlySpan span, ValueTags tag, ValueTags.Ascii => (TLowLevel)(object)ReadAscii(span, out size), ValueTags.Utf8 => (TLowLevel)(object)ReadUtf8(span, out size), ValueTags.Utf8Insensitive => (TLowLevel)(object)ReadUtf8(span, out size), - ValueTags.Blob => (TLowLevel)(object)FromLowLevel(span, tag, registryId)!, + ValueTags.Blob => (TLowLevel)(object)FromLowLevel(span, tag, resolver)!, ValueTags.HashedBlob => (TLowLevel)(object)span.SliceFast(sizeof(ulong)).ToArray(), _ => throw new UnsupportedLowLevelReadType(tag), }; @@ -255,10 +255,11 @@ public virtual void Write(EntityId entityId, AttributeCache cache, TVal /// /// Write the key prefix for this attribute to the given writer /// - protected void WritePrefix(EntityId entityId, RegistryId registryId, TxId txId, bool isRetract, TWriter writer) + protected void WritePrefix(EntityId entityId, AttributeCache attributeCache, TxId txId, bool isRetract, TWriter writer) where TWriter : IBufferWriter { - var prefix = new KeyPrefix(entityId, GetDbId(registryId), txId, isRetract, LowLevelType); + var dbId = attributeCache.GetAttributeId(Id); + var prefix = new KeyPrefix(entityId, dbId, txId, isRetract, LowLevelType); var span = writer.GetSpan(KeyPrefix.Size); MemoryMarshal.Write(span, prefix); writer.Advance(KeyPrefix.Size); diff --git a/src/NexusMods.MnemonicDB/Connection.cs b/src/NexusMods.MnemonicDB/Connection.cs index 47395458..5f957ab0 100644 --- a/src/NexusMods.MnemonicDB/Connection.cs +++ b/src/NexusMods.MnemonicDB/Connection.cs @@ -118,8 +118,8 @@ private static void ThrowNullDb() /// public IDb AsOf(TxId txId) { - var snapshot = new AsOfSnapshot(_store.GetSnapshot(), txId, ); - return new Db(snapshot, txId, (AttributeRegistry)_store.Registry) + var snapshot = new AsOfSnapshot(_store.GetSnapshot(), txId, AttributeCache); + return new Db(snapshot, txId, AttributeCache) { Connection = this }; @@ -156,7 +156,8 @@ private void AddMissingAttributes(IEnumerable declaredAttributes) if (missing.Length == 0) { // Nothing new to assert, so just add the new data to the registry - _store.Registry.Populate(existing.Values.ToArray()); + throw new NotImplementedException(); + //_store.Registry.Populate(existing.Values.ToArray()); } var newAttrs = new List(); @@ -175,7 +176,7 @@ private void AddMissingAttributes(IEnumerable declaredAttributes) private IEnumerable ExistingAttributes() { - var db = new Db(_store.GetSnapshot(), TxId, (AttributeRegistry)_store.Registry) + var db = new Db(_store.GetSnapshot(), TxId, AttributeCache) { Connection = this }; diff --git a/src/NexusMods.MnemonicDB/IndexSegmentCache.cs b/src/NexusMods.MnemonicDB/IndexSegmentCache.cs deleted file mode 100644 index ccb985c2..00000000 --- a/src/NexusMods.MnemonicDB/IndexSegmentCache.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using NexusMods.MnemonicDB.Abstractions; -using NexusMods.MnemonicDB.Abstractions.DatomIterators; -using NexusMods.MnemonicDB.Abstractions.IndexSegments; -using NexusMods.MnemonicDB.Abstractions.Internals; - -namespace NexusMods.MnemonicDB; - -/// -/// A cache for index segments, given a key type and a iterator factory, caches the results -/// of the factory in a segment for fast access. -/// -internal readonly struct IndexSegmentCache(Func segmentFactory, IAttributeRegistry registry) - where TKey : notnull -{ - private readonly ConcurrentDictionary _cache = new(); - - public IndexSegment Get(IDb snapshot, TKey key) - { - if (_cache.TryGetValue(key, out var segment)) - return segment; - - var newSegment = segmentFactory(snapshot, key); - _cache.TryAdd(key, newSegment); - return newSegment; - } -} diff --git a/src/NexusMods.MnemonicDB/Services.cs b/src/NexusMods.MnemonicDB/Services.cs index 6cd24d20..e0863104 100644 --- a/src/NexusMods.MnemonicDB/Services.cs +++ b/src/NexusMods.MnemonicDB/Services.cs @@ -30,7 +30,6 @@ public static IServiceCollection AddMnemonicDBStorage(this IServiceCollection se { services.AddAttributeDefinitionModel() .AddTransactionModel() - .AddSingleton() .AddSingleton() .AddSingleton(s => (DatomStore)s.GetRequiredService()); return services; diff --git a/src/NexusMods.MnemonicDB/Storage/AttributeRegistry.cs b/src/NexusMods.MnemonicDB/Storage/AttributeRegistry.cs deleted file mode 100644 index 202f944b..00000000 --- a/src/NexusMods.MnemonicDB/Storage/AttributeRegistry.cs +++ /dev/null @@ -1,104 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using NexusMods.MnemonicDB.Abstractions; -using NexusMods.MnemonicDB.Abstractions.Attributes; -using NexusMods.MnemonicDB.Abstractions.Internals; - -namespace NexusMods.MnemonicDB.Storage; - -/// -/// Tracks all attributes and their respective serializers as well as the DB entity IDs for each -/// attribute -/// -public class AttributeRegistry : IAttributeRegistry, IDisposable -{ - - private static RegistryId GetRegistryId(AttributeRegistry registry) - { - var registries = AttributeRegistryRegistry.Registries; - lock (registries) - { - for (var i = 0; i < registries.Length; i++) - { - if (registries[i] != null) continue; - - registries[i] = registry; - return RegistryId.From((byte)i); - } - } - - throw new IndexOutOfRangeException("Too many attribute registries created"); - } - - private readonly Dictionary _attributesBySymbol = new (); - private AttributeArray _attributes; - - /// - /// We will likely only ever have one of these per program, we're overallocating this - /// to sizeof(ref) * 64K but that's probably fine in exchange for the speedup we get for - /// this - /// - [InlineArray(ushort.MaxValue)] - private struct AttributeArray - { - private IAttribute _attribute; - } - - - /// - /// Tracks all attributes and their respective serializers as well as the DB entity IDs for each - /// attribute - /// - public AttributeRegistry(IServiceProvider provider, IEnumerable attributes) - { - Id = GetRegistryId(this); - ServiceProvider = provider; - _attributesBySymbol = attributes.ToDictionary(a => a.Id); - } - - /// - public RegistryId Id { get; } - - /// - public IServiceProvider ServiceProvider { get; } - - /// - public IReadDatom Resolve(in KeyPrefix prefix, ReadOnlySpan valueSpan) - { - var attr = _attributes[prefix.A.Value]; - return attr.Resolve(prefix, valueSpan, Id); - } - - /// - public void Populate(IEnumerable attributes) - { - foreach (var dbAttribute in attributes) - { - // Do a try/get here because an attribute may not exist in code that exists in the database - if (!_attributesBySymbol.TryGetValue(dbAttribute.UniqueId, out var instance)) - { - instance = UnknownAttribute.Create(dbAttribute); - _attributesBySymbol[dbAttribute.UniqueId] = instance; - } - - instance.SetDbId(Id, dbAttribute.AttrEntityId); - _attributes[dbAttribute.AttrEntityId.Value] = instance; - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public IAttribute GetAttribute(AttributeId attributeId) - { - var attr = _attributes[attributeId.Value]; - if (attr == null) - throw new InvalidOperationException($"No attribute found for attribute ID {attributeId}, did you forget to register it?"); - return attr; - } - - public void Dispose() - { - AttributeRegistryRegistry.Registries[Id.Value] = null!; - } -} diff --git a/src/NexusMods.MnemonicDB/Storage/DatomStore.cs b/src/NexusMods.MnemonicDB/Storage/DatomStore.cs index e49bde66..d3cd9b26 100644 --- a/src/NexusMods.MnemonicDB/Storage/DatomStore.cs +++ b/src/NexusMods.MnemonicDB/Storage/DatomStore.cs @@ -51,6 +51,11 @@ public class DatomStore : IDatomStore private IDb? _currentDb = null; private static readonly TimeSpan TransactionTimeout = TimeSpan.FromMinutes(120); + + /// + /// Used to remap temporary entity ids to real entity ids, this is cleared after each transaction + /// + private Dictionary _remaps = new(); /// /// Cache for the next entity/tx/attribute ids @@ -109,7 +114,10 @@ public DatomStore(ILogger logger, AttributeCache attributeCache, Dat /// public TxId AsOfTxId => _asOfTx; - + + /// + public AttributeCache AttributeCache => _attributeCache; + /// public async Task<(StoreResult, IDb)> TransactAsync(IndexSegment datoms, HashSet? txFunctions = null) { @@ -265,7 +273,7 @@ private void Bootstrap() try { var snapshot = _backend.GetSnapshot(); - var lastTx = TxId.From(_nextIdCache.LastEntityInPartition(snapshot, PartitionId.Transactions, _attributeCache).Value); + var lastTx = TxId.From(_nextIdCache.LastEntityInPartition(snapshot, PartitionId.Transactions).Value); if (lastTx.Value == TxId.MinValue) { @@ -309,23 +317,23 @@ private void Bootstrap() #region Internals - private EntityId MaybeRemap(ISnapshot snapshot, EntityId id, Dictionary remaps, TxId thisTx) + private EntityId Remap(ISnapshot snapshot, EntityId id, TxId thisTx) { if (id.Partition == PartitionId.Temp) { - if (!remaps.TryGetValue(id, out var newId)) + if (!_remaps.TryGetValue(id, out var newId)) { if (id.Value == PartitionId.Temp.MinValue) { var remapTo = EntityId.From(thisTx.Value); - remaps.Add(id, remapTo); + _remaps.Add(id, remapTo); return remapTo; } else { var partitionId = PartitionId.From((byte)(id.Value >> 40 & 0xFF)); - var assignedId = _nextIdCache.NextId(snapshot, partitionId, _attributeCache); - remaps.Add(id, assignedId); + var assignedId = _nextIdCache.NextId(snapshot, partitionId); + _remaps.Add(id, assignedId); return assignedId; } } @@ -340,16 +348,15 @@ private EntityId MaybeRemap(ISnapshot snapshot, EntityId id, Dictionary(); - var remapFn = (Func)(id => MaybeRemap(currentSnapshot, id, remaps, thisTx)); + _remaps.Clear(); + var thisTx = TxId.From(_nextIdCache.NextId(currentSnapshot, PartitionId.Transactions).Value); + using var batch = _backend.CreateBatch(); var swPrepare = Stopwatch.StartNew(); - - + _remaps = new Dictionary(); + var secondaryBuilder = new IndexSegmentBuilder(_attributeCache); var txId = EntityId.From(thisTx.Value); secondaryBuilder.Add(txId, MnemonicDB.Abstractions.BuiltInEntities.Transaction.Timestamp, DateTime.UtcNow); @@ -384,7 +391,7 @@ private void Log(PendingTransaction pendingTransaction, out StoreResult result) var currentPrefix = datom.Prefix; var attrId = currentPrefix.A; - var newE = isRemapped ? remapFn(currentPrefix.E) : currentPrefix.E; + var newE = isRemapped ? Remap(currentPrefix.E) : currentPrefix.E; var keyPrefix = currentPrefix with {E = newE, T = thisTx}; { @@ -392,7 +399,7 @@ private void Log(PendingTransaction pendingTransaction, out StoreResult result) var valueSpan = datom.ValueSpan; var span = _writer.GetSpan(valueSpan.Length); valueSpan.CopyTo(span); - attr.Remap(remapFn, span); + Remap(span); _writer.Advance(valueSpan.Length); } @@ -404,17 +411,17 @@ private void Log(PendingTransaction pendingTransaction, out StoreResult result) continue; } - switch (GetPreviousState(isRemapped, attr, currentSnapshot, newSpan)) + switch (GetPreviousState(isRemapped, attrId, currentSnapshot, newSpan)) { case PrevState.Duplicate: continue; case PrevState.NotExists: - ProcessAssert(batch, attr, newSpan); + ProcessAssert(batch, attrId, newSpan); break; case PrevState.Exists: SwitchPrevToRetraction(thisTx); - ProcessRetract(batch, attr, _retractWriter.GetWrittenSpan(), currentSnapshot); - ProcessAssert(batch, attr, newSpan); + ProcessRetract(batch, attrId, _retractWriter.GetWrittenSpan(), currentSnapshot); + ProcessAssert(batch, attrId, newSpan); break; } @@ -437,10 +444,15 @@ private void Log(PendingTransaction pendingTransaction, out StoreResult result) result = new StoreResult { AssignedTxId = thisTx, - Remaps = remaps, + Remaps = _remaps, Snapshot = _currentSnapshot }; } + + private void Remap(Span valueSpan) + { + + } /// /// Updates the data in _prevWriter to be a retraction of the data in that write. @@ -532,14 +544,14 @@ private void ProcessRetract(IWriteBatch batch, AttributeId attrId, ReadOnlySpan< } } - private void ProcessAssert(IWriteBatch batch, IAttribute attribute, ReadOnlySpan datom) + private void ProcessAssert(IWriteBatch batch, AttributeId attributeId, ReadOnlySpan datom) { _txLog.Put(batch, datom); _eavtCurrent.Put(batch, datom); _aevtCurrent.Put(batch, datom); - if (attribute.IsReference) + if (_attributeCache.IsReference(attributeId)) _vaetCurrent.Put(batch, datom); - if (attribute.IsIndexed) + if (_attributeCache.IsIndexed(attributeId)) _avetCurrent.Put(batch, datom); } From d6ce0314b96d360c310e0d6975fd1c03539a10af Mon Sep 17 00:00:00 2001 From: halgari Date: Wed, 18 Sep 2024 22:08:53 -0600 Subject: [PATCH 3/9] Compiles, still fixing tests --- .../Benchmarks/IndexSegmentABenchmarks.cs | 6 +- .../Benchmarks/IndexSegmentEBenchmarks.cs | 4 +- .../Attribute.cs | 2 +- .../AttributeCache.cs | 43 +++++++++++++-- .../AttributeResolver.cs | 6 ++ .../Query/ObservableDatoms.cs | 10 ---- .../Template.weave | 3 +- .../Storage/DatomStore.cs | 2 +- .../ABackendTest.cs | 46 ++++++++-------- .../AStorageTest.cs | 13 +++-- .../NullConnection.cs | 3 +- .../Startup.cs | 1 - .../TestAttributes/Blobs.cs | 4 +- .../Analyzers/AttributesAnalyzer.cs | 9 ++- .../Attributes/AbsolutePathAttribute.cs | 4 +- .../Attributes/HashAttribute.cs | 3 +- .../Attributes/RelativePathAttribute.cs | 2 +- .../Attributes/SizeAttribute.cs | 2 +- .../Attributes/StringsAttribute.cs | 2 +- .../Attributes/UriAttribute.cs | 2 +- .../Helpers/ExtensionMethods.cs | 55 +++++++++---------- .../AMnemonicDBTest.cs | 21 ++++--- 22 files changed, 137 insertions(+), 106 deletions(-) diff --git a/benchmarks/NexusMods.MnemonicDB.Benchmarks/Benchmarks/IndexSegmentABenchmarks.cs b/benchmarks/NexusMods.MnemonicDB.Benchmarks/Benchmarks/IndexSegmentABenchmarks.cs index c08975cc..b3f97641 100644 --- a/benchmarks/NexusMods.MnemonicDB.Benchmarks/Benchmarks/IndexSegmentABenchmarks.cs +++ b/benchmarks/NexusMods.MnemonicDB.Benchmarks/Benchmarks/IndexSegmentABenchmarks.cs @@ -15,14 +15,14 @@ public class IndexSegmentABenchmarks public IndexSegmentABenchmarks() { - var registry = new AttributeRegistry(null!, []); - using var builder = new IndexSegmentBuilder(registry); + var cache = new AttributeCache(); + using var builder = new IndexSegmentBuilder(cache); for (int a = 1; a < 100; a++) { var prefix = new KeyPrefix(EntityId.From(42), AttributeId.From((ushort)a), TxId.From(42), false, ValueTags.Null); - builder.Add(new Datom(prefix, ReadOnlyMemory.Empty, registry)); + builder.Add(new Datom(prefix, ReadOnlyMemory.Empty)); } _index = builder.Build(); diff --git a/benchmarks/NexusMods.MnemonicDB.Benchmarks/Benchmarks/IndexSegmentEBenchmarks.cs b/benchmarks/NexusMods.MnemonicDB.Benchmarks/Benchmarks/IndexSegmentEBenchmarks.cs index 3095f27e..b0763742 100644 --- a/benchmarks/NexusMods.MnemonicDB.Benchmarks/Benchmarks/IndexSegmentEBenchmarks.cs +++ b/benchmarks/NexusMods.MnemonicDB.Benchmarks/Benchmarks/IndexSegmentEBenchmarks.cs @@ -16,7 +16,7 @@ public class IndexSegmentEBenchmarks public IndexSegmentEBenchmarks() { - var registry = new AttributeRegistry(null!, []); + var registry = new AttributeCache(); using var builder = new IndexSegmentBuilder(registry); for (var e = 1; e < 100; e++) @@ -24,7 +24,7 @@ public IndexSegmentEBenchmarks() for (var a = 0; a < 20; a++) { builder.Add(new Datom(new KeyPrefix(EntityId.From((ulong)e), AttributeId.From((ushort)a), TxId.From((ulong)(e + a)), false, - ValueTags.Null), ReadOnlyMemory.Empty, registry)); + ValueTags.Null), ReadOnlyMemory.Empty)); } } diff --git a/src/NexusMods.MnemonicDB.Abstractions/Attribute.cs b/src/NexusMods.MnemonicDB.Abstractions/Attribute.cs index 4dbab7d8..3c6a1181 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/Attribute.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/Attribute.cs @@ -293,7 +293,7 @@ public override string ToString() protected IServiceProvider GetServiceProvider(RegistryId registryId) { throw new NotImplementedException(); - return AttributeRegistryRegistry.Registries[registryId.Value]!.ServiceProvider; + //return AttributeRegistryRegistry.Registries[registryId.Value]!.ServiceProvider; } /// diff --git a/src/NexusMods.MnemonicDB.Abstractions/AttributeCache.cs b/src/NexusMods.MnemonicDB.Abstractions/AttributeCache.cs index 2b1d0794..1db8d3df 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/AttributeCache.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/AttributeCache.cs @@ -1,3 +1,9 @@ +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.CompilerServices; +using NexusMods.MnemonicDB.Abstractions.BuiltInEntities; + namespace NexusMods.MnemonicDB.Abstractions; /// @@ -6,6 +12,29 @@ namespace NexusMods.MnemonicDB.Abstractions; /// public sealed class AttributeCache { + private Dictionary _attributeIdsBySymbol = new(); + private readonly BitArray _isCardinalityMany; + private readonly BitArray _isReference; + private readonly BitArray _isIndexed; + private readonly Symbol[] _symbols; + + public AttributeCache() + { + var maxId = AttributeDefinition.HardcodedIds.Values.Max() + 1; + _isCardinalityMany = new BitArray(maxId); + _isReference = new BitArray(maxId); + _isIndexed = new BitArray(maxId); + _symbols = new Symbol[maxId]; + + foreach (var kv in AttributeDefinition.HardcodedIds) + { + _attributeIdsBySymbol[kv.Key.Id] = AttributeId.From(kv.Value); + _isIndexed[kv.Value] = kv.Key.IsIndexed; + _symbols[kv.Value] = kv.Key.Id; + } + + } + /// /// Resets the cache, causing it to re-query the database for the latest definitions. /// @@ -20,7 +49,7 @@ public void Reset(IDb idb) /// public bool IsReference(AttributeId attrId) { - throw new System.NotImplementedException(); + return _isReference[attrId.Value]; } /// @@ -28,7 +57,7 @@ public bool IsReference(AttributeId attrId) /// public bool IsIndexed(AttributeId attrId) { - throw new System.NotImplementedException(); + return _isIndexed[attrId.Value]; } /// @@ -44,14 +73,20 @@ public bool IsNoHistory(AttributeId attrId) /// public bool IsCardinalityMany(AttributeId attrId) { - throw new System.NotImplementedException(); + return _isCardinalityMany[attrId.Value]; } /// /// Get the AttributeId (DB attribute id) for the given attribute name /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] public AttributeId GetAttributeId(Symbol attribute) { - throw new System.NotImplementedException(); + return _attributeIdsBySymbol[attribute]; + } + + public Symbol GetSymbol(AttributeId id) + { + return _symbols[id.Value]; } } diff --git a/src/NexusMods.MnemonicDB.Abstractions/AttributeResolver.cs b/src/NexusMods.MnemonicDB.Abstractions/AttributeResolver.cs index c87d9a65..dd78a6a7 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/AttributeResolver.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/AttributeResolver.cs @@ -1,3 +1,4 @@ +using System; using NexusMods.MnemonicDB.Abstractions.DatomIterators; namespace NexusMods.MnemonicDB.Abstractions; @@ -12,4 +13,9 @@ public IReadDatom Resolve(Datom datom) { throw new System.NotImplementedException(); } + + /// + /// Gets the service object of the specified type. + /// + public IServiceProvider ServiceProvider => throw new System.NotImplementedException(); } diff --git a/src/NexusMods.MnemonicDB.Abstractions/Query/ObservableDatoms.cs b/src/NexusMods.MnemonicDB.Abstractions/Query/ObservableDatoms.cs index e077f2a0..f8304374 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/Query/ObservableDatoms.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/Query/ObservableDatoms.cs @@ -184,14 +184,4 @@ private static DatomKey CreateKey(Datom datom, AttributeId attrId, bool isMany = { return new DatomKey(datom.E, attrId, isMany ? datom.ValueMemory : Memory.Empty); } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void UpdateAttrCache(IAttributeRegistry registry, AttributeId aid, ref AttributeId cachedAid, ref IAttribute attr, ref bool isMany) - { - if (cachedAid == aid) - return; - cachedAid = aid; - attr = registry.GetAttribute(aid); - isMany = attr.Cardinalty == Cardinality.Many; - } } diff --git a/src/NexusMods.MnemonicDB.SourceGenerator/Template.weave b/src/NexusMods.MnemonicDB.SourceGenerator/Template.weave index be1aff0c..36578eda 100644 --- a/src/NexusMods.MnemonicDB.SourceGenerator/Template.weave +++ b/src/NexusMods.MnemonicDB.SourceGenerator/Template.weave @@ -314,9 +314,10 @@ public partial class {{= model.Name}} : __MODELS__.IModelFactory<{{= model.Name} /// public IEnumerator GetEnumerator() { + var resolver = Db.Connection.AttributeResolver; for (var i = 0; i < IndexSegment.Count; i++) { - yield return IndexSegment[i].Resolved; + yield return resolver.Resolve(IndexSegment[i]); } } diff --git a/src/NexusMods.MnemonicDB/Storage/DatomStore.cs b/src/NexusMods.MnemonicDB/Storage/DatomStore.cs index d3cd9b26..6d4ec1fc 100644 --- a/src/NexusMods.MnemonicDB/Storage/DatomStore.cs +++ b/src/NexusMods.MnemonicDB/Storage/DatomStore.cs @@ -391,7 +391,7 @@ private void Log(PendingTransaction pendingTransaction, out StoreResult result) var currentPrefix = datom.Prefix; var attrId = currentPrefix.A; - var newE = isRemapped ? Remap(currentPrefix.E) : currentPrefix.E; + var newE = isRemapped ? Remap(currentSnapshot, currentPrefix.E, thisTx) : currentPrefix.E; var keyPrefix = currentPrefix with {E = newE, T = thisTx}; { diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/ABackendTest.cs b/tests/NexusMods.MnemonicDB.Storage.Tests/ABackendTest.cs index 2213757a..a5a16de8 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/ABackendTest.cs +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/ABackendTest.cs @@ -17,7 +17,7 @@ namespace NexusMods.MnemonicDB.Storage.Tests; public abstract class ABackendTest( IServiceProvider provider, - Func backendFn) + Func backendFn) : AStorageTest(provider, backendFn) where TStoreType : IStoreBackend { @@ -33,15 +33,18 @@ public abstract class ABackendTest( [InlineData(IndexType.AVETHistory)] public async Task InsertedDatomsShowUpInTheIndex(IndexType type) { + throw new NotImplementedException(); + /* var tx = await GenerateData(); var datoms = tx.Snapshot - .Datoms(SliceDescriptor.Create(type, Registry)) + .Datoms(SliceDescriptor.Create(type)) .Select(d => d.Resolved) .ToArray(); await Verify(datoms.ToTable(Registry)) .UseDirectory("BackendTestVerifyData") .UseParameters(type); + */ } [Theory] @@ -70,7 +73,7 @@ public async Task CanStoreDataInBlobs(IndexType type) for (var i = 0; i < 4; i++) { - using var segment = new IndexSegmentBuilder(Registry); + using var segment = new IndexSegmentBuilder(); var entityId = NextTempId(); segment.Add(entityId, Blobs.InKeyBlob, smallData); segment.Add(entityId, Blobs.InValueBlob, largeData); @@ -81,7 +84,7 @@ public async Task CanStoreDataInBlobs(IndexType type) // Retract the first 2 for (var i = 0; i < 2; i++) { - using var segment = new IndexSegmentBuilder(Registry); + using var segment = new IndexSegmentBuilder(); segment.Add(ids[i], Blobs.InKeyBlob, smallData, true); segment.Add(ids[i], Blobs.InValueBlob, largeData, true); await DatomStore.TransactAsync(segment.Build()); @@ -93,21 +96,23 @@ public async Task CanStoreDataInBlobs(IndexType type) // Change the other 2 for (var i = 5; i < 2; i++) { - using var segment = new IndexSegmentBuilder(Registry); + using var segment = new IndexSegmentBuilder(); segment.Add(ids[i], Blobs.InKeyBlob, smallData); segment.Add(ids[i], Blobs.InValueBlob, largeData); await DatomStore.TransactAsync(segment.Build()); } + throw new NotImplementedException(); + /* var datoms = DatomStore.GetSnapshot() - .Datoms(SliceDescriptor.Create(type, Registry)) + .Datoms(SliceDescriptor.Create(type)) .Select(d => d.Resolved) .ToArray(); - await Verify(datoms.ToTable(Registry)) + await Verify(datoms.ToTable()) .UseDirectory("BackendTestVerifyData") .UseParameters(type); - +*/ } @@ -123,15 +128,14 @@ await Verify(datoms.ToTable(Registry)) public async Task HistoricalQueriesReturnAllDataSorted(IndexType type) { var tx = await GenerateData(); - var current = tx.Snapshot.Datoms(SliceDescriptor.Create(type.CurrentVariant(), Registry)); - var history = tx.Snapshot.Datoms(SliceDescriptor.Create(type.HistoryVariant(), Registry)); + var current = tx.Snapshot.Datoms(SliceDescriptor.Create(type.CurrentVariant())); + var history = tx.Snapshot.Datoms(SliceDescriptor.Create(type.HistoryVariant())); var comparer = type.GetComparator(); var merged = current .Merge(history, CompareDatoms(comparer)) - .Select(d => d.Resolved) .ToArray(); - await Verify(merged.ToTable(Registry)) + await Verify(merged.ToTable(AttributeCache)) .UseDirectory("BackendTestVerifyData") .UseParameters(type); } @@ -157,7 +161,7 @@ private async Task GenerateData() { - using var segment = new IndexSegmentBuilder(Registry); + using var segment = new IndexSegmentBuilder(); segment.Add(id1, File.Path, "/foo/bar"); segment.Add(id1, File.Hash, Hash.From(0xDEADBEEF)); @@ -188,7 +192,7 @@ private async Task GenerateData() collectionId = tx.Remaps[collectionId]; { - using var segment = new IndexSegmentBuilder(Registry); + using var segment = new IndexSegmentBuilder(); segment.Add(id2, File.Path, "/foo/qux"); segment.Add(id1, File.ModId, modId2); segment.Add(collectionId, Collection.ModIds, modId2, true); @@ -215,7 +219,7 @@ public async Task RetractedValuesAreSupported(IndexType type) StoreResult tx1, tx2; { - using var segment = new IndexSegmentBuilder(Registry); + using var segment = new IndexSegmentBuilder(); segment.Add(id, File.Path, "/foo/bar"); segment.Add(id, File.Hash, Hash.From(0xDEADBEEF)); @@ -229,7 +233,7 @@ public async Task RetractedValuesAreSupported(IndexType type) modId = tx1.Remaps[modId]; { - using var segment = new IndexSegmentBuilder(Registry); + using var segment = new IndexSegmentBuilder(); segment.Add(id, File.Path, "/foo/bar", true); segment.Add(id, File.Hash, Hash.From(0xDEADBEEF), true); @@ -242,10 +246,9 @@ public async Task RetractedValuesAreSupported(IndexType type) var datoms = tx2.Snapshot - .Datoms(SliceDescriptor.Create(type, Registry)) - .Select(d => d.Resolved) + .Datoms(SliceDescriptor.Create(type)) .ToArray(); - await Verify(datoms.ToTable(Registry)) + await Verify(datoms.ToTable(AttributeCache)) .UseDirectory("BackendTestVerifyData") .UseParameters(type); } @@ -254,10 +257,9 @@ await Verify(datoms.ToTable(Registry)) [Fact] public async Task CanLoadExistingAttributes() { - var attrs = DatomStore.GetSnapshot().Datoms(SliceDescriptor.Create(AttributeDefinition.UniqueId, Registry)) - .Select(d => d.Resolved) + var attrs = DatomStore.GetSnapshot().Datoms(SliceDescriptor.Create(AttributeDefinition.UniqueId, AttributeCache)) .ToArray(); - await Verify(attrs.ToTable(Registry)); + await Verify(attrs.ToTable(AttributeCache)); } } diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/AStorageTest.cs b/tests/NexusMods.MnemonicDB.Storage.Tests/AStorageTest.cs index 782e7eab..40ae7c35 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/AStorageTest.cs +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/AStorageTest.cs @@ -16,17 +16,18 @@ public abstract class AStorageTest : IDisposable private readonly AbsolutePath _path; private readonly IServiceProvider _provider; protected readonly DatomStoreSettings DatomStoreSettings; + protected readonly AttributeCache AttributeCache; protected readonly ILogger Logger; - protected readonly AttributeRegistry Registry; private ulong _tempId = 1; protected IDatomStore DatomStore; - protected AStorageTest(IServiceProvider provider, Func? backendFn = null) + protected AStorageTest(IServiceProvider provider, Func? backendFn = null) { _provider = provider; - Registry = new AttributeRegistry(provider, provider.GetServices()); + AttributeCache = new AttributeCache(); + /* Registry.Populate([ new DbAttribute(File.Path.Id, AttributeId.From(20), ValueTags.Utf8Insensitive, File.Path), new DbAttribute(File.Hash.Id, AttributeId.From(21), ValueTags.UInt64, File.Hash), @@ -41,6 +42,7 @@ protected AStorageTest(IServiceProvider provider, Func new Backend(registry); - DatomStore = new DatomStore(provider.GetRequiredService>(), Registry, DatomStoreSettings, - backendFn(Registry)); + DatomStore = new DatomStore(provider.GetRequiredService>(), AttributeCache, DatomStoreSettings, + backendFn(AttributeCache)); Logger = provider.GetRequiredService>(); } public void Dispose() { - Registry.Dispose(); } public EntityId NextTempId() diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/NullConnection.cs b/tests/NexusMods.MnemonicDB.Storage.Tests/NullConnection.cs index 0417f036..6b6abc79 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/NullConnection.cs +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/NullConnection.cs @@ -6,7 +6,8 @@ namespace NexusMods.MnemonicDB.Storage.Tests; public class NullConnection : IConnection { public IDb Db => throw new NotSupportedException(); - public IAttributeRegistry Registry => throw new NotSupportedException(); + public AttributeResolver AttributeResolver => throw new NotSupportedException(); + public AttributeCache AttributeCache => throw new NotSupportedException(); public TxId TxId => throw new NotSupportedException(); public IObservable Revisions => throw new NotSupportedException(); public IServiceProvider ServiceProvider => throw new NotSupportedException(); diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/Startup.cs b/tests/NexusMods.MnemonicDB.Storage.Tests/Startup.cs index 71383925..d4f7a03d 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/Startup.cs +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/Startup.cs @@ -19,7 +19,6 @@ public void ConfigureServices(IServiceCollection services) .AddTestModel() .AddSingleton(Blobs.InKeyBlob) .AddSingleton(Blobs.InValueBlob) - .AddSingleton() .AddSingleton() .AddLogging(builder => builder.AddXunitOutput().SetMinimumLevel(LogLevel.Debug)); } diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/TestAttributes/Blobs.cs b/tests/NexusMods.MnemonicDB.Storage.Tests/TestAttributes/Blobs.cs index df02b391..b12abe54 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/TestAttributes/Blobs.cs +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/TestAttributes/Blobs.cs @@ -16,7 +16,7 @@ public class Blobs public class TestBlobAttribute(string ns, string name) : BlobAttribute(ns, name) { - protected override byte[] FromLowLevel(ReadOnlySpan value, ValueTags tag, RegistryId registryId) + protected override byte[] FromLowLevel(ReadOnlySpan value, ValueTags tag, AttributeResolver resolver) => value.ToArray(); protected override void WriteValue(byte[] value, TWriter writer) @@ -27,7 +27,7 @@ protected override void WriteValue(byte[] value, TWriter writer) public class TestHashedBlobAttribute(string ns, string name) : HashedBlobAttribute(ns, name) { - protected override byte[] FromLowLevel(ReadOnlySpan value, ValueTags tag, RegistryId registryId) => value.ToArray(); + protected override byte[] FromLowLevel(ReadOnlySpan value, ValueTags tag, AttributeResolver resolver) => value.ToArray(); protected override void WriteValue(byte[] value, TWriter writer) { diff --git a/tests/NexusMods.MnemonicDB.TestModel/Analyzers/AttributesAnalyzer.cs b/tests/NexusMods.MnemonicDB.TestModel/Analyzers/AttributesAnalyzer.cs index 36ee4659..3c4f9364 100644 --- a/tests/NexusMods.MnemonicDB.TestModel/Analyzers/AttributesAnalyzer.cs +++ b/tests/NexusMods.MnemonicDB.TestModel/Analyzers/AttributesAnalyzer.cs @@ -5,17 +5,16 @@ namespace NexusMods.MnemonicDB.TestModel.Analyzers; /// /// Records all the attributes in each transaction /// -public class AttributesAnalyzer : IAnalyzer> +public class AttributesAnalyzer : IAnalyzer> { public object Analyze(IDb? dbOld, IDb dbNew) { - var hashSet = new HashSet(); - var registry = dbNew.Registry; + var hashSet = new HashSet(); + var cache = dbNew.AttributeCache; foreach (var datom in dbNew.RecentlyAdded) { - hashSet.Add(registry.GetAttribute(datom.A)); + hashSet.Add(cache.GetSymbol(datom.A)); } - return hashSet; } } diff --git a/tests/NexusMods.MnemonicDB.TestModel/Attributes/AbsolutePathAttribute.cs b/tests/NexusMods.MnemonicDB.TestModel/Attributes/AbsolutePathAttribute.cs index ce23f5ff..6c0c5ffe 100644 --- a/tests/NexusMods.MnemonicDB.TestModel/Attributes/AbsolutePathAttribute.cs +++ b/tests/NexusMods.MnemonicDB.TestModel/Attributes/AbsolutePathAttribute.cs @@ -12,8 +12,8 @@ protected override string ToLowLevel(AbsolutePath value) { return value.ToString(); } - protected override AbsolutePath FromLowLevel(string value, ValueTags tag, RegistryId registryId) + protected override AbsolutePath FromLowLevel(string value, ValueTags tag, AttributeResolver resolver) { - return GetServiceProvider(registryId).GetRequiredService().FromUnsanitizedFullPath(value); + return resolver.ServiceProvider.GetRequiredService().FromUnsanitizedFullPath(value); } } diff --git a/tests/NexusMods.MnemonicDB.TestModel/Attributes/HashAttribute.cs b/tests/NexusMods.MnemonicDB.TestModel/Attributes/HashAttribute.cs index 10544391..988dbd53 100644 --- a/tests/NexusMods.MnemonicDB.TestModel/Attributes/HashAttribute.cs +++ b/tests/NexusMods.MnemonicDB.TestModel/Attributes/HashAttribute.cs @@ -8,5 +8,6 @@ namespace NexusMods.MnemonicDB.TestModel.Attributes; public class HashAttribute(string ns, string name) : ScalarAttribute(ValueTags.UInt64, ns, name) { protected override ulong ToLowLevel(Hash value) => value.Value; - protected override Hash FromLowLevel(ulong lowLevelType, ValueTags tags, RegistryId registryId) => Hash.From(lowLevelType); + protected override Hash FromLowLevel(ulong lowLevelType, ValueTags tags, AttributeResolver resolver) + => Hash.From(lowLevelType); } diff --git a/tests/NexusMods.MnemonicDB.TestModel/Attributes/RelativePathAttribute.cs b/tests/NexusMods.MnemonicDB.TestModel/Attributes/RelativePathAttribute.cs index 58c6a2b7..6fb46ce2 100644 --- a/tests/NexusMods.MnemonicDB.TestModel/Attributes/RelativePathAttribute.cs +++ b/tests/NexusMods.MnemonicDB.TestModel/Attributes/RelativePathAttribute.cs @@ -13,7 +13,7 @@ protected override string ToLowLevel(RelativePath value) return value.Path; } - protected override RelativePath FromLowLevel(string lowLevelType, ValueTags tags, RegistryId registryId) + protected override RelativePath FromLowLevel(string lowLevelType, ValueTags tags, AttributeResolver resolver) { return new RelativePath(lowLevelType); } diff --git a/tests/NexusMods.MnemonicDB.TestModel/Attributes/SizeAttribute.cs b/tests/NexusMods.MnemonicDB.TestModel/Attributes/SizeAttribute.cs index 144e098d..a6a296f6 100644 --- a/tests/NexusMods.MnemonicDB.TestModel/Attributes/SizeAttribute.cs +++ b/tests/NexusMods.MnemonicDB.TestModel/Attributes/SizeAttribute.cs @@ -8,6 +8,6 @@ namespace NexusMods.MnemonicDB.TestModel.Attributes; public class SizeAttribute(string ns, string name) : ScalarAttribute(ValueTags.UInt64, ns, name) { protected override ulong ToLowLevel(Size value) => value.Value; - protected override Size FromLowLevel(ulong value, ValueTags tags, RegistryId registryId) + protected override Size FromLowLevel(ulong value, ValueTags tags, AttributeResolver resolver) => Size.From(value); } diff --git a/tests/NexusMods.MnemonicDB.TestModel/Attributes/StringsAttribute.cs b/tests/NexusMods.MnemonicDB.TestModel/Attributes/StringsAttribute.cs index 7d2f8018..812efe9e 100644 --- a/tests/NexusMods.MnemonicDB.TestModel/Attributes/StringsAttribute.cs +++ b/tests/NexusMods.MnemonicDB.TestModel/Attributes/StringsAttribute.cs @@ -11,7 +11,7 @@ protected override string ToLowLevel(string value) return value; } - protected override string FromLowLevel(string value, ValueTags tag, RegistryId registryId) + protected override string FromLowLevel(string value, ValueTags tag, AttributeResolver resolver) { return value; } diff --git a/tests/NexusMods.MnemonicDB.TestModel/Attributes/UriAttribute.cs b/tests/NexusMods.MnemonicDB.TestModel/Attributes/UriAttribute.cs index 1596cbf6..028f93e3 100644 --- a/tests/NexusMods.MnemonicDB.TestModel/Attributes/UriAttribute.cs +++ b/tests/NexusMods.MnemonicDB.TestModel/Attributes/UriAttribute.cs @@ -11,7 +11,7 @@ protected override string ToLowLevel(Uri value) return value.ToString(); } - protected override Uri FromLowLevel(string lowLevelValue, ValueTags tags, RegistryId registryId) + protected override Uri FromLowLevel(string lowLevelValue, ValueTags tags, AttributeResolver resolver) { return new Uri(lowLevelValue); } diff --git a/tests/NexusMods.MnemonicDB.TestModel/Helpers/ExtensionMethods.cs b/tests/NexusMods.MnemonicDB.TestModel/Helpers/ExtensionMethods.cs index cd5baa15..23f45efc 100644 --- a/tests/NexusMods.MnemonicDB.TestModel/Helpers/ExtensionMethods.cs +++ b/tests/NexusMods.MnemonicDB.TestModel/Helpers/ExtensionMethods.cs @@ -1,28 +1,16 @@ using System.IO.Hashing; +using System.Runtime.InteropServices; using System.Text; using NexusMods.MnemonicDB.Abstractions; +using NexusMods.MnemonicDB.Abstractions.DatomIterators; +using NexusMods.MnemonicDB.Abstractions.ElementComparers; using NexusMods.MnemonicDB.Abstractions.Internals; namespace NexusMods.MnemonicDB.TestModel.Helpers; public static class ExtensionMethods { - public static IEnumerable ToObjectDatoms(this IEnumerable datoms, - IAttributeRegistry registry) - { - foreach (var datom in datoms) - { - yield return new ObjectTuple - { - E = datom.E, - A = datom.A.Id.Name, - V = datom.ObjectValue, - T = datom.T - }; - } - } - - public static string ToTable(this IEnumerable datoms, IAttributeRegistry registry) + public static string ToTable(this IEnumerable datoms, AttributeCache cache) { string TruncateOrPad(string val, int length) { @@ -42,8 +30,9 @@ string TruncateOrPad(string val, int length) { var isRetract = datom.IsRetract; - var symColumn = TruncateOrPad(datom.A.Id.Name, 24); - var attrId = datom.A.GetDbId(registry.Id).Value.ToString("X4"); + var aName = cache.GetSymbol(datom.A); + var symColumn = TruncateOrPad(aName.Name, 24); + var attrId = datom.A.Value.ToString("X4"); sb.Append(isRetract ? "-" : "+"); sb.Append(" | "); @@ -54,24 +43,32 @@ string TruncateOrPad(string val, int length) - switch (datom.ObjectValue) + switch (datom.Prefix.ValueTag) { - case EntityId eid: - sb.Append(eid.Value.ToString("X16").PadRight(48)); + case ValueTags.Reference: + var val = MemoryMarshal.Read(datom.ValueSpan); + sb.Append(val.Value.ToString("X16").PadRight(48)); + break; + case ValueTags.Ascii: + { + var size = MemoryMarshal.Read(datom.ValueSpan); + sb.Append(Encoding.ASCII.GetString(datom.ValueSpan.Slice(sizeof(uint), (int)size))); break; - case ulong ul: + } + + case ValueTags.UInt64: + var ul = MemoryMarshal.Read(datom.ValueSpan); sb.Append(ul.ToString("X16").PadRight(48)); break; - case byte[] byteArray: - var code = XxHash3.HashToUInt64(byteArray); + case ValueTags.Blob: + var code = XxHash3.HashToUInt64(datom.ValueSpan); var hash = code.ToString("X16"); - sb.Append($"Blob 0x{hash} {byteArray.Length} bytes".PadRight(48)); - break; - case DateTime dateTime: - sb.Append($"DateTime : {dateTimeCount++}".PadRight(48)); + sb.Append($"Blob 0x{hash} {datom.ValueSpan.Length} bytes".PadRight(48)); break; default: - sb.Append(TruncateOrPad(datom.ObjectValue.ToString()!, 48)); + var otherCode = XxHash3.HashToUInt64(datom.ValueSpan); + var otherHash = otherCode.ToString("X16"); + sb.Append($"Other 0x{otherHash} {datom.ValueSpan.Length} bytes".PadRight(48)); break; } diff --git a/tests/NexusMods.MnemonicDB.Tests/AMnemonicDBTest.cs b/tests/NexusMods.MnemonicDB.Tests/AMnemonicDBTest.cs index e64c5c50..92fbab61 100644 --- a/tests/NexusMods.MnemonicDB.Tests/AMnemonicDBTest.cs +++ b/tests/NexusMods.MnemonicDB.Tests/AMnemonicDBTest.cs @@ -6,6 +6,7 @@ using NexusMods.MnemonicDB.Storage.RocksDbBackend; using NexusMods.MnemonicDB.TestModel.Helpers; using NexusMods.Hashing.xxHash64; +using NexusMods.MnemonicDB.Abstractions.DatomIterators; using NexusMods.MnemonicDB.TestModel; using NexusMods.MnemonicDB.TestModel.Analyzers; using NexusMods.Paths; @@ -18,7 +19,7 @@ public class AMnemonicDBTest : IDisposable { private readonly IAttribute[] _attributes; protected readonly IServiceProvider Provider; - private AttributeRegistry _registry; + private AttributeCache _attributeCache; private Backend _backend; private DatomStore _store; @@ -32,16 +33,16 @@ protected AMnemonicDBTest(IServiceProvider provider) Provider = provider; _attributes = provider.GetRequiredService>().ToArray(); - _registry = new AttributeRegistry(provider, _attributes); + _attributeCache = new AttributeCache(); Config = new DatomStoreSettings { Path = FileSystem.Shared.GetKnownPath(KnownPath.EntryDirectory) .Combine("tests_MnemonicDB" + Guid.NewGuid()) }; - _backend = new Backend(_registry); + _backend = new Backend(_attributeCache); - _store = new DatomStore(provider.GetRequiredService>(), _registry, Config, _backend); + _store = new DatomStore(provider.GetRequiredService>(), _attributeCache, Config, _backend); _analyzers = new IAnalyzer[]{ @@ -68,9 +69,9 @@ protected SettingsTask VerifyModel(IEnumerable models) return VerifyTable(models.SelectMany(e => e)); } - protected SettingsTask VerifyTable(IEnumerable datoms) + protected SettingsTask VerifyTable(IEnumerable datoms) { - return Verify(datoms.ToTable(_registry)); + return Verify(datoms.ToTable(_attributeCache)); } protected async Task InsertExampleData() @@ -122,22 +123,20 @@ protected SettingsTask VerifyTable(IEnumerable datoms) public void Dispose() { - _registry.Dispose(); _store.Dispose(); } protected async Task RestartDatomStore() { - _registry.Dispose(); _store.Dispose(); _backend.Dispose(); GC.Collect(); - _backend = new Backend(_registry); - _registry = new AttributeRegistry(Provider, _attributes); - _store = new DatomStore(Provider.GetRequiredService>(), _registry, Config, _backend); + _backend = new Backend(_attributeCache); + _attributeCache = new AttributeCache(); + _store = new DatomStore(Provider.GetRequiredService>(), _attributeCache, Config, _backend); Connection = new Connection(Provider.GetRequiredService>(), _store, Provider, _attributes, _analyzers); } From fe71d6ca7eb689cc78e5822ffd4bf98844cfc507 Mon Sep 17 00:00:00 2001 From: halgari Date: Wed, 18 Sep 2024 22:37:54 -0600 Subject: [PATCH 4/9] Implemented the attribute cache, still working on tests --- .../AttributeCache.cs | 64 +++++++++++++++++-- .../ABackendTest.cs | 18 ++---- .../AStorageTest.cs | 50 ++++++++++----- .../Helpers/ExtensionMethods.cs | 3 +- 4 files changed, 99 insertions(+), 36 deletions(-) diff --git a/src/NexusMods.MnemonicDB.Abstractions/AttributeCache.cs b/src/NexusMods.MnemonicDB.Abstractions/AttributeCache.cs index 1db8d3df..df6793cd 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/AttributeCache.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/AttributeCache.cs @@ -3,6 +3,8 @@ using System.Linq; using System.Runtime.CompilerServices; using NexusMods.MnemonicDB.Abstractions.BuiltInEntities; +using NexusMods.MnemonicDB.Abstractions.ElementComparers; +using NexusMods.MnemonicDB.Abstractions.IndexSegments; namespace NexusMods.MnemonicDB.Abstractions; @@ -14,9 +16,10 @@ public sealed class AttributeCache { private Dictionary _attributeIdsBySymbol = new(); private readonly BitArray _isCardinalityMany; - private readonly BitArray _isReference; - private readonly BitArray _isIndexed; - private readonly Symbol[] _symbols; + private BitArray _isReference; + private BitArray _isIndexed; + private Symbol[] _symbols; + private BitArray _isNoHistory; public AttributeCache() { @@ -24,6 +27,7 @@ public AttributeCache() _isCardinalityMany = new BitArray(maxId); _isReference = new BitArray(maxId); _isIndexed = new BitArray(maxId); + _isNoHistory = new BitArray(maxId); _symbols = new Symbol[maxId]; foreach (var kv in AttributeDefinition.HardcodedIds) @@ -39,9 +43,54 @@ public AttributeCache() /// Resets the cache, causing it to re-query the database for the latest definitions. /// /// - public void Reset(IDb idb) + public void Reset(IDb db) { - throw new System.NotImplementedException(); + var symbols = db.Datoms(AttributeDefinition.UniqueId); + var maxIndex = (int)symbols.MaxBy(static x => x.E.Value).E.Value + 1; + + var newSymbols = new Symbol[maxIndex]; + foreach (var datom in symbols) + { + var id = datom.E.Value; + var symbol = AttributeDefinition.UniqueId.ReadValue(datom.ValueSpan, datom.Prefix.ValueTag, null!); + newSymbols[id] = symbol; + _attributeIdsBySymbol[symbol] = AttributeId.From((ushort)id); + } + _symbols = newSymbols; + + var types = db.Datoms(AttributeDefinition.ValueType); + var newTypes = new ValueTags[maxIndex]; + var newIsReference = new BitArray(maxIndex); + foreach (var datom in types) + { + var id = datom.E.Value; + var type = AttributeDefinition.ValueType.ReadValue(datom.ValueSpan, datom.Prefix.ValueTag, null!); + newTypes[id] = type; + newIsReference[(int)id] = type == ValueTags.Reference; + } + _isReference = newIsReference; + + var isIndexed = db.Datoms(AttributeDefinition.Indexed); + var newIsIndexed = new BitArray(maxIndex); + foreach (var datom in isIndexed) + { + var id = datom.E.Value; + newIsIndexed[(int)id] = true; + } + _isIndexed = newIsIndexed; + + var isNoHistory = db.Datoms(AttributeDefinition.NoHistory); + var newIsNoHistory = new BitArray(maxIndex); + if (isNoHistory.Any()) + { + foreach (var datom in isNoHistory) + { + var id = datom.E.Value; + newIsNoHistory[(int)id] = true; + } + } + _isNoHistory = newIsNoHistory; + } /// @@ -65,7 +114,7 @@ public bool IsIndexed(AttributeId attrId) /// public bool IsNoHistory(AttributeId attrId) { - throw new System.NotImplementedException(); + return _isNoHistory[attrId.Value]; } /// @@ -85,6 +134,9 @@ public AttributeId GetAttributeId(Symbol attribute) return _attributeIdsBySymbol[attribute]; } + /// + /// Get the symbol for the given attribute id + /// public Symbol GetSymbol(AttributeId id) { return _symbols[id.Value]; diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/ABackendTest.cs b/tests/NexusMods.MnemonicDB.Storage.Tests/ABackendTest.cs index a5a16de8..91484516 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/ABackendTest.cs +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/ABackendTest.cs @@ -33,18 +33,14 @@ public abstract class ABackendTest( [InlineData(IndexType.AVETHistory)] public async Task InsertedDatomsShowUpInTheIndex(IndexType type) { - throw new NotImplementedException(); - /* var tx = await GenerateData(); var datoms = tx.Snapshot .Datoms(SliceDescriptor.Create(type)) - .Select(d => d.Resolved) .ToArray(); - await Verify(datoms.ToTable(Registry)) + await Verify(datoms.ToTable(AttributeCache)) .UseDirectory("BackendTestVerifyData") .UseParameters(type); - */ } [Theory] @@ -73,7 +69,7 @@ public async Task CanStoreDataInBlobs(IndexType type) for (var i = 0; i < 4; i++) { - using var segment = new IndexSegmentBuilder(); + using var segment = new IndexSegmentBuilder(AttributeCache); var entityId = NextTempId(); segment.Add(entityId, Blobs.InKeyBlob, smallData); segment.Add(entityId, Blobs.InValueBlob, largeData); @@ -84,7 +80,7 @@ public async Task CanStoreDataInBlobs(IndexType type) // Retract the first 2 for (var i = 0; i < 2; i++) { - using var segment = new IndexSegmentBuilder(); + using var segment = new IndexSegmentBuilder(AttributeCache); segment.Add(ids[i], Blobs.InKeyBlob, smallData, true); segment.Add(ids[i], Blobs.InValueBlob, largeData, true); await DatomStore.TransactAsync(segment.Build()); @@ -96,23 +92,19 @@ public async Task CanStoreDataInBlobs(IndexType type) // Change the other 2 for (var i = 5; i < 2; i++) { - using var segment = new IndexSegmentBuilder(); + using var segment = new IndexSegmentBuilder(AttributeCache); segment.Add(ids[i], Blobs.InKeyBlob, smallData); segment.Add(ids[i], Blobs.InValueBlob, largeData); await DatomStore.TransactAsync(segment.Build()); } - throw new NotImplementedException(); - /* var datoms = DatomStore.GetSnapshot() .Datoms(SliceDescriptor.Create(type)) - .Select(d => d.Resolved) .ToArray(); - await Verify(datoms.ToTable()) + await Verify(datoms.ToTable(AttributeCache)) .UseDirectory("BackendTestVerifyData") .UseParameters(type); -*/ } diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/AStorageTest.cs b/tests/NexusMods.MnemonicDB.Storage.Tests/AStorageTest.cs index 40ae7c35..ad1147a4 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/AStorageTest.cs +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/AStorageTest.cs @@ -1,11 +1,14 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using NexusMods.MnemonicDB.Abstractions; +using NexusMods.MnemonicDB.Abstractions.BuiltInEntities; using NexusMods.MnemonicDB.Abstractions.ElementComparers; +using NexusMods.MnemonicDB.Abstractions.IndexSegments; using NexusMods.MnemonicDB.Storage.Abstractions; using NexusMods.MnemonicDB.Storage.RocksDbBackend; using NexusMods.MnemonicDB.Storage.Tests.TestAttributes; using NexusMods.MnemonicDB.TestModel; +using NexusMods.MnemonicDB.TestModel.Attributes; using NexusMods.Paths; using File = NexusMods.MnemonicDB.TestModel.File; @@ -27,22 +30,7 @@ protected AStorageTest(IServiceProvider provider, Func>(); + + using var segmentBuilder = new IndexSegmentBuilder(AttributeCache); + AddAttr(segmentBuilder, File.Path, AttributeId.From(20)); + AddAttr(segmentBuilder, File.Hash, AttributeId.From(21)); + AddAttr(segmentBuilder, File.Size, AttributeId.From(22)); + AddAttr(segmentBuilder, File.ModId, AttributeId.From(23)); + AddAttr(segmentBuilder, Mod.Name, AttributeId.From(24)); + AddAttr(segmentBuilder, Mod.LoadoutId, AttributeId.From(25)); + AddAttr(segmentBuilder, Loadout.Name, AttributeId.From(26)); + AddAttr(segmentBuilder, Collection.Name, AttributeId.From(27)); + AddAttr(segmentBuilder, Collection.LoadoutId, AttributeId.From(28)); + AddAttr(segmentBuilder, Collection.ModIds, AttributeId.From(29)); + AddAttr(segmentBuilder, Blobs.InKeyBlob, AttributeId.From(30)); + AddAttr(segmentBuilder, Blobs.InValueBlob, AttributeId.From(31)); + var (result, db) = DatomStore.Transact(segmentBuilder.Build()); + AttributeCache.Reset(db); } + + private void AddAttr(IndexSegmentBuilder segmentBuilder, IAttribute attribute, AttributeId attributeId) + { + segmentBuilder.Add(EntityId.From(attributeId.Value), AttributeDefinition.UniqueId, attribute.Id); + segmentBuilder.Add(EntityId.From(attributeId.Value), AttributeDefinition.ValueType, attribute.LowLevelType); + segmentBuilder.Add(EntityId.From(attributeId.Value), AttributeDefinition.Cardinality, attribute.Cardinalty); + if (attribute.IsIndexed) + segmentBuilder.Add(EntityId.From(attributeId.Value), AttributeDefinition.Indexed, Null.Instance); + if (attribute.NoHistory) + segmentBuilder.Add(EntityId.From(attributeId.Value), AttributeDefinition.NoHistory, Null.Instance); + if (attribute.DeclaredOptional) + segmentBuilder.Add(EntityId.From(attributeId.Value), AttributeDefinition.Optional, Null.Instance); + } + public void Dispose() { } diff --git a/tests/NexusMods.MnemonicDB.TestModel/Helpers/ExtensionMethods.cs b/tests/NexusMods.MnemonicDB.TestModel/Helpers/ExtensionMethods.cs index 23f45efc..cfe76457 100644 --- a/tests/NexusMods.MnemonicDB.TestModel/Helpers/ExtensionMethods.cs +++ b/tests/NexusMods.MnemonicDB.TestModel/Helpers/ExtensionMethods.cs @@ -52,7 +52,8 @@ string TruncateOrPad(string val, int length) case ValueTags.Ascii: { var size = MemoryMarshal.Read(datom.ValueSpan); - sb.Append(Encoding.ASCII.GetString(datom.ValueSpan.Slice(sizeof(uint), (int)size))); + var str = Encoding.ASCII.GetString(datom.ValueSpan.Slice(sizeof(uint), (int)size)); + sb.Append(TruncateOrPad(str, 48)); break; } From c8bcc90cc1b11d354ac463ac385cf301b25736e8 Mon Sep 17 00:00:00 2001 From: halgari Date: Thu, 19 Sep 2024 14:25:16 -0600 Subject: [PATCH 5/9] Most of the main system tests pass --- .../Attribute.cs | 11 +- .../AttributeCache.cs | 11 +- .../AttributeResolver.cs | 33 +++++- .../Datom.cs | 18 ++- .../IAttribute.cs | 7 +- .../IndexSegments/IndexSegment.cs | 12 ++ .../IndexSegments/IndexSegmentBuilder.cs | 5 + .../StoreResult.cs | 3 +- src/NexusMods.MnemonicDB/Connection.cs | 2 +- src/NexusMods.MnemonicDB/Db.cs | 3 +- .../Storage/DatomStore.cs | 44 ++++--- .../Storage/InMemoryBackend/Batch.cs | 4 +- .../ABackendTest.cs | 8 +- ...eDataInBlobs_type=AEVTCurrent.verified.txt | 71 +++++++++--- ...eDataInBlobs_type=AEVTHistory.verified.txt | 16 +-- ...eDataInBlobs_type=AVETCurrent.verified.txt | 20 +++- ...eDataInBlobs_type=AVETHistory.verified.txt | 16 +-- ...eDataInBlobs_type=EAVTCurrent.verified.txt | 71 +++++++++--- ...eDataInBlobs_type=EAVTHistory.verified.txt | 16 +-- ...anStoreDataInBlobs_type=TxLog.verified.txt | 87 ++++++++++---- ...llDataSorted_type=AEVTCurrent.verified.txt | 107 ++++++++++++------ ...llDataSorted_type=AEVTHistory.verified.txt | 107 ++++++++++++------ ...llDataSorted_type=AVETCurrent.verified.txt | 30 +++-- ...llDataSorted_type=AVETHistory.verified.txt | 30 +++-- ...llDataSorted_type=EAVTCurrent.verified.txt | 107 ++++++++++++------ ...llDataSorted_type=EAVTHistory.verified.txt | 107 ++++++++++++------ ...llDataSorted_type=VAETCurrent.verified.txt | 20 ++-- ...llDataSorted_type=VAETHistory.verified.txt | 20 ++-- ...UpInTheIndex_type=AEVTCurrent.verified.txt | 95 +++++++++++----- ...UpInTheIndex_type=AEVTHistory.verified.txt | 12 +- ...UpInTheIndex_type=AVETCurrent.verified.txt | 26 +++-- ...UpInTheIndex_type=AVETHistory.verified.txt | 4 +- ...UpInTheIndex_type=EAVTCurrent.verified.txt | 95 +++++++++++----- ...UpInTheIndex_type=EAVTHistory.verified.txt | 12 +- ...msShowUpInTheIndex_type=TxLog.verified.txt | 107 ++++++++++++------ ...UpInTheIndex_type=VAETCurrent.verified.txt | 12 +- ...UpInTheIndex_type=VAETHistory.verified.txt | 8 +- ...AreSupported_type=AEVTCurrent.verified.txt | 63 +++++++++-- ...AreSupported_type=AEVTHistory.verified.txt | 16 +-- ...AreSupported_type=AVETCurrent.verified.txt | 12 ++ ...AreSupported_type=AVETHistory.verified.txt | 8 +- ...AreSupported_type=EAVTCurrent.verified.txt | 63 +++++++++-- ...AreSupported_type=EAVTHistory.verified.txt | 16 +-- ...ValuesAreSupported_type=TxLog.verified.txt | 79 ++++++++++--- ...AreSupported_type=VAETHistory.verified.txt | 4 +- ...eDataInBlobs_type=AEVTCurrent.verified.txt | 71 +++++++++--- ...eDataInBlobs_type=AEVTHistory.verified.txt | 16 +-- ...eDataInBlobs_type=AVETCurrent.verified.txt | 20 +++- ...eDataInBlobs_type=AVETHistory.verified.txt | 16 +-- ...eDataInBlobs_type=EAVTCurrent.verified.txt | 71 +++++++++--- ...eDataInBlobs_type=EAVTHistory.verified.txt | 16 +-- ...anStoreDataInBlobs_type=TxLog.verified.txt | 87 ++++++++++---- ...llDataSorted_type=AEVTCurrent.verified.txt | 107 ++++++++++++------ ...llDataSorted_type=AEVTHistory.verified.txt | 107 ++++++++++++------ ...llDataSorted_type=AVETCurrent.verified.txt | 30 +++-- ...llDataSorted_type=AVETHistory.verified.txt | 30 +++-- ...llDataSorted_type=EAVTCurrent.verified.txt | 107 ++++++++++++------ ...llDataSorted_type=EAVTHistory.verified.txt | 107 ++++++++++++------ ...llDataSorted_type=VAETCurrent.verified.txt | 20 ++-- ...llDataSorted_type=VAETHistory.verified.txt | 20 ++-- ...UpInTheIndex_type=AEVTCurrent.verified.txt | 95 +++++++++++----- ...UpInTheIndex_type=AEVTHistory.verified.txt | 12 +- ...UpInTheIndex_type=AVETCurrent.verified.txt | 26 +++-- ...UpInTheIndex_type=AVETHistory.verified.txt | 4 +- ...UpInTheIndex_type=EAVTCurrent.verified.txt | 95 +++++++++++----- ...UpInTheIndex_type=EAVTHistory.verified.txt | 12 +- ...msShowUpInTheIndex_type=TxLog.verified.txt | 107 ++++++++++++------ ...UpInTheIndex_type=VAETCurrent.verified.txt | 12 +- ...UpInTheIndex_type=VAETHistory.verified.txt | 8 +- ...AreSupported_type=AEVTCurrent.verified.txt | 63 +++++++++-- ...AreSupported_type=AEVTHistory.verified.txt | 16 +-- ...AreSupported_type=AVETCurrent.verified.txt | 12 ++ ...AreSupported_type=AVETHistory.verified.txt | 8 +- ...AreSupported_type=EAVTCurrent.verified.txt | 63 +++++++++-- ...AreSupported_type=EAVTHistory.verified.txt | 16 +-- ...ValuesAreSupported_type=TxLog.verified.txt | 79 ++++++++++--- ...AreSupported_type=VAETHistory.verified.txt | 4 +- ...sts.CanLoadExistingAttributes.verified.txt | 12 ++ ...sDB.CanLoadExistingAttributes.verified.txt | 12 ++ .../Helpers/ExtensionMethods.cs | 98 +++++++++++++++- .../AMnemonicDBTest.cs | 90 ++++++++++++--- tests/NexusMods.MnemonicDB.Tests/DbTests.cs | 31 ++--- 82 files changed, 2405 insertions(+), 913 deletions(-) diff --git a/src/NexusMods.MnemonicDB.Abstractions/Attribute.cs b/src/NexusMods.MnemonicDB.Abstractions/Attribute.cs index 3c6a1181..1b104bc6 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/Attribute.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/Attribute.cs @@ -178,16 +178,7 @@ public void SetDbId(RegistryId id, AttributeId attributeId) { Cache[id.Value] = attributeId; } - - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public AttributeId GetDbId(RegistryId id) - { - var aid = Cache[id.Value]; - Debug.Assert(aid.Value != 0, $"Attribute ID is 0 for {Id}, was it registered?"); - return aid; - } - + /// public Type ValueType => typeof(TValueType); diff --git a/src/NexusMods.MnemonicDB.Abstractions/AttributeCache.cs b/src/NexusMods.MnemonicDB.Abstractions/AttributeCache.cs index df6793cd..6babc5db 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/AttributeCache.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/AttributeCache.cs @@ -15,7 +15,7 @@ namespace NexusMods.MnemonicDB.Abstractions; public sealed class AttributeCache { private Dictionary _attributeIdsBySymbol = new(); - private readonly BitArray _isCardinalityMany; + private BitArray _isCardinalityMany; private BitArray _isReference; private BitArray _isIndexed; private Symbol[] _symbols; @@ -91,6 +91,15 @@ public void Reset(IDb db) } _isNoHistory = newIsNoHistory; + var isCardinalityMany = db.Datoms(AttributeDefinition.Cardinality); + var newIsCardinalityMany = new BitArray(maxIndex); + foreach (var datom in isCardinalityMany) + { + var id = datom.E.Value; + newIsCardinalityMany[(int)id] = AttributeDefinition.Cardinality.ReadValue(datom.ValueSpan, datom.Prefix.ValueTag, null!) == Cardinality.Many; + } + _isCardinalityMany = newIsCardinalityMany; + } /// diff --git a/src/NexusMods.MnemonicDB.Abstractions/AttributeResolver.cs b/src/NexusMods.MnemonicDB.Abstractions/AttributeResolver.cs index dd78a6a7..14f2cbb9 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/AttributeResolver.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/AttributeResolver.cs @@ -1,4 +1,7 @@ using System; +using System.Collections.Frozen; +using System.Linq; +using Microsoft.Extensions.DependencyInjection; using NexusMods.MnemonicDB.Abstractions.DatomIterators; namespace NexusMods.MnemonicDB.Abstractions; @@ -9,13 +12,37 @@ namespace NexusMods.MnemonicDB.Abstractions; /// public sealed class AttributeResolver { + private readonly FrozenDictionary _attrsById; + private AttributeCache _attributeCache; + + /// + /// Occasionally we need to turn the raw datoms from the database into a IReadDatom, this class + /// provides the mappings from AttributeId to IAttribute + /// + public AttributeResolver(IServiceProvider provider, AttributeCache cache) + { + ServiceProvider = provider; + _attributeCache = cache; + _attrsById = provider.GetServices().ToDictionary(a => a.Id).ToFrozenDictionary(); + } + + + /// + /// Resolves a datom into a IReadDatom + /// public IReadDatom Resolve(Datom datom) { - throw new System.NotImplementedException(); + var dbId = datom.A; + var symbol = _attributeCache.GetSymbol(dbId); + if (!_attrsById.TryGetValue(symbol, out var attr)) + { + throw new InvalidOperationException($"Attribute {symbol} not found"); + } + return attr.Resolve(datom.Prefix, datom.ValueSpan, this); } - + /// /// Gets the service object of the specified type. /// - public IServiceProvider ServiceProvider => throw new System.NotImplementedException(); + public IServiceProvider ServiceProvider { get; } } diff --git a/src/NexusMods.MnemonicDB.Abstractions/Datom.cs b/src/NexusMods.MnemonicDB.Abstractions/Datom.cs index d2a26b99..1aab945e 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/Datom.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/Datom.cs @@ -94,7 +94,23 @@ public Datom Clone() /// public override string ToString() { - throw new NotImplementedException(); + return $"[E: {E}, A: {A}, T: {T}, IsRetract: {IsRetract}, Value: {ValueSpan.Length}]"; + } + + /// + /// Returns the resolved version of this datom + /// + public IReadDatom Resolved(AttributeResolver resolver) + { + return resolver.Resolve(this); + } + + /// + /// Returns the resolved version of this datom + /// + public IReadDatom Resolved(IConnection conn) + { + return conn.AttributeResolver.Resolve(this); } /// diff --git a/src/NexusMods.MnemonicDB.Abstractions/IAttribute.cs b/src/NexusMods.MnemonicDB.Abstractions/IAttribute.cs index 2dbe1ac4..10e03626 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/IAttribute.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/IAttribute.cs @@ -33,12 +33,7 @@ public interface IAttribute /// in the datastore /// public Symbol Id { get; } - - /// - /// Gets the unique id of the attribute for the given registry - /// - public AttributeId GetDbId(RegistryId id); - + /// /// Sets the unique id of the attribute for the given registry /// diff --git a/src/NexusMods.MnemonicDB.Abstractions/IndexSegments/IndexSegment.cs b/src/NexusMods.MnemonicDB.Abstractions/IndexSegments/IndexSegment.cs index 46922131..ccef8c51 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/IndexSegments/IndexSegment.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/IndexSegments/IndexSegment.cs @@ -284,4 +284,16 @@ public bool MoveNext() /// public void Dispose() { } } + + /// + /// Returns the datoms in this segment as resolved datoms + /// + public IEnumerable Resolved(IConnection connection) + { + var resolver = connection.AttributeResolver; + foreach (var datom in this) + { + yield return resolver.Resolve(datom); + } + } } diff --git a/src/NexusMods.MnemonicDB.Abstractions/IndexSegments/IndexSegmentBuilder.cs b/src/NexusMods.MnemonicDB.Abstractions/IndexSegments/IndexSegmentBuilder.cs index d8a6d8f6..af9e476c 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/IndexSegments/IndexSegmentBuilder.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/IndexSegments/IndexSegmentBuilder.cs @@ -16,6 +16,11 @@ namespace NexusMods.MnemonicDB.Abstractions.IndexSegments; private readonly PooledMemoryBufferWriter _data; private readonly AttributeCache _attributeCache; + public IndexSegmentBuilder() + { + throw new NotSupportedException(); + } + /// /// Create a new index segment builder /// diff --git a/src/NexusMods.MnemonicDB.Abstractions/StoreResult.cs b/src/NexusMods.MnemonicDB.Abstractions/StoreResult.cs index da08ddc0..28d0b420 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/StoreResult.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/StoreResult.cs @@ -1,3 +1,4 @@ +using System.Collections.Frozen; using System.Collections.Generic; namespace NexusMods.MnemonicDB.Abstractions; @@ -15,7 +16,7 @@ public class StoreResult /// /// The remaps that were created during the transaction. /// - public required Dictionary Remaps { get; init; } + public required FrozenDictionary Remaps { get; init; } /// /// The snapshot of the store after the transaction. diff --git a/src/NexusMods.MnemonicDB/Connection.cs b/src/NexusMods.MnemonicDB/Connection.cs index 5f957ab0..548d2c42 100644 --- a/src/NexusMods.MnemonicDB/Connection.cs +++ b/src/NexusMods.MnemonicDB/Connection.cs @@ -38,7 +38,7 @@ public Connection(ILogger logger, IDatomStore store, IServiceProvide { ServiceProvider = provider; AttributeCache = store.AttributeCache; - AttributeResolver = new AttributeResolver(); + AttributeResolver = new AttributeResolver(provider, AttributeCache); _logger = logger; _declaredAttributes = declaredAttributes.ToDictionary(a => a.Id); _store = store; diff --git a/src/NexusMods.MnemonicDB/Db.cs b/src/NexusMods.MnemonicDB/Db.cs index 2b7a82c0..bc482ae2 100644 --- a/src/NexusMods.MnemonicDB/Db.cs +++ b/src/NexusMods.MnemonicDB/Db.cs @@ -99,7 +99,8 @@ public IndexSegment Get(EntityId entityId) public EntityIds GetBackRefs(ReferenceAttribute attribute, EntityId id) { - var segment = _cache.GetReverse(attribute.GetDbId(_registryId), id, this); + var aid = _connection!.AttributeCache.GetAttributeId(attribute.Id); + var segment = _cache.GetReverse(aid, id, this); return new EntityIds(segment, 0, segment.Count); } diff --git a/src/NexusMods.MnemonicDB/Storage/DatomStore.cs b/src/NexusMods.MnemonicDB/Storage/DatomStore.cs index 6d4ec1fc..8a8b24b8 100644 --- a/src/NexusMods.MnemonicDB/Storage/DatomStore.cs +++ b/src/NexusMods.MnemonicDB/Storage/DatomStore.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Concurrent; +using System.Collections.Frozen; using System.Collections.Generic; using System.Diagnostics; using System.Linq; @@ -68,6 +69,7 @@ public class DatomStore : IDatomStore private Thread? _loggerThread; private CancellationTokenSource _shutdownToken = new(); + private TxId _thisTx; /// /// DI constructor @@ -221,7 +223,7 @@ private void ConsumeTransactions() { var storeResult = new StoreResult { - Remaps = new Dictionary(), + Remaps = new Dictionary().ToFrozenDictionary(), AssignedTxId = _nextIdCache.AsOfTxId, Snapshot = _backend.GetSnapshot(), }; @@ -317,7 +319,7 @@ private void Bootstrap() #region Internals - private EntityId Remap(ISnapshot snapshot, EntityId id, TxId thisTx) + private EntityId Remap(EntityId id) { if (id.Partition == PartitionId.Temp) { @@ -325,14 +327,14 @@ private EntityId Remap(ISnapshot snapshot, EntityId id, TxId thisTx) { if (id.Value == PartitionId.Temp.MinValue) { - var remapTo = EntityId.From(thisTx.Value); + var remapTo = EntityId.From(_thisTx.Value); _remaps.Add(id, remapTo); return remapTo; } else { var partitionId = PartitionId.From((byte)(id.Value >> 40 & 0xFF)); - var assignedId = _nextIdCache.NextId(snapshot, partitionId); + var assignedId = _nextIdCache.NextId(_currentSnapshot!, partitionId); _remaps.Add(id, assignedId); return assignedId; } @@ -349,7 +351,7 @@ private void Log(PendingTransaction pendingTransaction, out StoreResult result) { var currentSnapshot = _currentSnapshot ?? _backend.GetSnapshot(); _remaps.Clear(); - var thisTx = TxId.From(_nextIdCache.NextId(currentSnapshot, PartitionId.Transactions).Value); + _thisTx = TxId.From(_nextIdCache.NextId(currentSnapshot, PartitionId.Transactions).Value); using var batch = _backend.CreateBatch(); @@ -358,7 +360,7 @@ private void Log(PendingTransaction pendingTransaction, out StoreResult result) _remaps = new Dictionary(); var secondaryBuilder = new IndexSegmentBuilder(_attributeCache); - var txId = EntityId.From(thisTx.Value); + var txId = EntityId.From(_thisTx.Value); secondaryBuilder.Add(txId, MnemonicDB.Abstractions.BuiltInEntities.Transaction.Timestamp, DateTime.UtcNow); if (pendingTransaction.TxFunctions != null) @@ -391,15 +393,15 @@ private void Log(PendingTransaction pendingTransaction, out StoreResult result) var currentPrefix = datom.Prefix; var attrId = currentPrefix.A; - var newE = isRemapped ? Remap(currentSnapshot, currentPrefix.E, thisTx) : currentPrefix.E; - var keyPrefix = currentPrefix with {E = newE, T = thisTx}; + var newE = isRemapped ? Remap(currentPrefix.E) : currentPrefix.E; + var keyPrefix = currentPrefix with {E = newE, T = _thisTx}; { _writer.WriteMarshal(keyPrefix); var valueSpan = datom.ValueSpan; var span = _writer.GetSpan(valueSpan.Length); valueSpan.CopyTo(span); - Remap(span); + Remap(in keyPrefix, span); _writer.Advance(valueSpan.Length); } @@ -419,7 +421,7 @@ private void Log(PendingTransaction pendingTransaction, out StoreResult result) ProcessAssert(batch, attrId, newSpan); break; case PrevState.Exists: - SwitchPrevToRetraction(thisTx); + SwitchPrevToRetraction(); ProcessRetract(batch, attrId, _retractWriter.GetWrittenSpan(), currentSnapshot); ProcessAssert(batch, attrId, newSpan); break; @@ -432,25 +434,33 @@ private void Log(PendingTransaction pendingTransaction, out StoreResult result) if (_logger.IsEnabled(LogLevel.Debug)) _logger.LogDebug("{TxId} ({Count} datoms, {Size}) prepared in {Elapsed}ms, written in {WriteElapsed}ms", - thisTx, + _thisTx, pendingTransaction.Data.Count + secondaryData.Count, pendingTransaction.Data.DataSize + secondaryData.DataSize, swPrepare.ElapsedMilliseconds - swWrite.ElapsedMilliseconds, swWrite.ElapsedMilliseconds); - _asOfTx = thisTx; + _asOfTx = _thisTx; _currentSnapshot = _backend.GetSnapshot(); result = new StoreResult { - AssignedTxId = thisTx, - Remaps = _remaps, + AssignedTxId = _thisTx, + Remaps = _remaps.ToFrozenDictionary(), Snapshot = _currentSnapshot }; } - private void Remap(Span valueSpan) + private void Remap(in KeyPrefix prefix, Span valueSpan) { + switch (prefix.ValueTag) + { + case ValueTags.Reference: + var oldId = MemoryMarshal.Read(valueSpan); + var newId = Remap(oldId); + MemoryMarshal.Write(valueSpan, newId); + break; + } } @@ -459,10 +469,10 @@ private void Remap(Span valueSpan) /// /// /// - private void SwitchPrevToRetraction(TxId thisTx) + private void SwitchPrevToRetraction() { var prevKey = MemoryMarshal.Read(_retractWriter.GetWrittenSpan()); - prevKey = prevKey with {T = thisTx, IsRetract = true}; + prevKey = prevKey with {T = _thisTx, IsRetract = true}; MemoryMarshal.Write(_retractWriter.GetWrittenSpanWritable(), prevKey); } diff --git a/src/NexusMods.MnemonicDB/Storage/InMemoryBackend/Batch.cs b/src/NexusMods.MnemonicDB/Storage/InMemoryBackend/Batch.cs index e8c5843a..0f7ff796 100644 --- a/src/NexusMods.MnemonicDB/Storage/InMemoryBackend/Batch.cs +++ b/src/NexusMods.MnemonicDB/Storage/InMemoryBackend/Batch.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; +using System.Runtime.InteropServices; using NexusMods.MnemonicDB.Abstractions; using NexusMods.MnemonicDB.Abstractions.DatomIterators; +using NexusMods.MnemonicDB.Abstractions.Internals; using NexusMods.MnemonicDB.Storage.Abstractions; using IWriteBatch = NexusMods.MnemonicDB.Storage.Abstractions.IWriteBatch; @@ -29,7 +31,7 @@ public void Add(IIndexStore store, ReadOnlySpan key) { if (store is not IndexStore indexStore) throw new ArgumentException("Invalid store type", nameof(store)); - + if (!_datoms.TryGetValue(indexStore.Type, out var datoms)) { datoms = new List<(bool IsDelete, byte[] Data)>(); diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/ABackendTest.cs b/tests/NexusMods.MnemonicDB.Storage.Tests/ABackendTest.cs index 91484516..1bdd29ef 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/ABackendTest.cs +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/ABackendTest.cs @@ -153,7 +153,7 @@ private async Task GenerateData() { - using var segment = new IndexSegmentBuilder(); + using var segment = new IndexSegmentBuilder(AttributeCache); segment.Add(id1, File.Path, "/foo/bar"); segment.Add(id1, File.Hash, Hash.From(0xDEADBEEF)); @@ -184,7 +184,7 @@ private async Task GenerateData() collectionId = tx.Remaps[collectionId]; { - using var segment = new IndexSegmentBuilder(); + using var segment = new IndexSegmentBuilder(AttributeCache); segment.Add(id2, File.Path, "/foo/qux"); segment.Add(id1, File.ModId, modId2); segment.Add(collectionId, Collection.ModIds, modId2, true); @@ -211,7 +211,7 @@ public async Task RetractedValuesAreSupported(IndexType type) StoreResult tx1, tx2; { - using var segment = new IndexSegmentBuilder(); + using var segment = new IndexSegmentBuilder(AttributeCache); segment.Add(id, File.Path, "/foo/bar"); segment.Add(id, File.Hash, Hash.From(0xDEADBEEF)); @@ -225,7 +225,7 @@ public async Task RetractedValuesAreSupported(IndexType type) modId = tx1.Remaps[modId]; { - using var segment = new IndexSegmentBuilder(); + using var segment = new IndexSegmentBuilder(AttributeCache); segment.Add(id, File.Path, "/foo/bar", true); segment.Add(id, File.Hash, Hash.From(0xDEADBEEF), true); diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.CanStoreDataInBlobs_type=AEVTCurrent.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.CanStoreDataInBlobs_type=AEVTCurrent.verified.txt index df10f976..125c7e99 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.CanStoreDataInBlobs_type=AEVTCurrent.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.CanStoreDataInBlobs_type=AEVTCurrent.verified.txt @@ -6,6 +6,18 @@ + | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001 + | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 + | 0000000000000001 | (0002) ValueType | Ascii | 0100000000000001 + | 0000000000000002 | (0002) ValueType | UInt8 | 0100000000000001 + | 0000000000000003 | (0002) ValueType | Null | 0100000000000001 @@ -14,16 +26,46 @@ + | 0000000000000006 | (0002) ValueType | UInt8 | 0100000000000001 + | 0000000000000007 | (0002) ValueType | Utf8 | 0100000000000001 + | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001 -+ | 0000000000000001 | (0003) Indexed | Null | 0100000000000001 -+ | 0000000000000007 | (0004) Optional | Null | 0100000000000001 -+ | 0000000000000001 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000002 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000003 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000004 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000005 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000006 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000007 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000008 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002 ++ | 0000000000000015 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000016 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000017 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000018 | (0002) ValueType | Utf8 | 0100000000000002 ++ | 0000000000000019 | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001A | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001B | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001C | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001D | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001E | (0002) ValueType | Blob | 0100000000000002 ++ | 000000000000001F | (0002) ValueType | HashedBlob | 0100000000000002 ++ | 0000000000000001 | (0003) Indexed | | 0100000000000001 ++ | 0000000000000014 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000015 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000018 | (0003) Indexed | | 0100000000000002 ++ | 000000000000001A | (0003) Indexed | | 0100000000000002 ++ | 000000000000001E | (0003) Indexed | | 0100000000000002 ++ | 000000000000001F | (0003) Indexed | | 0100000000000002 ++ | 0000000000000007 | (0004) Optional | | 0100000000000001 ++ | 0000000000000001 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000002 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000003 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000004 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000005 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000006 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000007 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000014 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000015 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000016 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000017 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000018 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000019 | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001A | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001B | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001C | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001D | (0006) Cardinality | 2 | 0100000000000002 ++ | 000000000000001E | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001F | (0006) Cardinality | 1 | 0100000000000002 + | 0100000000000001 | (0008) Timestamp | DateTime : 0 | 0100000000000001 + | 0100000000000002 | (0008) Timestamp | DateTime : 1 | 0100000000000002 + | 0100000000000003 | (0008) Timestamp | DateTime : 2 | 0100000000000003 @@ -31,7 +73,8 @@ + | 0100000000000005 | (0008) Timestamp | DateTime : 4 | 0100000000000005 + | 0100000000000006 | (0008) Timestamp | DateTime : 5 | 0100000000000006 + | 0100000000000007 | (0008) Timestamp | DateTime : 6 | 0100000000000007 -+ | 0200000000000003 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000004 -+ | 0200000000000004 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000005 -+ | 0200000000000003 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000004 -+ | 0200000000000004 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000005 ++ | 0100000000000008 | (0008) Timestamp | DateTime : 7 | 0100000000000008 ++ | 0200000000000003 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000005 ++ | 0200000000000004 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000006 ++ | 0200000000000003 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000005 ++ | 0200000000000004 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000006 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.CanStoreDataInBlobs_type=AEVTHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.CanStoreDataInBlobs_type=AEVTHistory.verified.txt index a3f9a98f..27ce3fe3 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.CanStoreDataInBlobs_type=AEVTHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.CanStoreDataInBlobs_type=AEVTHistory.verified.txt @@ -1,8 +1,8 @@ -+ | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000002 -- | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000006 -+ | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000003 -- | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000007 -+ | 0200000000000001 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000002 -- | 0200000000000001 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000006 -+ | 0200000000000002 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000003 -- | 0200000000000002 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000007 ++ | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000003 +- | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000007 ++ | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000004 +- | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000008 ++ | 0200000000000001 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000003 +- | 0200000000000001 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000007 ++ | 0200000000000002 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000004 +- | 0200000000000002 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000008 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.CanStoreDataInBlobs_type=AVETCurrent.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.CanStoreDataInBlobs_type=AVETCurrent.verified.txt index d3b822ee..35cd1d58 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.CanStoreDataInBlobs_type=AVETCurrent.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.CanStoreDataInBlobs_type=AVETCurrent.verified.txt @@ -5,8 +5,20 @@ + | 0000000000000004 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Optional | 0100000000000001 + | 0000000000000001 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/UniqueId | 0100000000000001 + | 0000000000000002 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/ValueType | 0100000000000001 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 -+ | 0200000000000003 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000004 -+ | 0200000000000004 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000005 -+ | 0200000000000003 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000004 -+ | 0200000000000004 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000005 ++ | 0200000000000003 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000005 ++ | 0200000000000004 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000006 ++ | 0200000000000003 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000005 ++ | 0200000000000004 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000006 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.CanStoreDataInBlobs_type=AVETHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.CanStoreDataInBlobs_type=AVETHistory.verified.txt index a3f9a98f..27ce3fe3 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.CanStoreDataInBlobs_type=AVETHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.CanStoreDataInBlobs_type=AVETHistory.verified.txt @@ -1,8 +1,8 @@ -+ | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000002 -- | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000006 -+ | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000003 -- | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000007 -+ | 0200000000000001 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000002 -- | 0200000000000001 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000006 -+ | 0200000000000002 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000003 -- | 0200000000000002 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000007 ++ | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000003 +- | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000007 ++ | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000004 +- | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000008 ++ | 0200000000000001 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000003 +- | 0200000000000001 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000007 ++ | 0200000000000002 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000004 +- | 0200000000000002 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000008 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.CanStoreDataInBlobs_type=EAVTCurrent.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.CanStoreDataInBlobs_type=EAVTCurrent.verified.txt index c7ba26a8..bf21d10a 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.CanStoreDataInBlobs_type=EAVTCurrent.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.CanStoreDataInBlobs_type=EAVTCurrent.verified.txt @@ -1,29 +1,71 @@ + | 0000000000000001 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/UniqueId | 0100000000000001 + | 0000000000000001 | (0002) ValueType | Ascii | 0100000000000001 -+ | 0000000000000001 | (0003) Indexed | Null | 0100000000000001 -+ | 0000000000000001 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000001 | (0003) Indexed | | 0100000000000001 ++ | 0000000000000001 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000002 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/ValueType | 0100000000000001 + | 0000000000000002 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000002 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000002 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000003 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Indexed | 0100000000000001 + | 0000000000000003 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000003 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000003 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000004 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Optional | 0100000000000001 + | 0000000000000004 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000004 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000004 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000005 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/NoHistory | 0100000000000001 + | 0000000000000005 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000005 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000005 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001 + | 0000000000000006 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000006 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000006 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001 + | 0000000000000007 | (0002) ValueType | Utf8 | 0100000000000001 -+ | 0000000000000007 | (0004) Optional | Null | 0100000000000001 -+ | 0000000000000007 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000007 | (0004) Optional | | 0100000000000001 ++ | 0000000000000007 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 + | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001 -+ | 0000000000000008 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002 ++ | 0000000000000014 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000014 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000015 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000015 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000015 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 0000000000000016 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000016 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000017 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000017 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 ++ | 0000000000000018 | (0002) ValueType | Utf8 | 0100000000000002 ++ | 0000000000000018 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000018 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 0000000000000019 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000019 | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 000000000000001A | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001A | (0003) Indexed | | 0100000000000002 ++ | 000000000000001A | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 000000000000001B | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001B | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001C | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001C | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001D | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001D | (0006) Cardinality | 2 | 0100000000000002 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001E | (0002) ValueType | Blob | 0100000000000002 ++ | 000000000000001E | (0003) Indexed | | 0100000000000002 ++ | 000000000000001E | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 ++ | 000000000000001F | (0002) ValueType | HashedBlob | 0100000000000002 ++ | 000000000000001F | (0003) Indexed | | 0100000000000002 ++ | 000000000000001F | (0006) Cardinality | 1 | 0100000000000002 + | 0100000000000001 | (0008) Timestamp | DateTime : 0 | 0100000000000001 + | 0100000000000002 | (0008) Timestamp | DateTime : 1 | 0100000000000002 + | 0100000000000003 | (0008) Timestamp | DateTime : 2 | 0100000000000003 @@ -31,7 +73,8 @@ + | 0100000000000005 | (0008) Timestamp | DateTime : 4 | 0100000000000005 + | 0100000000000006 | (0008) Timestamp | DateTime : 5 | 0100000000000006 + | 0100000000000007 | (0008) Timestamp | DateTime : 6 | 0100000000000007 -+ | 0200000000000003 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000004 -+ | 0200000000000003 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000004 -+ | 0200000000000004 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000005 -+ | 0200000000000004 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000005 ++ | 0100000000000008 | (0008) Timestamp | DateTime : 7 | 0100000000000008 ++ | 0200000000000003 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000005 ++ | 0200000000000003 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000005 ++ | 0200000000000004 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000006 ++ | 0200000000000004 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000006 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.CanStoreDataInBlobs_type=EAVTHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.CanStoreDataInBlobs_type=EAVTHistory.verified.txt index c20a8346..439103de 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.CanStoreDataInBlobs_type=EAVTHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.CanStoreDataInBlobs_type=EAVTHistory.verified.txt @@ -1,8 +1,8 @@ -+ | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000002 -- | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000006 -+ | 0200000000000001 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000002 -- | 0200000000000001 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000006 -+ | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000003 -- | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000007 -+ | 0200000000000002 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000003 -- | 0200000000000002 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000007 ++ | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000003 +- | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000007 ++ | 0200000000000001 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000003 +- | 0200000000000001 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000007 ++ | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000004 +- | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000008 ++ | 0200000000000002 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000004 +- | 0200000000000002 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000008 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.CanStoreDataInBlobs_type=TxLog.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.CanStoreDataInBlobs_type=TxLog.verified.txt index e9661d68..6b09289d 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.CanStoreDataInBlobs_type=TxLog.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.CanStoreDataInBlobs_type=TxLog.verified.txt @@ -1,45 +1,88 @@ + | 0000000000000001 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/UniqueId | 0100000000000001 + | 0000000000000001 | (0002) ValueType | Ascii | 0100000000000001 -+ | 0000000000000001 | (0003) Indexed | Null | 0100000000000001 -+ | 0000000000000001 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000001 | (0003) Indexed | | 0100000000000001 ++ | 0000000000000001 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000002 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/ValueType | 0100000000000001 + | 0000000000000002 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000002 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000002 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000003 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Indexed | 0100000000000001 + | 0000000000000003 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000003 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000003 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000004 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Optional | 0100000000000001 + | 0000000000000004 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000004 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000004 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000005 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/NoHistory | 0100000000000001 + | 0000000000000005 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000005 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000005 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001 + | 0000000000000006 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000006 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000006 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001 + | 0000000000000007 | (0002) ValueType | Utf8 | 0100000000000001 -+ | 0000000000000007 | (0004) Optional | Null | 0100000000000001 -+ | 0000000000000007 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000007 | (0004) Optional | | 0100000000000001 ++ | 0000000000000007 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 + | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001 -+ | 0000000000000008 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001 + | 0100000000000001 | (0008) Timestamp | DateTime : 0 | 0100000000000001 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002 ++ | 0000000000000014 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000014 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000015 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000015 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000015 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 0000000000000016 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000016 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000017 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000017 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 ++ | 0000000000000018 | (0002) ValueType | Utf8 | 0100000000000002 ++ | 0000000000000018 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000018 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 0000000000000019 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000019 | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 000000000000001A | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001A | (0003) Indexed | | 0100000000000002 ++ | 000000000000001A | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 000000000000001B | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001B | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001C | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001C | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001D | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001D | (0006) Cardinality | 2 | 0100000000000002 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001E | (0002) ValueType | Blob | 0100000000000002 ++ | 000000000000001E | (0003) Indexed | | 0100000000000002 ++ | 000000000000001E | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 ++ | 000000000000001F | (0002) ValueType | HashedBlob | 0100000000000002 ++ | 000000000000001F | (0003) Indexed | | 0100000000000002 ++ | 000000000000001F | (0006) Cardinality | 1 | 0100000000000002 + | 0100000000000002 | (0008) Timestamp | DateTime : 1 | 0100000000000002 -+ | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000002 -+ | 0200000000000001 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000002 + | 0100000000000003 | (0008) Timestamp | DateTime : 2 | 0100000000000003 -+ | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000003 -+ | 0200000000000002 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000003 ++ | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000003 ++ | 0200000000000001 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000003 + | 0100000000000004 | (0008) Timestamp | DateTime : 3 | 0100000000000004 -+ | 0200000000000003 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000004 -+ | 0200000000000003 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000004 ++ | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000004 ++ | 0200000000000002 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000004 + | 0100000000000005 | (0008) Timestamp | DateTime : 4 | 0100000000000005 -+ | 0200000000000004 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000005 -+ | 0200000000000004 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000005 ++ | 0200000000000003 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000005 ++ | 0200000000000003 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000005 + | 0100000000000006 | (0008) Timestamp | DateTime : 5 | 0100000000000006 -- | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000006 -- | 0200000000000001 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000006 ++ | 0200000000000004 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000006 ++ | 0200000000000004 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000006 + | 0100000000000007 | (0008) Timestamp | DateTime : 6 | 0100000000000007 -- | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000007 -- | 0200000000000002 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000007 +- | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000007 +- | 0200000000000001 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000007 ++ | 0100000000000008 | (0008) Timestamp | DateTime : 7 | 0100000000000008 +- | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000008 +- | 0200000000000002 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000008 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=AEVTCurrent.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=AEVTCurrent.verified.txt index 2f0276f2..5c739271 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=AEVTCurrent.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=AEVTCurrent.verified.txt @@ -6,6 +6,18 @@ + | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001 + | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 + | 0000000000000001 | (0002) ValueType | Ascii | 0100000000000001 + | 0000000000000002 | (0002) ValueType | UInt8 | 0100000000000001 + | 0000000000000003 | (0002) ValueType | Null | 0100000000000001 @@ -14,38 +26,69 @@ + | 0000000000000006 | (0002) ValueType | UInt8 | 0100000000000001 + | 0000000000000007 | (0002) ValueType | Utf8 | 0100000000000001 + | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001 -+ | 0000000000000001 | (0003) Indexed | Null | 0100000000000001 -+ | 0000000000000007 | (0004) Optional | Null | 0100000000000001 -+ | 0000000000000001 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000002 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000003 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000004 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000005 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000006 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000007 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000008 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002 ++ | 0000000000000015 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000016 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000017 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000018 | (0002) ValueType | Utf8 | 0100000000000002 ++ | 0000000000000019 | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001A | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001B | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001C | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001D | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001E | (0002) ValueType | Blob | 0100000000000002 ++ | 000000000000001F | (0002) ValueType | HashedBlob | 0100000000000002 ++ | 0000000000000001 | (0003) Indexed | | 0100000000000001 ++ | 0000000000000014 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000015 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000018 | (0003) Indexed | | 0100000000000002 ++ | 000000000000001A | (0003) Indexed | | 0100000000000002 ++ | 000000000000001E | (0003) Indexed | | 0100000000000002 ++ | 000000000000001F | (0003) Indexed | | 0100000000000002 ++ | 0000000000000007 | (0004) Optional | | 0100000000000001 ++ | 0000000000000001 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000002 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000003 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000004 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000005 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000006 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000007 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000014 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000015 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000016 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000017 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000018 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000019 | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001A | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001B | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001C | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001D | (0006) Cardinality | 2 | 0100000000000002 ++ | 000000000000001E | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001F | (0006) Cardinality | 1 | 0100000000000002 + | 0100000000000001 | (0008) Timestamp | DateTime : 0 | 0100000000000001 + | 0100000000000002 | (0008) Timestamp | DateTime : 1 | 0100000000000002 + | 0100000000000003 | (0008) Timestamp | DateTime : 2 | 0100000000000003 -+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000002 -+ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000003 -+ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000002 -- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 -+ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000002 -+ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000002 -+ | 0200000000000001 | (0016) Size | 42 B | 0100000000000002 -+ | 0200000000000002 | (0016) Size | 77 B | 0100000000000002 -+ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000002 -- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 -+ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000003 -+ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000002 -+ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000002 -+ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000002 -+ | 0200000000000006 | (001B) Name | Test Collection 1 | 0100000000000002 -+ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000002 -- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 ++ | 0100000000000004 | (0008) Timestamp | DateTime : 3 | 0100000000000004 ++ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 ++ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000004 ++ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 +- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000004 ++ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 ++ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000003 ++ | 0200000000000001 | (0016) Size | 0x000000000000002A | 0100000000000003 ++ | 0200000000000002 | (0016) Size | 0x000000000000004D | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 +- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000004 ++ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000004 ++ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000003 ++ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000003 ++ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000003 ++ | 0200000000000006 | (001B) Name | Test Collection 1 | 0100000000000003 ++ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 +- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=AEVTHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=AEVTHistory.verified.txt index 2f0276f2..5c739271 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=AEVTHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=AEVTHistory.verified.txt @@ -6,6 +6,18 @@ + | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001 + | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 + | 0000000000000001 | (0002) ValueType | Ascii | 0100000000000001 + | 0000000000000002 | (0002) ValueType | UInt8 | 0100000000000001 + | 0000000000000003 | (0002) ValueType | Null | 0100000000000001 @@ -14,38 +26,69 @@ + | 0000000000000006 | (0002) ValueType | UInt8 | 0100000000000001 + | 0000000000000007 | (0002) ValueType | Utf8 | 0100000000000001 + | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001 -+ | 0000000000000001 | (0003) Indexed | Null | 0100000000000001 -+ | 0000000000000007 | (0004) Optional | Null | 0100000000000001 -+ | 0000000000000001 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000002 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000003 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000004 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000005 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000006 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000007 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000008 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002 ++ | 0000000000000015 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000016 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000017 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000018 | (0002) ValueType | Utf8 | 0100000000000002 ++ | 0000000000000019 | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001A | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001B | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001C | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001D | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001E | (0002) ValueType | Blob | 0100000000000002 ++ | 000000000000001F | (0002) ValueType | HashedBlob | 0100000000000002 ++ | 0000000000000001 | (0003) Indexed | | 0100000000000001 ++ | 0000000000000014 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000015 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000018 | (0003) Indexed | | 0100000000000002 ++ | 000000000000001A | (0003) Indexed | | 0100000000000002 ++ | 000000000000001E | (0003) Indexed | | 0100000000000002 ++ | 000000000000001F | (0003) Indexed | | 0100000000000002 ++ | 0000000000000007 | (0004) Optional | | 0100000000000001 ++ | 0000000000000001 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000002 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000003 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000004 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000005 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000006 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000007 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000014 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000015 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000016 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000017 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000018 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000019 | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001A | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001B | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001C | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001D | (0006) Cardinality | 2 | 0100000000000002 ++ | 000000000000001E | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001F | (0006) Cardinality | 1 | 0100000000000002 + | 0100000000000001 | (0008) Timestamp | DateTime : 0 | 0100000000000001 + | 0100000000000002 | (0008) Timestamp | DateTime : 1 | 0100000000000002 + | 0100000000000003 | (0008) Timestamp | DateTime : 2 | 0100000000000003 -+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000002 -+ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000003 -+ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000002 -- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 -+ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000002 -+ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000002 -+ | 0200000000000001 | (0016) Size | 42 B | 0100000000000002 -+ | 0200000000000002 | (0016) Size | 77 B | 0100000000000002 -+ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000002 -- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 -+ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000003 -+ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000002 -+ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000002 -+ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000002 -+ | 0200000000000006 | (001B) Name | Test Collection 1 | 0100000000000002 -+ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000002 -- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 ++ | 0100000000000004 | (0008) Timestamp | DateTime : 3 | 0100000000000004 ++ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 ++ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000004 ++ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 +- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000004 ++ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 ++ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000003 ++ | 0200000000000001 | (0016) Size | 0x000000000000002A | 0100000000000003 ++ | 0200000000000002 | (0016) Size | 0x000000000000004D | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 +- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000004 ++ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000004 ++ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000003 ++ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000003 ++ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000003 ++ | 0200000000000006 | (001B) Name | Test Collection 1 | 0100000000000003 ++ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 +- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=AVETCurrent.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=AVETCurrent.verified.txt index 97e440a0..00af726a 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=AVETCurrent.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=AVETCurrent.verified.txt @@ -5,13 +5,25 @@ + | 0000000000000004 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Optional | 0100000000000001 + | 0000000000000001 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/UniqueId | 0100000000000001 + | 0000000000000002 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/ValueType | 0100000000000001 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 -+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000002 -+ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000003 -+ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000002 -- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 -+ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000002 -+ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000002 -+ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000002 -+ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000002 -+ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000002 ++ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 ++ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000004 ++ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 +- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000004 ++ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000003 ++ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 ++ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000003 ++ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000003 ++ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000003 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=AVETHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=AVETHistory.verified.txt index 97e440a0..00af726a 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=AVETHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=AVETHistory.verified.txt @@ -5,13 +5,25 @@ + | 0000000000000004 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Optional | 0100000000000001 + | 0000000000000001 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/UniqueId | 0100000000000001 + | 0000000000000002 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/ValueType | 0100000000000001 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 -+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000002 -+ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000003 -+ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000002 -- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 -+ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000002 -+ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000002 -+ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000002 -+ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000002 -+ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000002 ++ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 ++ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000004 ++ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 +- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000004 ++ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000003 ++ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 ++ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000003 ++ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000003 ++ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000003 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=EAVTCurrent.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=EAVTCurrent.verified.txt index 347c96a5..e3698fc8 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=EAVTCurrent.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=EAVTCurrent.verified.txt @@ -1,51 +1,94 @@ + | 0000000000000001 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/UniqueId | 0100000000000001 + | 0000000000000001 | (0002) ValueType | Ascii | 0100000000000001 -+ | 0000000000000001 | (0003) Indexed | Null | 0100000000000001 -+ | 0000000000000001 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000001 | (0003) Indexed | | 0100000000000001 ++ | 0000000000000001 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000002 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/ValueType | 0100000000000001 + | 0000000000000002 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000002 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000002 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000003 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Indexed | 0100000000000001 + | 0000000000000003 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000003 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000003 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000004 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Optional | 0100000000000001 + | 0000000000000004 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000004 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000004 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000005 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/NoHistory | 0100000000000001 + | 0000000000000005 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000005 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000005 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001 + | 0000000000000006 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000006 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000006 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001 + | 0000000000000007 | (0002) ValueType | Utf8 | 0100000000000001 -+ | 0000000000000007 | (0004) Optional | Null | 0100000000000001 -+ | 0000000000000007 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000007 | (0004) Optional | | 0100000000000001 ++ | 0000000000000007 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 + | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001 -+ | 0000000000000008 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002 ++ | 0000000000000014 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000014 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000015 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000015 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000015 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 0000000000000016 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000016 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000017 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000017 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 ++ | 0000000000000018 | (0002) ValueType | Utf8 | 0100000000000002 ++ | 0000000000000018 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000018 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 0000000000000019 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000019 | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 000000000000001A | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001A | (0003) Indexed | | 0100000000000002 ++ | 000000000000001A | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 000000000000001B | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001B | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001C | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001C | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001D | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001D | (0006) Cardinality | 2 | 0100000000000002 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001E | (0002) ValueType | Blob | 0100000000000002 ++ | 000000000000001E | (0003) Indexed | | 0100000000000002 ++ | 000000000000001E | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 ++ | 000000000000001F | (0002) ValueType | HashedBlob | 0100000000000002 ++ | 000000000000001F | (0003) Indexed | | 0100000000000002 ++ | 000000000000001F | (0006) Cardinality | 1 | 0100000000000002 + | 0100000000000001 | (0008) Timestamp | DateTime : 0 | 0100000000000001 + | 0100000000000002 | (0008) Timestamp | DateTime : 1 | 0100000000000002 + | 0100000000000003 | (0008) Timestamp | DateTime : 2 | 0100000000000003 -+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000002 -+ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000002 -+ | 0200000000000001 | (0016) Size | 42 B | 0100000000000002 -+ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000002 -- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 -+ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000003 -+ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000003 -+ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000002 -- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 -+ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000002 -+ | 0200000000000002 | (0016) Size | 77 B | 0100000000000002 -+ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000002 -+ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000002 -+ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000002 -+ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000006 | (001B) Name | Test Collection 1 | 0100000000000002 -+ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000002 -- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 ++ | 0100000000000004 | (0008) Timestamp | DateTime : 3 | 0100000000000004 ++ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 ++ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 ++ | 0200000000000001 | (0016) Size | 0x000000000000002A | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 +- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000004 ++ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000004 ++ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000004 ++ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 +- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000004 ++ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000003 ++ | 0200000000000002 | (0016) Size | 0x000000000000004D | 0100000000000003 ++ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000003 ++ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000003 ++ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000003 ++ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000006 | (001B) Name | Test Collection 1 | 0100000000000003 ++ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 +- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=EAVTHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=EAVTHistory.verified.txt index 347c96a5..e3698fc8 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=EAVTHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=EAVTHistory.verified.txt @@ -1,51 +1,94 @@ + | 0000000000000001 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/UniqueId | 0100000000000001 + | 0000000000000001 | (0002) ValueType | Ascii | 0100000000000001 -+ | 0000000000000001 | (0003) Indexed | Null | 0100000000000001 -+ | 0000000000000001 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000001 | (0003) Indexed | | 0100000000000001 ++ | 0000000000000001 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000002 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/ValueType | 0100000000000001 + | 0000000000000002 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000002 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000002 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000003 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Indexed | 0100000000000001 + | 0000000000000003 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000003 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000003 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000004 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Optional | 0100000000000001 + | 0000000000000004 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000004 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000004 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000005 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/NoHistory | 0100000000000001 + | 0000000000000005 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000005 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000005 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001 + | 0000000000000006 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000006 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000006 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001 + | 0000000000000007 | (0002) ValueType | Utf8 | 0100000000000001 -+ | 0000000000000007 | (0004) Optional | Null | 0100000000000001 -+ | 0000000000000007 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000007 | (0004) Optional | | 0100000000000001 ++ | 0000000000000007 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 + | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001 -+ | 0000000000000008 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002 ++ | 0000000000000014 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000014 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000015 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000015 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000015 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 0000000000000016 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000016 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000017 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000017 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 ++ | 0000000000000018 | (0002) ValueType | Utf8 | 0100000000000002 ++ | 0000000000000018 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000018 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 0000000000000019 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000019 | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 000000000000001A | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001A | (0003) Indexed | | 0100000000000002 ++ | 000000000000001A | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 000000000000001B | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001B | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001C | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001C | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001D | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001D | (0006) Cardinality | 2 | 0100000000000002 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001E | (0002) ValueType | Blob | 0100000000000002 ++ | 000000000000001E | (0003) Indexed | | 0100000000000002 ++ | 000000000000001E | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 ++ | 000000000000001F | (0002) ValueType | HashedBlob | 0100000000000002 ++ | 000000000000001F | (0003) Indexed | | 0100000000000002 ++ | 000000000000001F | (0006) Cardinality | 1 | 0100000000000002 + | 0100000000000001 | (0008) Timestamp | DateTime : 0 | 0100000000000001 + | 0100000000000002 | (0008) Timestamp | DateTime : 1 | 0100000000000002 + | 0100000000000003 | (0008) Timestamp | DateTime : 2 | 0100000000000003 -+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000002 -+ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000002 -+ | 0200000000000001 | (0016) Size | 42 B | 0100000000000002 -+ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000002 -- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 -+ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000003 -+ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000003 -+ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000002 -- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 -+ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000002 -+ | 0200000000000002 | (0016) Size | 77 B | 0100000000000002 -+ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000002 -+ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000002 -+ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000002 -+ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000006 | (001B) Name | Test Collection 1 | 0100000000000002 -+ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000002 -- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 ++ | 0100000000000004 | (0008) Timestamp | DateTime : 3 | 0100000000000004 ++ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 ++ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 ++ | 0200000000000001 | (0016) Size | 0x000000000000002A | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 +- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000004 ++ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000004 ++ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000004 ++ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 +- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000004 ++ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000003 ++ | 0200000000000002 | (0016) Size | 0x000000000000004D | 0100000000000003 ++ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000003 ++ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000003 ++ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000003 ++ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000006 | (001B) Name | Test Collection 1 | 0100000000000003 ++ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 +- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=VAETCurrent.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=VAETCurrent.verified.txt index 02a18d5a..d425c02d 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=VAETCurrent.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=VAETCurrent.verified.txt @@ -1,10 +1,10 @@ -+ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000002 -- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 -+ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000003 -+ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000002 -- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 +- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000004 ++ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000004 ++ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 +- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=VAETHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=VAETHistory.verified.txt index 02a18d5a..d425c02d 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=VAETHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.HistoricalQueriesReturnAllDataSorted_type=VAETHistory.verified.txt @@ -1,10 +1,10 @@ -+ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000002 -- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 -+ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000003 -+ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000002 -- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 +- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000004 ++ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000004 ++ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 +- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=AEVTCurrent.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=AEVTCurrent.verified.txt index 9034a673..72be7490 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=AEVTCurrent.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=AEVTCurrent.verified.txt @@ -6,6 +6,18 @@ + | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001 + | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 + | 0000000000000001 | (0002) ValueType | Ascii | 0100000000000001 + | 0000000000000002 | (0002) ValueType | UInt8 | 0100000000000001 + | 0000000000000003 | (0002) ValueType | Null | 0100000000000001 @@ -14,32 +26,63 @@ + | 0000000000000006 | (0002) ValueType | UInt8 | 0100000000000001 + | 0000000000000007 | (0002) ValueType | Utf8 | 0100000000000001 + | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001 -+ | 0000000000000001 | (0003) Indexed | Null | 0100000000000001 -+ | 0000000000000007 | (0004) Optional | Null | 0100000000000001 -+ | 0000000000000001 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000002 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000003 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000004 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000005 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000006 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000007 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000008 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002 ++ | 0000000000000015 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000016 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000017 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000018 | (0002) ValueType | Utf8 | 0100000000000002 ++ | 0000000000000019 | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001A | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001B | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001C | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001D | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001E | (0002) ValueType | Blob | 0100000000000002 ++ | 000000000000001F | (0002) ValueType | HashedBlob | 0100000000000002 ++ | 0000000000000001 | (0003) Indexed | | 0100000000000001 ++ | 0000000000000014 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000015 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000018 | (0003) Indexed | | 0100000000000002 ++ | 000000000000001A | (0003) Indexed | | 0100000000000002 ++ | 000000000000001E | (0003) Indexed | | 0100000000000002 ++ | 000000000000001F | (0003) Indexed | | 0100000000000002 ++ | 0000000000000007 | (0004) Optional | | 0100000000000001 ++ | 0000000000000001 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000002 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000003 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000004 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000005 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000006 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000007 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000014 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000015 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000016 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000017 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000018 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000019 | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001A | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001B | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001C | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001D | (0006) Cardinality | 2 | 0100000000000002 ++ | 000000000000001E | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001F | (0006) Cardinality | 1 | 0100000000000002 + | 0100000000000001 | (0008) Timestamp | DateTime : 0 | 0100000000000001 + | 0100000000000002 | (0008) Timestamp | DateTime : 1 | 0100000000000002 + | 0100000000000003 | (0008) Timestamp | DateTime : 2 | 0100000000000003 -+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000002 -+ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000003 -+ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000002 -+ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000002 -+ | 0200000000000001 | (0016) Size | 42 B | 0100000000000002 -+ | 0200000000000002 | (0016) Size | 77 B | 0100000000000002 -+ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000003 -+ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000002 -+ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000002 -+ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000002 -+ | 0200000000000006 | (001B) Name | Test Collection 1 | 0100000000000002 -+ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000002 ++ | 0100000000000004 | (0008) Timestamp | DateTime : 3 | 0100000000000004 ++ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 ++ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000004 ++ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 ++ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000003 ++ | 0200000000000001 | (0016) Size | 0x000000000000002A | 0100000000000003 ++ | 0200000000000002 | (0016) Size | 0x000000000000004D | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000004 ++ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000003 ++ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000003 ++ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000003 ++ | 0200000000000006 | (001B) Name | Test Collection 1 | 0100000000000003 ++ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000003 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=AEVTHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=AEVTHistory.verified.txt index 6a55c6f7..f33a780d 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=AEVTHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=AEVTHistory.verified.txt @@ -1,6 +1,6 @@ -+ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000002 -- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 -+ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000002 -- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 -+ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000002 -- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 ++ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 +- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000004 ++ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 +- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000004 ++ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 +- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=AVETCurrent.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=AVETCurrent.verified.txt index 6b4a33ad..923689a6 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=AVETCurrent.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=AVETCurrent.verified.txt @@ -5,11 +5,23 @@ + | 0000000000000004 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Optional | 0100000000000001 + | 0000000000000001 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/UniqueId | 0100000000000001 + | 0000000000000002 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/ValueType | 0100000000000001 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 -+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000002 -+ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000003 -+ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000002 -+ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000002 -+ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000002 -+ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000002 -+ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000002 ++ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 ++ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000004 ++ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000003 ++ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 ++ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000003 ++ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000003 ++ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000003 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=AVETHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=AVETHistory.verified.txt index 9055f5de..391555f3 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=AVETHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=AVETHistory.verified.txt @@ -1,2 +1,2 @@ -+ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000002 -- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 ++ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 +- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=EAVTCurrent.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=EAVTCurrent.verified.txt index a79b3593..66158505 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=EAVTCurrent.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=EAVTCurrent.verified.txt @@ -1,45 +1,88 @@ + | 0000000000000001 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/UniqueId | 0100000000000001 + | 0000000000000001 | (0002) ValueType | Ascii | 0100000000000001 -+ | 0000000000000001 | (0003) Indexed | Null | 0100000000000001 -+ | 0000000000000001 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000001 | (0003) Indexed | | 0100000000000001 ++ | 0000000000000001 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000002 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/ValueType | 0100000000000001 + | 0000000000000002 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000002 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000002 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000003 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Indexed | 0100000000000001 + | 0000000000000003 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000003 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000003 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000004 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Optional | 0100000000000001 + | 0000000000000004 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000004 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000004 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000005 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/NoHistory | 0100000000000001 + | 0000000000000005 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000005 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000005 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001 + | 0000000000000006 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000006 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000006 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001 + | 0000000000000007 | (0002) ValueType | Utf8 | 0100000000000001 -+ | 0000000000000007 | (0004) Optional | Null | 0100000000000001 -+ | 0000000000000007 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000007 | (0004) Optional | | 0100000000000001 ++ | 0000000000000007 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 + | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001 -+ | 0000000000000008 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002 ++ | 0000000000000014 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000014 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000015 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000015 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000015 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 0000000000000016 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000016 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000017 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000017 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 ++ | 0000000000000018 | (0002) ValueType | Utf8 | 0100000000000002 ++ | 0000000000000018 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000018 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 0000000000000019 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000019 | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 000000000000001A | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001A | (0003) Indexed | | 0100000000000002 ++ | 000000000000001A | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 000000000000001B | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001B | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001C | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001C | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001D | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001D | (0006) Cardinality | 2 | 0100000000000002 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001E | (0002) ValueType | Blob | 0100000000000002 ++ | 000000000000001E | (0003) Indexed | | 0100000000000002 ++ | 000000000000001E | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 ++ | 000000000000001F | (0002) ValueType | HashedBlob | 0100000000000002 ++ | 000000000000001F | (0003) Indexed | | 0100000000000002 ++ | 000000000000001F | (0006) Cardinality | 1 | 0100000000000002 + | 0100000000000001 | (0008) Timestamp | DateTime : 0 | 0100000000000001 + | 0100000000000002 | (0008) Timestamp | DateTime : 1 | 0100000000000002 + | 0100000000000003 | (0008) Timestamp | DateTime : 2 | 0100000000000003 -+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000002 -+ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000002 -+ | 0200000000000001 | (0016) Size | 42 B | 0100000000000002 -+ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000003 -+ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000003 -+ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000002 -+ | 0200000000000002 | (0016) Size | 77 B | 0100000000000002 -+ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000002 -+ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000002 -+ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000002 -+ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000006 | (001B) Name | Test Collection 1 | 0100000000000002 -+ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000002 ++ | 0100000000000004 | (0008) Timestamp | DateTime : 3 | 0100000000000004 ++ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 ++ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 ++ | 0200000000000001 | (0016) Size | 0x000000000000002A | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000004 ++ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000004 ++ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000003 ++ | 0200000000000002 | (0016) Size | 0x000000000000004D | 0100000000000003 ++ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000003 ++ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000003 ++ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000003 ++ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000006 | (001B) Name | Test Collection 1 | 0100000000000003 ++ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000003 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=EAVTHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=EAVTHistory.verified.txt index 3ac421f8..c652d989 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=EAVTHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=EAVTHistory.verified.txt @@ -1,6 +1,6 @@ -+ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000002 -- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 -+ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000002 -- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 -+ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000002 -- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 +- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000004 ++ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 +- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000004 ++ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 +- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=TxLog.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=TxLog.verified.txt index 127bbc9d..62e014e1 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=TxLog.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=TxLog.verified.txt @@ -1,51 +1,94 @@ + | 0000000000000001 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/UniqueId | 0100000000000001 + | 0000000000000001 | (0002) ValueType | Ascii | 0100000000000001 -+ | 0000000000000001 | (0003) Indexed | Null | 0100000000000001 -+ | 0000000000000001 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000001 | (0003) Indexed | | 0100000000000001 ++ | 0000000000000001 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000002 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/ValueType | 0100000000000001 + | 0000000000000002 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000002 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000002 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000003 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Indexed | 0100000000000001 + | 0000000000000003 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000003 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000003 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000004 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Optional | 0100000000000001 + | 0000000000000004 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000004 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000004 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000005 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/NoHistory | 0100000000000001 + | 0000000000000005 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000005 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000005 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001 + | 0000000000000006 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000006 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000006 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001 + | 0000000000000007 | (0002) ValueType | Utf8 | 0100000000000001 -+ | 0000000000000007 | (0004) Optional | Null | 0100000000000001 -+ | 0000000000000007 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000007 | (0004) Optional | | 0100000000000001 ++ | 0000000000000007 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 + | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001 -+ | 0000000000000008 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001 + | 0100000000000001 | (0008) Timestamp | DateTime : 0 | 0100000000000001 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002 ++ | 0000000000000014 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000014 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000015 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000015 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000015 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 0000000000000016 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000016 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000017 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000017 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 ++ | 0000000000000018 | (0002) ValueType | Utf8 | 0100000000000002 ++ | 0000000000000018 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000018 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 0000000000000019 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000019 | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 000000000000001A | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001A | (0003) Indexed | | 0100000000000002 ++ | 000000000000001A | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 000000000000001B | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001B | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001C | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001C | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001D | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001D | (0006) Cardinality | 2 | 0100000000000002 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001E | (0002) ValueType | Blob | 0100000000000002 ++ | 000000000000001E | (0003) Indexed | | 0100000000000002 ++ | 000000000000001E | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 ++ | 000000000000001F | (0002) ValueType | HashedBlob | 0100000000000002 ++ | 000000000000001F | (0003) Indexed | | 0100000000000002 ++ | 000000000000001F | (0006) Cardinality | 1 | 0100000000000002 + | 0100000000000002 | (0008) Timestamp | DateTime : 1 | 0100000000000002 -+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000002 -+ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000002 -+ | 0200000000000001 | (0016) Size | 42 B | 0100000000000002 -+ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000002 -+ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000002 -+ | 0200000000000002 | (0016) Size | 77 B | 0100000000000002 -+ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000002 -+ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000002 -+ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000002 -+ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000006 | (001B) Name | Test Collection 1 | 0100000000000002 -+ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000002 + | 0100000000000003 | (0008) Timestamp | DateTime : 2 | 0100000000000003 -- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 -+ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000003 -+ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000003 -- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 -- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 ++ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 ++ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 ++ | 0200000000000001 | (0016) Size | 0x000000000000002A | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 ++ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000003 ++ | 0200000000000002 | (0016) Size | 0x000000000000004D | 0100000000000003 ++ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000003 ++ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000003 ++ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000003 ++ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000006 | (001B) Name | Test Collection 1 | 0100000000000003 ++ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 ++ | 0100000000000004 | (0008) Timestamp | DateTime : 3 | 0100000000000004 +- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000004 ++ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000004 ++ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000004 +- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000004 +- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=VAETCurrent.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=VAETCurrent.verified.txt index 34fff010..a4f11e36 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=VAETCurrent.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=VAETCurrent.verified.txt @@ -1,6 +1,6 @@ -+ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000003 ++ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=VAETHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=VAETHistory.verified.txt index 4685e242..3244d438 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=VAETHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.InsertedDatomsShowUpInTheIndex_type=VAETHistory.verified.txt @@ -1,4 +1,4 @@ -+ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000002 -- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 -+ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000002 -- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 +- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000004 ++ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 +- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=AEVTCurrent.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=AEVTCurrent.verified.txt index ff47d05b..7000c6d9 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=AEVTCurrent.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=AEVTCurrent.verified.txt @@ -6,6 +6,18 @@ + | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001 + | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 + | 0000000000000001 | (0002) ValueType | Ascii | 0100000000000001 + | 0000000000000002 | (0002) ValueType | UInt8 | 0100000000000001 + | 0000000000000003 | (0002) ValueType | Null | 0100000000000001 @@ -14,16 +26,47 @@ + | 0000000000000006 | (0002) ValueType | UInt8 | 0100000000000001 + | 0000000000000007 | (0002) ValueType | Utf8 | 0100000000000001 + | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001 -+ | 0000000000000001 | (0003) Indexed | Null | 0100000000000001 -+ | 0000000000000007 | (0004) Optional | Null | 0100000000000001 -+ | 0000000000000001 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000002 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000003 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000004 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000005 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000006 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000007 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000008 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002 ++ | 0000000000000015 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000016 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000017 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000018 | (0002) ValueType | Utf8 | 0100000000000002 ++ | 0000000000000019 | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001A | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001B | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001C | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001D | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001E | (0002) ValueType | Blob | 0100000000000002 ++ | 000000000000001F | (0002) ValueType | HashedBlob | 0100000000000002 ++ | 0000000000000001 | (0003) Indexed | | 0100000000000001 ++ | 0000000000000014 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000015 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000018 | (0003) Indexed | | 0100000000000002 ++ | 000000000000001A | (0003) Indexed | | 0100000000000002 ++ | 000000000000001E | (0003) Indexed | | 0100000000000002 ++ | 000000000000001F | (0003) Indexed | | 0100000000000002 ++ | 0000000000000007 | (0004) Optional | | 0100000000000001 ++ | 0000000000000001 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000002 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000003 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000004 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000005 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000006 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000007 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000014 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000015 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000016 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000017 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000018 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000019 | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001A | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001B | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001C | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001D | (0006) Cardinality | 2 | 0100000000000002 ++ | 000000000000001E | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001F | (0006) Cardinality | 1 | 0100000000000002 + | 0100000000000001 | (0008) Timestamp | DateTime : 0 | 0100000000000001 + | 0100000000000002 | (0008) Timestamp | DateTime : 1 | 0100000000000002 + | 0100000000000003 | (0008) Timestamp | DateTime : 2 | 0100000000000003 ++ | 0100000000000004 | (0008) Timestamp | DateTime : 3 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=AEVTHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=AEVTHistory.verified.txt index f6425d73..5ed3b835 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=AEVTHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=AEVTHistory.verified.txt @@ -1,8 +1,8 @@ -+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000002 -- | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 -+ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000002 -- | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 -+ | 0200000000000001 | (0016) Size | 42 B | 0100000000000002 -- | 0200000000000001 | (0016) Size | 42 B | 0100000000000003 -+ | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000002 -- | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000003 ++ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 +- | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000004 ++ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 +- | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000004 ++ | 0200000000000001 | (0016) Size | 0x000000000000002A | 0100000000000003 +- | 0200000000000001 | (0016) Size | 0x000000000000002A | 0100000000000004 ++ | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000003 +- | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=AVETCurrent.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=AVETCurrent.verified.txt index c87ebd6b..0be15edd 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=AVETCurrent.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=AVETCurrent.verified.txt @@ -5,4 +5,16 @@ + | 0000000000000004 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Optional | 0100000000000001 + | 0000000000000001 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/UniqueId | 0100000000000001 + | 0000000000000002 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/ValueType | 0100000000000001 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=AVETHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=AVETHistory.verified.txt index 20cdea06..ee34150d 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=AVETHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=AVETHistory.verified.txt @@ -1,4 +1,4 @@ -+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000002 -- | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 -+ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000002 -- | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 ++ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 +- | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000004 ++ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 +- | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=EAVTCurrent.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=EAVTCurrent.verified.txt index 8e1ed9c0..791bad5f 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=EAVTCurrent.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=EAVTCurrent.verified.txt @@ -1,29 +1,72 @@ + | 0000000000000001 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/UniqueId | 0100000000000001 + | 0000000000000001 | (0002) ValueType | Ascii | 0100000000000001 -+ | 0000000000000001 | (0003) Indexed | Null | 0100000000000001 -+ | 0000000000000001 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000001 | (0003) Indexed | | 0100000000000001 ++ | 0000000000000001 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000002 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/ValueType | 0100000000000001 + | 0000000000000002 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000002 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000002 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000003 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Indexed | 0100000000000001 + | 0000000000000003 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000003 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000003 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000004 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Optional | 0100000000000001 + | 0000000000000004 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000004 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000004 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000005 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/NoHistory | 0100000000000001 + | 0000000000000005 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000005 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000005 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001 + | 0000000000000006 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000006 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000006 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001 + | 0000000000000007 | (0002) ValueType | Utf8 | 0100000000000001 -+ | 0000000000000007 | (0004) Optional | Null | 0100000000000001 -+ | 0000000000000007 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000007 | (0004) Optional | | 0100000000000001 ++ | 0000000000000007 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 + | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001 -+ | 0000000000000008 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002 ++ | 0000000000000014 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000014 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000015 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000015 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000015 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 0000000000000016 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000016 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000017 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000017 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 ++ | 0000000000000018 | (0002) ValueType | Utf8 | 0100000000000002 ++ | 0000000000000018 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000018 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 0000000000000019 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000019 | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 000000000000001A | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001A | (0003) Indexed | | 0100000000000002 ++ | 000000000000001A | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 000000000000001B | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001B | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001C | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001C | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001D | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001D | (0006) Cardinality | 2 | 0100000000000002 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001E | (0002) ValueType | Blob | 0100000000000002 ++ | 000000000000001E | (0003) Indexed | | 0100000000000002 ++ | 000000000000001E | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 ++ | 000000000000001F | (0002) ValueType | HashedBlob | 0100000000000002 ++ | 000000000000001F | (0003) Indexed | | 0100000000000002 ++ | 000000000000001F | (0006) Cardinality | 1 | 0100000000000002 + | 0100000000000001 | (0008) Timestamp | DateTime : 0 | 0100000000000001 + | 0100000000000002 | (0008) Timestamp | DateTime : 1 | 0100000000000002 + | 0100000000000003 | (0008) Timestamp | DateTime : 2 | 0100000000000003 ++ | 0100000000000004 | (0008) Timestamp | DateTime : 3 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=EAVTHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=EAVTHistory.verified.txt index f6425d73..5ed3b835 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=EAVTHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=EAVTHistory.verified.txt @@ -1,8 +1,8 @@ -+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000002 -- | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 -+ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000002 -- | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 -+ | 0200000000000001 | (0016) Size | 42 B | 0100000000000002 -- | 0200000000000001 | (0016) Size | 42 B | 0100000000000003 -+ | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000002 -- | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000003 ++ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 +- | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000004 ++ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 +- | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000004 ++ | 0200000000000001 | (0016) Size | 0x000000000000002A | 0100000000000003 +- | 0200000000000001 | (0016) Size | 0x000000000000002A | 0100000000000004 ++ | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000003 +- | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=TxLog.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=TxLog.verified.txt index 0e2e9ad8..93ed76d2 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=TxLog.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=TxLog.verified.txt @@ -1,37 +1,80 @@ + | 0000000000000001 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/UniqueId | 0100000000000001 + | 0000000000000001 | (0002) ValueType | Ascii | 0100000000000001 -+ | 0000000000000001 | (0003) Indexed | Null | 0100000000000001 -+ | 0000000000000001 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000001 | (0003) Indexed | | 0100000000000001 ++ | 0000000000000001 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000002 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/ValueType | 0100000000000001 + | 0000000000000002 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000002 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000002 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000003 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Indexed | 0100000000000001 + | 0000000000000003 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000003 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000003 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000004 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Optional | 0100000000000001 + | 0000000000000004 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000004 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000004 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000005 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/NoHistory | 0100000000000001 + | 0000000000000005 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000005 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000005 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001 + | 0000000000000006 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000006 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000006 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001 + | 0000000000000007 | (0002) ValueType | Utf8 | 0100000000000001 -+ | 0000000000000007 | (0004) Optional | Null | 0100000000000001 -+ | 0000000000000007 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000007 | (0004) Optional | | 0100000000000001 ++ | 0000000000000007 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 + | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001 -+ | 0000000000000008 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001 + | 0100000000000001 | (0008) Timestamp | DateTime : 0 | 0100000000000001 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002 ++ | 0000000000000014 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000014 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000015 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000015 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000015 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 0000000000000016 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000016 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000017 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000017 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 ++ | 0000000000000018 | (0002) ValueType | Utf8 | 0100000000000002 ++ | 0000000000000018 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000018 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 0000000000000019 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000019 | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 000000000000001A | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001A | (0003) Indexed | | 0100000000000002 ++ | 000000000000001A | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 000000000000001B | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001B | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001C | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001C | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001D | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001D | (0006) Cardinality | 2 | 0100000000000002 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001E | (0002) ValueType | Blob | 0100000000000002 ++ | 000000000000001E | (0003) Indexed | | 0100000000000002 ++ | 000000000000001E | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 ++ | 000000000000001F | (0002) ValueType | HashedBlob | 0100000000000002 ++ | 000000000000001F | (0003) Indexed | | 0100000000000002 ++ | 000000000000001F | (0006) Cardinality | 1 | 0100000000000002 + | 0100000000000002 | (0008) Timestamp | DateTime : 1 | 0100000000000002 -+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000002 -+ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000002 -+ | 0200000000000001 | (0016) Size | 42 B | 0100000000000002 -+ | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000002 + | 0100000000000003 | (0008) Timestamp | DateTime : 2 | 0100000000000003 -- | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 -- | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 -- | 0200000000000001 | (0016) Size | 42 B | 0100000000000003 -- | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000003 ++ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 ++ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 ++ | 0200000000000001 | (0016) Size | 0x000000000000002A | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000003 ++ | 0100000000000004 | (0008) Timestamp | DateTime : 3 | 0100000000000004 +- | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000004 +- | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000004 +- | 0200000000000001 | (0016) Size | 0x000000000000002A | 0100000000000004 +- | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=VAETHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=VAETHistory.verified.txt index 523a0859..d9d22cc0 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=VAETHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/InMemoryTests.RetractedValuesAreSupported_type=VAETHistory.verified.txt @@ -1,2 +1,2 @@ -+ | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000002 -- | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000003 +- | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.CanStoreDataInBlobs_type=AEVTCurrent.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.CanStoreDataInBlobs_type=AEVTCurrent.verified.txt index df10f976..125c7e99 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.CanStoreDataInBlobs_type=AEVTCurrent.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.CanStoreDataInBlobs_type=AEVTCurrent.verified.txt @@ -6,6 +6,18 @@ + | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001 + | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 + | 0000000000000001 | (0002) ValueType | Ascii | 0100000000000001 + | 0000000000000002 | (0002) ValueType | UInt8 | 0100000000000001 + | 0000000000000003 | (0002) ValueType | Null | 0100000000000001 @@ -14,16 +26,46 @@ + | 0000000000000006 | (0002) ValueType | UInt8 | 0100000000000001 + | 0000000000000007 | (0002) ValueType | Utf8 | 0100000000000001 + | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001 -+ | 0000000000000001 | (0003) Indexed | Null | 0100000000000001 -+ | 0000000000000007 | (0004) Optional | Null | 0100000000000001 -+ | 0000000000000001 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000002 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000003 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000004 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000005 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000006 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000007 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000008 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002 ++ | 0000000000000015 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000016 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000017 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000018 | (0002) ValueType | Utf8 | 0100000000000002 ++ | 0000000000000019 | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001A | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001B | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001C | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001D | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001E | (0002) ValueType | Blob | 0100000000000002 ++ | 000000000000001F | (0002) ValueType | HashedBlob | 0100000000000002 ++ | 0000000000000001 | (0003) Indexed | | 0100000000000001 ++ | 0000000000000014 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000015 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000018 | (0003) Indexed | | 0100000000000002 ++ | 000000000000001A | (0003) Indexed | | 0100000000000002 ++ | 000000000000001E | (0003) Indexed | | 0100000000000002 ++ | 000000000000001F | (0003) Indexed | | 0100000000000002 ++ | 0000000000000007 | (0004) Optional | | 0100000000000001 ++ | 0000000000000001 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000002 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000003 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000004 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000005 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000006 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000007 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000014 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000015 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000016 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000017 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000018 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000019 | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001A | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001B | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001C | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001D | (0006) Cardinality | 2 | 0100000000000002 ++ | 000000000000001E | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001F | (0006) Cardinality | 1 | 0100000000000002 + | 0100000000000001 | (0008) Timestamp | DateTime : 0 | 0100000000000001 + | 0100000000000002 | (0008) Timestamp | DateTime : 1 | 0100000000000002 + | 0100000000000003 | (0008) Timestamp | DateTime : 2 | 0100000000000003 @@ -31,7 +73,8 @@ + | 0100000000000005 | (0008) Timestamp | DateTime : 4 | 0100000000000005 + | 0100000000000006 | (0008) Timestamp | DateTime : 5 | 0100000000000006 + | 0100000000000007 | (0008) Timestamp | DateTime : 6 | 0100000000000007 -+ | 0200000000000003 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000004 -+ | 0200000000000004 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000005 -+ | 0200000000000003 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000004 -+ | 0200000000000004 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000005 ++ | 0100000000000008 | (0008) Timestamp | DateTime : 7 | 0100000000000008 ++ | 0200000000000003 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000005 ++ | 0200000000000004 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000006 ++ | 0200000000000003 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000005 ++ | 0200000000000004 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000006 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.CanStoreDataInBlobs_type=AEVTHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.CanStoreDataInBlobs_type=AEVTHistory.verified.txt index a3f9a98f..27ce3fe3 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.CanStoreDataInBlobs_type=AEVTHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.CanStoreDataInBlobs_type=AEVTHistory.verified.txt @@ -1,8 +1,8 @@ -+ | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000002 -- | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000006 -+ | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000003 -- | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000007 -+ | 0200000000000001 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000002 -- | 0200000000000001 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000006 -+ | 0200000000000002 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000003 -- | 0200000000000002 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000007 ++ | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000003 +- | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000007 ++ | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000004 +- | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000008 ++ | 0200000000000001 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000003 +- | 0200000000000001 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000007 ++ | 0200000000000002 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000004 +- | 0200000000000002 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000008 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.CanStoreDataInBlobs_type=AVETCurrent.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.CanStoreDataInBlobs_type=AVETCurrent.verified.txt index d3b822ee..35cd1d58 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.CanStoreDataInBlobs_type=AVETCurrent.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.CanStoreDataInBlobs_type=AVETCurrent.verified.txt @@ -5,8 +5,20 @@ + | 0000000000000004 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Optional | 0100000000000001 + | 0000000000000001 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/UniqueId | 0100000000000001 + | 0000000000000002 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/ValueType | 0100000000000001 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 -+ | 0200000000000003 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000004 -+ | 0200000000000004 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000005 -+ | 0200000000000003 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000004 -+ | 0200000000000004 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000005 ++ | 0200000000000003 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000005 ++ | 0200000000000004 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000006 ++ | 0200000000000003 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000005 ++ | 0200000000000004 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000006 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.CanStoreDataInBlobs_type=AVETHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.CanStoreDataInBlobs_type=AVETHistory.verified.txt index a3f9a98f..27ce3fe3 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.CanStoreDataInBlobs_type=AVETHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.CanStoreDataInBlobs_type=AVETHistory.verified.txt @@ -1,8 +1,8 @@ -+ | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000002 -- | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000006 -+ | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000003 -- | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000007 -+ | 0200000000000001 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000002 -- | 0200000000000001 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000006 -+ | 0200000000000002 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000003 -- | 0200000000000002 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000007 ++ | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000003 +- | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000007 ++ | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000004 +- | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000008 ++ | 0200000000000001 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000003 +- | 0200000000000001 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000007 ++ | 0200000000000002 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000004 +- | 0200000000000002 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000008 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.CanStoreDataInBlobs_type=EAVTCurrent.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.CanStoreDataInBlobs_type=EAVTCurrent.verified.txt index c7ba26a8..bf21d10a 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.CanStoreDataInBlobs_type=EAVTCurrent.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.CanStoreDataInBlobs_type=EAVTCurrent.verified.txt @@ -1,29 +1,71 @@ + | 0000000000000001 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/UniqueId | 0100000000000001 + | 0000000000000001 | (0002) ValueType | Ascii | 0100000000000001 -+ | 0000000000000001 | (0003) Indexed | Null | 0100000000000001 -+ | 0000000000000001 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000001 | (0003) Indexed | | 0100000000000001 ++ | 0000000000000001 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000002 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/ValueType | 0100000000000001 + | 0000000000000002 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000002 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000002 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000003 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Indexed | 0100000000000001 + | 0000000000000003 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000003 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000003 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000004 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Optional | 0100000000000001 + | 0000000000000004 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000004 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000004 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000005 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/NoHistory | 0100000000000001 + | 0000000000000005 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000005 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000005 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001 + | 0000000000000006 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000006 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000006 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001 + | 0000000000000007 | (0002) ValueType | Utf8 | 0100000000000001 -+ | 0000000000000007 | (0004) Optional | Null | 0100000000000001 -+ | 0000000000000007 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000007 | (0004) Optional | | 0100000000000001 ++ | 0000000000000007 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 + | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001 -+ | 0000000000000008 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002 ++ | 0000000000000014 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000014 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000015 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000015 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000015 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 0000000000000016 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000016 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000017 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000017 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 ++ | 0000000000000018 | (0002) ValueType | Utf8 | 0100000000000002 ++ | 0000000000000018 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000018 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 0000000000000019 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000019 | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 000000000000001A | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001A | (0003) Indexed | | 0100000000000002 ++ | 000000000000001A | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 000000000000001B | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001B | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001C | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001C | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001D | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001D | (0006) Cardinality | 2 | 0100000000000002 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001E | (0002) ValueType | Blob | 0100000000000002 ++ | 000000000000001E | (0003) Indexed | | 0100000000000002 ++ | 000000000000001E | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 ++ | 000000000000001F | (0002) ValueType | HashedBlob | 0100000000000002 ++ | 000000000000001F | (0003) Indexed | | 0100000000000002 ++ | 000000000000001F | (0006) Cardinality | 1 | 0100000000000002 + | 0100000000000001 | (0008) Timestamp | DateTime : 0 | 0100000000000001 + | 0100000000000002 | (0008) Timestamp | DateTime : 1 | 0100000000000002 + | 0100000000000003 | (0008) Timestamp | DateTime : 2 | 0100000000000003 @@ -31,7 +73,8 @@ + | 0100000000000005 | (0008) Timestamp | DateTime : 4 | 0100000000000005 + | 0100000000000006 | (0008) Timestamp | DateTime : 5 | 0100000000000006 + | 0100000000000007 | (0008) Timestamp | DateTime : 6 | 0100000000000007 -+ | 0200000000000003 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000004 -+ | 0200000000000003 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000004 -+ | 0200000000000004 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000005 -+ | 0200000000000004 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000005 ++ | 0100000000000008 | (0008) Timestamp | DateTime : 7 | 0100000000000008 ++ | 0200000000000003 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000005 ++ | 0200000000000003 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000005 ++ | 0200000000000004 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000006 ++ | 0200000000000004 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000006 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.CanStoreDataInBlobs_type=EAVTHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.CanStoreDataInBlobs_type=EAVTHistory.verified.txt index c20a8346..439103de 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.CanStoreDataInBlobs_type=EAVTHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.CanStoreDataInBlobs_type=EAVTHistory.verified.txt @@ -1,8 +1,8 @@ -+ | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000002 -- | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000006 -+ | 0200000000000001 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000002 -- | 0200000000000001 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000006 -+ | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000003 -- | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000007 -+ | 0200000000000002 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000003 -- | 0200000000000002 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000007 ++ | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000003 +- | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000007 ++ | 0200000000000001 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000003 +- | 0200000000000001 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000007 ++ | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000004 +- | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000008 ++ | 0200000000000002 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000004 +- | 0200000000000002 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000008 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.CanStoreDataInBlobs_type=TxLog.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.CanStoreDataInBlobs_type=TxLog.verified.txt index e9661d68..6b09289d 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.CanStoreDataInBlobs_type=TxLog.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.CanStoreDataInBlobs_type=TxLog.verified.txt @@ -1,45 +1,88 @@ + | 0000000000000001 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/UniqueId | 0100000000000001 + | 0000000000000001 | (0002) ValueType | Ascii | 0100000000000001 -+ | 0000000000000001 | (0003) Indexed | Null | 0100000000000001 -+ | 0000000000000001 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000001 | (0003) Indexed | | 0100000000000001 ++ | 0000000000000001 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000002 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/ValueType | 0100000000000001 + | 0000000000000002 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000002 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000002 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000003 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Indexed | 0100000000000001 + | 0000000000000003 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000003 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000003 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000004 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Optional | 0100000000000001 + | 0000000000000004 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000004 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000004 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000005 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/NoHistory | 0100000000000001 + | 0000000000000005 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000005 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000005 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001 + | 0000000000000006 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000006 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000006 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001 + | 0000000000000007 | (0002) ValueType | Utf8 | 0100000000000001 -+ | 0000000000000007 | (0004) Optional | Null | 0100000000000001 -+ | 0000000000000007 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000007 | (0004) Optional | | 0100000000000001 ++ | 0000000000000007 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 + | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001 -+ | 0000000000000008 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001 + | 0100000000000001 | (0008) Timestamp | DateTime : 0 | 0100000000000001 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002 ++ | 0000000000000014 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000014 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000015 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000015 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000015 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 0000000000000016 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000016 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000017 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000017 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 ++ | 0000000000000018 | (0002) ValueType | Utf8 | 0100000000000002 ++ | 0000000000000018 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000018 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 0000000000000019 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000019 | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 000000000000001A | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001A | (0003) Indexed | | 0100000000000002 ++ | 000000000000001A | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 000000000000001B | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001B | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001C | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001C | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001D | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001D | (0006) Cardinality | 2 | 0100000000000002 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001E | (0002) ValueType | Blob | 0100000000000002 ++ | 000000000000001E | (0003) Indexed | | 0100000000000002 ++ | 000000000000001E | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 ++ | 000000000000001F | (0002) ValueType | HashedBlob | 0100000000000002 ++ | 000000000000001F | (0003) Indexed | | 0100000000000002 ++ | 000000000000001F | (0006) Cardinality | 1 | 0100000000000002 + | 0100000000000002 | (0008) Timestamp | DateTime : 1 | 0100000000000002 -+ | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000002 -+ | 0200000000000001 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000002 + | 0100000000000003 | (0008) Timestamp | DateTime : 2 | 0100000000000003 -+ | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000003 -+ | 0200000000000002 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000003 ++ | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000003 ++ | 0200000000000001 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000003 + | 0100000000000004 | (0008) Timestamp | DateTime : 3 | 0100000000000004 -+ | 0200000000000003 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000004 -+ | 0200000000000003 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000004 ++ | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000004 ++ | 0200000000000002 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000004 + | 0100000000000005 | (0008) Timestamp | DateTime : 4 | 0100000000000005 -+ | 0200000000000004 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000005 -+ | 0200000000000004 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000005 ++ | 0200000000000003 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000005 ++ | 0200000000000003 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000005 + | 0100000000000006 | (0008) Timestamp | DateTime : 5 | 0100000000000006 -- | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000006 -- | 0200000000000001 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000006 ++ | 0200000000000004 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000006 ++ | 0200000000000004 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000006 + | 0100000000000007 | (0008) Timestamp | DateTime : 6 | 0100000000000007 -- | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000007 -- | 0200000000000002 | (001F) InValueBlob | Blob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000007 +- | 0200000000000001 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000007 +- | 0200000000000001 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000007 ++ | 0100000000000008 | (0008) Timestamp | DateTime : 7 | 0100000000000008 +- | 0200000000000002 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000008 +- | 0200000000000002 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777224 bytes | 0100000000000008 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=AEVTCurrent.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=AEVTCurrent.verified.txt index 2f0276f2..5c739271 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=AEVTCurrent.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=AEVTCurrent.verified.txt @@ -6,6 +6,18 @@ + | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001 + | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 + | 0000000000000001 | (0002) ValueType | Ascii | 0100000000000001 + | 0000000000000002 | (0002) ValueType | UInt8 | 0100000000000001 + | 0000000000000003 | (0002) ValueType | Null | 0100000000000001 @@ -14,38 +26,69 @@ + | 0000000000000006 | (0002) ValueType | UInt8 | 0100000000000001 + | 0000000000000007 | (0002) ValueType | Utf8 | 0100000000000001 + | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001 -+ | 0000000000000001 | (0003) Indexed | Null | 0100000000000001 -+ | 0000000000000007 | (0004) Optional | Null | 0100000000000001 -+ | 0000000000000001 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000002 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000003 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000004 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000005 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000006 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000007 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000008 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002 ++ | 0000000000000015 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000016 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000017 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000018 | (0002) ValueType | Utf8 | 0100000000000002 ++ | 0000000000000019 | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001A | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001B | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001C | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001D | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001E | (0002) ValueType | Blob | 0100000000000002 ++ | 000000000000001F | (0002) ValueType | HashedBlob | 0100000000000002 ++ | 0000000000000001 | (0003) Indexed | | 0100000000000001 ++ | 0000000000000014 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000015 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000018 | (0003) Indexed | | 0100000000000002 ++ | 000000000000001A | (0003) Indexed | | 0100000000000002 ++ | 000000000000001E | (0003) Indexed | | 0100000000000002 ++ | 000000000000001F | (0003) Indexed | | 0100000000000002 ++ | 0000000000000007 | (0004) Optional | | 0100000000000001 ++ | 0000000000000001 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000002 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000003 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000004 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000005 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000006 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000007 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000014 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000015 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000016 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000017 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000018 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000019 | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001A | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001B | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001C | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001D | (0006) Cardinality | 2 | 0100000000000002 ++ | 000000000000001E | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001F | (0006) Cardinality | 1 | 0100000000000002 + | 0100000000000001 | (0008) Timestamp | DateTime : 0 | 0100000000000001 + | 0100000000000002 | (0008) Timestamp | DateTime : 1 | 0100000000000002 + | 0100000000000003 | (0008) Timestamp | DateTime : 2 | 0100000000000003 -+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000002 -+ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000003 -+ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000002 -- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 -+ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000002 -+ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000002 -+ | 0200000000000001 | (0016) Size | 42 B | 0100000000000002 -+ | 0200000000000002 | (0016) Size | 77 B | 0100000000000002 -+ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000002 -- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 -+ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000003 -+ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000002 -+ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000002 -+ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000002 -+ | 0200000000000006 | (001B) Name | Test Collection 1 | 0100000000000002 -+ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000002 -- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 ++ | 0100000000000004 | (0008) Timestamp | DateTime : 3 | 0100000000000004 ++ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 ++ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000004 ++ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 +- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000004 ++ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 ++ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000003 ++ | 0200000000000001 | (0016) Size | 0x000000000000002A | 0100000000000003 ++ | 0200000000000002 | (0016) Size | 0x000000000000004D | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 +- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000004 ++ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000004 ++ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000003 ++ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000003 ++ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000003 ++ | 0200000000000006 | (001B) Name | Test Collection 1 | 0100000000000003 ++ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 +- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=AEVTHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=AEVTHistory.verified.txt index 2f0276f2..5c739271 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=AEVTHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=AEVTHistory.verified.txt @@ -6,6 +6,18 @@ + | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001 + | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 + | 0000000000000001 | (0002) ValueType | Ascii | 0100000000000001 + | 0000000000000002 | (0002) ValueType | UInt8 | 0100000000000001 + | 0000000000000003 | (0002) ValueType | Null | 0100000000000001 @@ -14,38 +26,69 @@ + | 0000000000000006 | (0002) ValueType | UInt8 | 0100000000000001 + | 0000000000000007 | (0002) ValueType | Utf8 | 0100000000000001 + | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001 -+ | 0000000000000001 | (0003) Indexed | Null | 0100000000000001 -+ | 0000000000000007 | (0004) Optional | Null | 0100000000000001 -+ | 0000000000000001 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000002 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000003 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000004 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000005 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000006 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000007 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000008 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002 ++ | 0000000000000015 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000016 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000017 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000018 | (0002) ValueType | Utf8 | 0100000000000002 ++ | 0000000000000019 | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001A | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001B | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001C | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001D | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001E | (0002) ValueType | Blob | 0100000000000002 ++ | 000000000000001F | (0002) ValueType | HashedBlob | 0100000000000002 ++ | 0000000000000001 | (0003) Indexed | | 0100000000000001 ++ | 0000000000000014 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000015 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000018 | (0003) Indexed | | 0100000000000002 ++ | 000000000000001A | (0003) Indexed | | 0100000000000002 ++ | 000000000000001E | (0003) Indexed | | 0100000000000002 ++ | 000000000000001F | (0003) Indexed | | 0100000000000002 ++ | 0000000000000007 | (0004) Optional | | 0100000000000001 ++ | 0000000000000001 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000002 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000003 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000004 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000005 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000006 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000007 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000014 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000015 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000016 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000017 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000018 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000019 | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001A | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001B | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001C | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001D | (0006) Cardinality | 2 | 0100000000000002 ++ | 000000000000001E | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001F | (0006) Cardinality | 1 | 0100000000000002 + | 0100000000000001 | (0008) Timestamp | DateTime : 0 | 0100000000000001 + | 0100000000000002 | (0008) Timestamp | DateTime : 1 | 0100000000000002 + | 0100000000000003 | (0008) Timestamp | DateTime : 2 | 0100000000000003 -+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000002 -+ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000003 -+ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000002 -- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 -+ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000002 -+ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000002 -+ | 0200000000000001 | (0016) Size | 42 B | 0100000000000002 -+ | 0200000000000002 | (0016) Size | 77 B | 0100000000000002 -+ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000002 -- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 -+ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000003 -+ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000002 -+ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000002 -+ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000002 -+ | 0200000000000006 | (001B) Name | Test Collection 1 | 0100000000000002 -+ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000002 -- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 ++ | 0100000000000004 | (0008) Timestamp | DateTime : 3 | 0100000000000004 ++ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 ++ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000004 ++ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 +- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000004 ++ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 ++ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000003 ++ | 0200000000000001 | (0016) Size | 0x000000000000002A | 0100000000000003 ++ | 0200000000000002 | (0016) Size | 0x000000000000004D | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 +- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000004 ++ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000004 ++ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000003 ++ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000003 ++ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000003 ++ | 0200000000000006 | (001B) Name | Test Collection 1 | 0100000000000003 ++ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 +- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=AVETCurrent.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=AVETCurrent.verified.txt index 97e440a0..00af726a 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=AVETCurrent.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=AVETCurrent.verified.txt @@ -5,13 +5,25 @@ + | 0000000000000004 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Optional | 0100000000000001 + | 0000000000000001 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/UniqueId | 0100000000000001 + | 0000000000000002 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/ValueType | 0100000000000001 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 -+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000002 -+ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000003 -+ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000002 -- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 -+ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000002 -+ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000002 -+ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000002 -+ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000002 -+ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000002 ++ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 ++ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000004 ++ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 +- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000004 ++ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000003 ++ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 ++ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000003 ++ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000003 ++ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000003 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=AVETHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=AVETHistory.verified.txt index 97e440a0..00af726a 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=AVETHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=AVETHistory.verified.txt @@ -5,13 +5,25 @@ + | 0000000000000004 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Optional | 0100000000000001 + | 0000000000000001 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/UniqueId | 0100000000000001 + | 0000000000000002 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/ValueType | 0100000000000001 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 -+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000002 -+ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000003 -+ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000002 -- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 -+ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000002 -+ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000002 -+ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000002 -+ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000002 -+ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000002 ++ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 ++ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000004 ++ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 +- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000004 ++ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000003 ++ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 ++ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000003 ++ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000003 ++ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000003 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=EAVTCurrent.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=EAVTCurrent.verified.txt index 347c96a5..e3698fc8 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=EAVTCurrent.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=EAVTCurrent.verified.txt @@ -1,51 +1,94 @@ + | 0000000000000001 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/UniqueId | 0100000000000001 + | 0000000000000001 | (0002) ValueType | Ascii | 0100000000000001 -+ | 0000000000000001 | (0003) Indexed | Null | 0100000000000001 -+ | 0000000000000001 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000001 | (0003) Indexed | | 0100000000000001 ++ | 0000000000000001 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000002 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/ValueType | 0100000000000001 + | 0000000000000002 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000002 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000002 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000003 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Indexed | 0100000000000001 + | 0000000000000003 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000003 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000003 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000004 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Optional | 0100000000000001 + | 0000000000000004 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000004 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000004 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000005 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/NoHistory | 0100000000000001 + | 0000000000000005 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000005 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000005 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001 + | 0000000000000006 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000006 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000006 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001 + | 0000000000000007 | (0002) ValueType | Utf8 | 0100000000000001 -+ | 0000000000000007 | (0004) Optional | Null | 0100000000000001 -+ | 0000000000000007 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000007 | (0004) Optional | | 0100000000000001 ++ | 0000000000000007 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 + | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001 -+ | 0000000000000008 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002 ++ | 0000000000000014 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000014 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000015 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000015 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000015 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 0000000000000016 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000016 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000017 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000017 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 ++ | 0000000000000018 | (0002) ValueType | Utf8 | 0100000000000002 ++ | 0000000000000018 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000018 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 0000000000000019 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000019 | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 000000000000001A | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001A | (0003) Indexed | | 0100000000000002 ++ | 000000000000001A | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 000000000000001B | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001B | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001C | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001C | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001D | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001D | (0006) Cardinality | 2 | 0100000000000002 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001E | (0002) ValueType | Blob | 0100000000000002 ++ | 000000000000001E | (0003) Indexed | | 0100000000000002 ++ | 000000000000001E | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 ++ | 000000000000001F | (0002) ValueType | HashedBlob | 0100000000000002 ++ | 000000000000001F | (0003) Indexed | | 0100000000000002 ++ | 000000000000001F | (0006) Cardinality | 1 | 0100000000000002 + | 0100000000000001 | (0008) Timestamp | DateTime : 0 | 0100000000000001 + | 0100000000000002 | (0008) Timestamp | DateTime : 1 | 0100000000000002 + | 0100000000000003 | (0008) Timestamp | DateTime : 2 | 0100000000000003 -+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000002 -+ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000002 -+ | 0200000000000001 | (0016) Size | 42 B | 0100000000000002 -+ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000002 -- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 -+ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000003 -+ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000003 -+ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000002 -- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 -+ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000002 -+ | 0200000000000002 | (0016) Size | 77 B | 0100000000000002 -+ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000002 -+ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000002 -+ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000002 -+ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000006 | (001B) Name | Test Collection 1 | 0100000000000002 -+ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000002 -- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 ++ | 0100000000000004 | (0008) Timestamp | DateTime : 3 | 0100000000000004 ++ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 ++ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 ++ | 0200000000000001 | (0016) Size | 0x000000000000002A | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 +- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000004 ++ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000004 ++ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000004 ++ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 +- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000004 ++ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000003 ++ | 0200000000000002 | (0016) Size | 0x000000000000004D | 0100000000000003 ++ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000003 ++ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000003 ++ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000003 ++ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000006 | (001B) Name | Test Collection 1 | 0100000000000003 ++ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 +- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=EAVTHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=EAVTHistory.verified.txt index 347c96a5..e3698fc8 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=EAVTHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=EAVTHistory.verified.txt @@ -1,51 +1,94 @@ + | 0000000000000001 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/UniqueId | 0100000000000001 + | 0000000000000001 | (0002) ValueType | Ascii | 0100000000000001 -+ | 0000000000000001 | (0003) Indexed | Null | 0100000000000001 -+ | 0000000000000001 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000001 | (0003) Indexed | | 0100000000000001 ++ | 0000000000000001 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000002 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/ValueType | 0100000000000001 + | 0000000000000002 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000002 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000002 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000003 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Indexed | 0100000000000001 + | 0000000000000003 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000003 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000003 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000004 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Optional | 0100000000000001 + | 0000000000000004 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000004 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000004 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000005 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/NoHistory | 0100000000000001 + | 0000000000000005 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000005 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000005 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001 + | 0000000000000006 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000006 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000006 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001 + | 0000000000000007 | (0002) ValueType | Utf8 | 0100000000000001 -+ | 0000000000000007 | (0004) Optional | Null | 0100000000000001 -+ | 0000000000000007 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000007 | (0004) Optional | | 0100000000000001 ++ | 0000000000000007 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 + | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001 -+ | 0000000000000008 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002 ++ | 0000000000000014 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000014 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000015 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000015 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000015 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 0000000000000016 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000016 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000017 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000017 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 ++ | 0000000000000018 | (0002) ValueType | Utf8 | 0100000000000002 ++ | 0000000000000018 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000018 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 0000000000000019 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000019 | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 000000000000001A | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001A | (0003) Indexed | | 0100000000000002 ++ | 000000000000001A | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 000000000000001B | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001B | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001C | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001C | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001D | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001D | (0006) Cardinality | 2 | 0100000000000002 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001E | (0002) ValueType | Blob | 0100000000000002 ++ | 000000000000001E | (0003) Indexed | | 0100000000000002 ++ | 000000000000001E | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 ++ | 000000000000001F | (0002) ValueType | HashedBlob | 0100000000000002 ++ | 000000000000001F | (0003) Indexed | | 0100000000000002 ++ | 000000000000001F | (0006) Cardinality | 1 | 0100000000000002 + | 0100000000000001 | (0008) Timestamp | DateTime : 0 | 0100000000000001 + | 0100000000000002 | (0008) Timestamp | DateTime : 1 | 0100000000000002 + | 0100000000000003 | (0008) Timestamp | DateTime : 2 | 0100000000000003 -+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000002 -+ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000002 -+ | 0200000000000001 | (0016) Size | 42 B | 0100000000000002 -+ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000002 -- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 -+ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000003 -+ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000003 -+ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000002 -- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 -+ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000002 -+ | 0200000000000002 | (0016) Size | 77 B | 0100000000000002 -+ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000002 -+ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000002 -+ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000002 -+ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000006 | (001B) Name | Test Collection 1 | 0100000000000002 -+ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000002 -- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 ++ | 0100000000000004 | (0008) Timestamp | DateTime : 3 | 0100000000000004 ++ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 ++ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 ++ | 0200000000000001 | (0016) Size | 0x000000000000002A | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 +- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000004 ++ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000004 ++ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000004 ++ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 +- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000004 ++ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000003 ++ | 0200000000000002 | (0016) Size | 0x000000000000004D | 0100000000000003 ++ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000003 ++ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000003 ++ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000003 ++ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000006 | (001B) Name | Test Collection 1 | 0100000000000003 ++ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 +- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=VAETCurrent.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=VAETCurrent.verified.txt index 02a18d5a..d425c02d 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=VAETCurrent.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=VAETCurrent.verified.txt @@ -1,10 +1,10 @@ -+ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000002 -- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 -+ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000003 -+ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000002 -- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 +- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000004 ++ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000004 ++ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 +- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=VAETHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=VAETHistory.verified.txt index 02a18d5a..d425c02d 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=VAETHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.HistoricalQueriesReturnAllDataSorted_type=VAETHistory.verified.txt @@ -1,10 +1,10 @@ -+ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000002 -- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 -+ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000003 -+ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000002 -- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 +- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000004 ++ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000004 ++ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 +- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=AEVTCurrent.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=AEVTCurrent.verified.txt index 9034a673..72be7490 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=AEVTCurrent.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=AEVTCurrent.verified.txt @@ -6,6 +6,18 @@ + | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001 + | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 + | 0000000000000001 | (0002) ValueType | Ascii | 0100000000000001 + | 0000000000000002 | (0002) ValueType | UInt8 | 0100000000000001 + | 0000000000000003 | (0002) ValueType | Null | 0100000000000001 @@ -14,32 +26,63 @@ + | 0000000000000006 | (0002) ValueType | UInt8 | 0100000000000001 + | 0000000000000007 | (0002) ValueType | Utf8 | 0100000000000001 + | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001 -+ | 0000000000000001 | (0003) Indexed | Null | 0100000000000001 -+ | 0000000000000007 | (0004) Optional | Null | 0100000000000001 -+ | 0000000000000001 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000002 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000003 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000004 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000005 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000006 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000007 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000008 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002 ++ | 0000000000000015 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000016 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000017 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000018 | (0002) ValueType | Utf8 | 0100000000000002 ++ | 0000000000000019 | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001A | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001B | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001C | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001D | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001E | (0002) ValueType | Blob | 0100000000000002 ++ | 000000000000001F | (0002) ValueType | HashedBlob | 0100000000000002 ++ | 0000000000000001 | (0003) Indexed | | 0100000000000001 ++ | 0000000000000014 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000015 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000018 | (0003) Indexed | | 0100000000000002 ++ | 000000000000001A | (0003) Indexed | | 0100000000000002 ++ | 000000000000001E | (0003) Indexed | | 0100000000000002 ++ | 000000000000001F | (0003) Indexed | | 0100000000000002 ++ | 0000000000000007 | (0004) Optional | | 0100000000000001 ++ | 0000000000000001 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000002 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000003 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000004 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000005 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000006 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000007 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000014 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000015 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000016 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000017 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000018 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000019 | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001A | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001B | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001C | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001D | (0006) Cardinality | 2 | 0100000000000002 ++ | 000000000000001E | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001F | (0006) Cardinality | 1 | 0100000000000002 + | 0100000000000001 | (0008) Timestamp | DateTime : 0 | 0100000000000001 + | 0100000000000002 | (0008) Timestamp | DateTime : 1 | 0100000000000002 + | 0100000000000003 | (0008) Timestamp | DateTime : 2 | 0100000000000003 -+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000002 -+ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000003 -+ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000002 -+ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000002 -+ | 0200000000000001 | (0016) Size | 42 B | 0100000000000002 -+ | 0200000000000002 | (0016) Size | 77 B | 0100000000000002 -+ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000003 -+ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000002 -+ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000002 -+ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000002 -+ | 0200000000000006 | (001B) Name | Test Collection 1 | 0100000000000002 -+ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000002 ++ | 0100000000000004 | (0008) Timestamp | DateTime : 3 | 0100000000000004 ++ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 ++ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000004 ++ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 ++ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000003 ++ | 0200000000000001 | (0016) Size | 0x000000000000002A | 0100000000000003 ++ | 0200000000000002 | (0016) Size | 0x000000000000004D | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000004 ++ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000003 ++ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000003 ++ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000003 ++ | 0200000000000006 | (001B) Name | Test Collection 1 | 0100000000000003 ++ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000003 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=AEVTHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=AEVTHistory.verified.txt index 6a55c6f7..f33a780d 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=AEVTHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=AEVTHistory.verified.txt @@ -1,6 +1,6 @@ -+ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000002 -- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 -+ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000002 -- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 -+ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000002 -- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 ++ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 +- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000004 ++ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 +- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000004 ++ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 +- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=AVETCurrent.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=AVETCurrent.verified.txt index 6b4a33ad..923689a6 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=AVETCurrent.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=AVETCurrent.verified.txt @@ -5,11 +5,23 @@ + | 0000000000000004 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Optional | 0100000000000001 + | 0000000000000001 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/UniqueId | 0100000000000001 + | 0000000000000002 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/ValueType | 0100000000000001 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 -+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000002 -+ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000003 -+ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000002 -+ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000002 -+ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000002 -+ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000002 -+ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000002 ++ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 ++ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000004 ++ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000003 ++ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 ++ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000003 ++ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000003 ++ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000003 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=AVETHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=AVETHistory.verified.txt index 9055f5de..391555f3 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=AVETHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=AVETHistory.verified.txt @@ -1,2 +1,2 @@ -+ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000002 -- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 ++ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 +- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=EAVTCurrent.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=EAVTCurrent.verified.txt index a79b3593..66158505 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=EAVTCurrent.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=EAVTCurrent.verified.txt @@ -1,45 +1,88 @@ + | 0000000000000001 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/UniqueId | 0100000000000001 + | 0000000000000001 | (0002) ValueType | Ascii | 0100000000000001 -+ | 0000000000000001 | (0003) Indexed | Null | 0100000000000001 -+ | 0000000000000001 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000001 | (0003) Indexed | | 0100000000000001 ++ | 0000000000000001 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000002 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/ValueType | 0100000000000001 + | 0000000000000002 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000002 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000002 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000003 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Indexed | 0100000000000001 + | 0000000000000003 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000003 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000003 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000004 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Optional | 0100000000000001 + | 0000000000000004 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000004 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000004 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000005 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/NoHistory | 0100000000000001 + | 0000000000000005 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000005 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000005 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001 + | 0000000000000006 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000006 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000006 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001 + | 0000000000000007 | (0002) ValueType | Utf8 | 0100000000000001 -+ | 0000000000000007 | (0004) Optional | Null | 0100000000000001 -+ | 0000000000000007 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000007 | (0004) Optional | | 0100000000000001 ++ | 0000000000000007 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 + | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001 -+ | 0000000000000008 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002 ++ | 0000000000000014 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000014 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000015 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000015 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000015 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 0000000000000016 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000016 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000017 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000017 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 ++ | 0000000000000018 | (0002) ValueType | Utf8 | 0100000000000002 ++ | 0000000000000018 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000018 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 0000000000000019 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000019 | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 000000000000001A | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001A | (0003) Indexed | | 0100000000000002 ++ | 000000000000001A | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 000000000000001B | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001B | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001C | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001C | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001D | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001D | (0006) Cardinality | 2 | 0100000000000002 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001E | (0002) ValueType | Blob | 0100000000000002 ++ | 000000000000001E | (0003) Indexed | | 0100000000000002 ++ | 000000000000001E | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 ++ | 000000000000001F | (0002) ValueType | HashedBlob | 0100000000000002 ++ | 000000000000001F | (0003) Indexed | | 0100000000000002 ++ | 000000000000001F | (0006) Cardinality | 1 | 0100000000000002 + | 0100000000000001 | (0008) Timestamp | DateTime : 0 | 0100000000000001 + | 0100000000000002 | (0008) Timestamp | DateTime : 1 | 0100000000000002 + | 0100000000000003 | (0008) Timestamp | DateTime : 2 | 0100000000000003 -+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000002 -+ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000002 -+ | 0200000000000001 | (0016) Size | 42 B | 0100000000000002 -+ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000003 -+ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000003 -+ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000002 -+ | 0200000000000002 | (0016) Size | 77 B | 0100000000000002 -+ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000002 -+ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000002 -+ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000002 -+ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000006 | (001B) Name | Test Collection 1 | 0100000000000002 -+ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000002 ++ | 0100000000000004 | (0008) Timestamp | DateTime : 3 | 0100000000000004 ++ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 ++ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 ++ | 0200000000000001 | (0016) Size | 0x000000000000002A | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000004 ++ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000004 ++ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000003 ++ | 0200000000000002 | (0016) Size | 0x000000000000004D | 0100000000000003 ++ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000003 ++ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000003 ++ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000003 ++ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000006 | (001B) Name | Test Collection 1 | 0100000000000003 ++ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000003 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=EAVTHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=EAVTHistory.verified.txt index 3ac421f8..c652d989 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=EAVTHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=EAVTHistory.verified.txt @@ -1,6 +1,6 @@ -+ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000002 -- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 -+ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000002 -- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 -+ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000002 -- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 +- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000004 ++ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 +- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000004 ++ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 +- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=TxLog.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=TxLog.verified.txt index 127bbc9d..62e014e1 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=TxLog.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=TxLog.verified.txt @@ -1,51 +1,94 @@ + | 0000000000000001 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/UniqueId | 0100000000000001 + | 0000000000000001 | (0002) ValueType | Ascii | 0100000000000001 -+ | 0000000000000001 | (0003) Indexed | Null | 0100000000000001 -+ | 0000000000000001 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000001 | (0003) Indexed | | 0100000000000001 ++ | 0000000000000001 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000002 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/ValueType | 0100000000000001 + | 0000000000000002 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000002 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000002 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000003 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Indexed | 0100000000000001 + | 0000000000000003 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000003 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000003 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000004 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Optional | 0100000000000001 + | 0000000000000004 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000004 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000004 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000005 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/NoHistory | 0100000000000001 + | 0000000000000005 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000005 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000005 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001 + | 0000000000000006 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000006 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000006 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001 + | 0000000000000007 | (0002) ValueType | Utf8 | 0100000000000001 -+ | 0000000000000007 | (0004) Optional | Null | 0100000000000001 -+ | 0000000000000007 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000007 | (0004) Optional | | 0100000000000001 ++ | 0000000000000007 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 + | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001 -+ | 0000000000000008 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001 + | 0100000000000001 | (0008) Timestamp | DateTime : 0 | 0100000000000001 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002 ++ | 0000000000000014 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000014 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000015 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000015 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000015 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 0000000000000016 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000016 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000017 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000017 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 ++ | 0000000000000018 | (0002) ValueType | Utf8 | 0100000000000002 ++ | 0000000000000018 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000018 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 0000000000000019 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000019 | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 000000000000001A | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001A | (0003) Indexed | | 0100000000000002 ++ | 000000000000001A | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 000000000000001B | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001B | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001C | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001C | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001D | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001D | (0006) Cardinality | 2 | 0100000000000002 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001E | (0002) ValueType | Blob | 0100000000000002 ++ | 000000000000001E | (0003) Indexed | | 0100000000000002 ++ | 000000000000001E | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 ++ | 000000000000001F | (0002) ValueType | HashedBlob | 0100000000000002 ++ | 000000000000001F | (0003) Indexed | | 0100000000000002 ++ | 000000000000001F | (0006) Cardinality | 1 | 0100000000000002 + | 0100000000000002 | (0008) Timestamp | DateTime : 1 | 0100000000000002 -+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000002 -+ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000002 -+ | 0200000000000001 | (0016) Size | 42 B | 0100000000000002 -+ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000002 -+ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000002 -+ | 0200000000000002 | (0016) Size | 77 B | 0100000000000002 -+ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000002 -+ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000002 -+ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000002 -+ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000006 | (001B) Name | Test Collection 1 | 0100000000000002 -+ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000002 + | 0100000000000003 | (0008) Timestamp | DateTime : 2 | 0100000000000003 -- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 -+ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000003 -+ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000003 -- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 -- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 ++ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 ++ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 ++ | 0200000000000001 | (0016) Size | 0x000000000000002A | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003 ++ | 0200000000000002 | (0015) Hash | 0x00000000DEADBEAF | 0100000000000003 ++ | 0200000000000002 | (0016) Size | 0x000000000000004D | 0100000000000003 ++ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000003 | (0018) Name | Test Mod 1 | 0100000000000003 ++ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000004 | (001A) Name | Test Loadout 1 | 0100000000000003 ++ | 0200000000000005 | (0018) Name | Test Mod 2 | 0100000000000003 ++ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000006 | (001B) Name | Test Collection 1 | 0100000000000003 ++ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 ++ | 0100000000000004 | (0008) Timestamp | DateTime : 3 | 0100000000000004 +- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000004 ++ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000004 ++ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000004 +- | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000004 +- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=VAETCurrent.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=VAETCurrent.verified.txt index 34fff010..a4f11e36 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=VAETCurrent.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=VAETCurrent.verified.txt @@ -1,6 +1,6 @@ -+ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000002 -+ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000002 -+ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000003 ++ | 0200000000000002 | (0017) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000006 | (001D) Mod | 0200000000000003 | 0100000000000003 ++ | 0200000000000003 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000005 | (0019) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000006 | (001C) Loadout | 0200000000000004 | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000005 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=VAETHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=VAETHistory.verified.txt index 4685e242..3244d438 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=VAETHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.InsertedDatomsShowUpInTheIndex_type=VAETHistory.verified.txt @@ -1,4 +1,4 @@ -+ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000002 -- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 -+ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000002 -- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000003 +- | 0200000000000001 | (0017) Mod | 0200000000000003 | 0100000000000004 ++ | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000003 +- | 0200000000000006 | (001D) Mod | 0200000000000005 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=AEVTCurrent.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=AEVTCurrent.verified.txt index ff47d05b..7000c6d9 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=AEVTCurrent.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=AEVTCurrent.verified.txt @@ -6,6 +6,18 @@ + | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001 + | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 + | 0000000000000001 | (0002) ValueType | Ascii | 0100000000000001 + | 0000000000000002 | (0002) ValueType | UInt8 | 0100000000000001 + | 0000000000000003 | (0002) ValueType | Null | 0100000000000001 @@ -14,16 +26,47 @@ + | 0000000000000006 | (0002) ValueType | UInt8 | 0100000000000001 + | 0000000000000007 | (0002) ValueType | Utf8 | 0100000000000001 + | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001 -+ | 0000000000000001 | (0003) Indexed | Null | 0100000000000001 -+ | 0000000000000007 | (0004) Optional | Null | 0100000000000001 -+ | 0000000000000001 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000002 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000003 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000004 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000005 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000006 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000007 | (0006) Cardinality | One | 0100000000000001 -+ | 0000000000000008 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002 ++ | 0000000000000015 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000016 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000017 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000018 | (0002) ValueType | Utf8 | 0100000000000002 ++ | 0000000000000019 | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001A | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001B | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001C | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001D | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001E | (0002) ValueType | Blob | 0100000000000002 ++ | 000000000000001F | (0002) ValueType | HashedBlob | 0100000000000002 ++ | 0000000000000001 | (0003) Indexed | | 0100000000000001 ++ | 0000000000000014 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000015 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000018 | (0003) Indexed | | 0100000000000002 ++ | 000000000000001A | (0003) Indexed | | 0100000000000002 ++ | 000000000000001E | (0003) Indexed | | 0100000000000002 ++ | 000000000000001F | (0003) Indexed | | 0100000000000002 ++ | 0000000000000007 | (0004) Optional | | 0100000000000001 ++ | 0000000000000001 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000002 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000003 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000004 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000005 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000006 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000007 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000014 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000015 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000016 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000017 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000018 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000019 | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001A | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001B | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001C | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001D | (0006) Cardinality | 2 | 0100000000000002 ++ | 000000000000001E | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001F | (0006) Cardinality | 1 | 0100000000000002 + | 0100000000000001 | (0008) Timestamp | DateTime : 0 | 0100000000000001 + | 0100000000000002 | (0008) Timestamp | DateTime : 1 | 0100000000000002 + | 0100000000000003 | (0008) Timestamp | DateTime : 2 | 0100000000000003 ++ | 0100000000000004 | (0008) Timestamp | DateTime : 3 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=AEVTHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=AEVTHistory.verified.txt index f6425d73..5ed3b835 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=AEVTHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=AEVTHistory.verified.txt @@ -1,8 +1,8 @@ -+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000002 -- | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 -+ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000002 -- | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 -+ | 0200000000000001 | (0016) Size | 42 B | 0100000000000002 -- | 0200000000000001 | (0016) Size | 42 B | 0100000000000003 -+ | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000002 -- | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000003 ++ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 +- | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000004 ++ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 +- | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000004 ++ | 0200000000000001 | (0016) Size | 0x000000000000002A | 0100000000000003 +- | 0200000000000001 | (0016) Size | 0x000000000000002A | 0100000000000004 ++ | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000003 +- | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=AVETCurrent.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=AVETCurrent.verified.txt index c87ebd6b..0be15edd 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=AVETCurrent.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=AVETCurrent.verified.txt @@ -5,4 +5,16 @@ + | 0000000000000004 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Optional | 0100000000000001 + | 0000000000000001 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/UniqueId | 0100000000000001 + | 0000000000000002 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/ValueType | 0100000000000001 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=AVETHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=AVETHistory.verified.txt index 20cdea06..ee34150d 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=AVETHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=AVETHistory.verified.txt @@ -1,4 +1,4 @@ -+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000002 -- | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 -+ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000002 -- | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 ++ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 +- | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000004 ++ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 +- | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=EAVTCurrent.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=EAVTCurrent.verified.txt index 8e1ed9c0..791bad5f 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=EAVTCurrent.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=EAVTCurrent.verified.txt @@ -1,29 +1,72 @@ + | 0000000000000001 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/UniqueId | 0100000000000001 + | 0000000000000001 | (0002) ValueType | Ascii | 0100000000000001 -+ | 0000000000000001 | (0003) Indexed | Null | 0100000000000001 -+ | 0000000000000001 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000001 | (0003) Indexed | | 0100000000000001 ++ | 0000000000000001 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000002 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/ValueType | 0100000000000001 + | 0000000000000002 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000002 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000002 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000003 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Indexed | 0100000000000001 + | 0000000000000003 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000003 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000003 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000004 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Optional | 0100000000000001 + | 0000000000000004 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000004 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000004 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000005 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/NoHistory | 0100000000000001 + | 0000000000000005 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000005 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000005 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001 + | 0000000000000006 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000006 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000006 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001 + | 0000000000000007 | (0002) ValueType | Utf8 | 0100000000000001 -+ | 0000000000000007 | (0004) Optional | Null | 0100000000000001 -+ | 0000000000000007 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000007 | (0004) Optional | | 0100000000000001 ++ | 0000000000000007 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 + | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001 -+ | 0000000000000008 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002 ++ | 0000000000000014 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000014 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000015 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000015 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000015 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 0000000000000016 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000016 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000017 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000017 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 ++ | 0000000000000018 | (0002) ValueType | Utf8 | 0100000000000002 ++ | 0000000000000018 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000018 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 0000000000000019 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000019 | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 000000000000001A | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001A | (0003) Indexed | | 0100000000000002 ++ | 000000000000001A | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 000000000000001B | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001B | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001C | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001C | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001D | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001D | (0006) Cardinality | 2 | 0100000000000002 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001E | (0002) ValueType | Blob | 0100000000000002 ++ | 000000000000001E | (0003) Indexed | | 0100000000000002 ++ | 000000000000001E | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 ++ | 000000000000001F | (0002) ValueType | HashedBlob | 0100000000000002 ++ | 000000000000001F | (0003) Indexed | | 0100000000000002 ++ | 000000000000001F | (0006) Cardinality | 1 | 0100000000000002 + | 0100000000000001 | (0008) Timestamp | DateTime : 0 | 0100000000000001 + | 0100000000000002 | (0008) Timestamp | DateTime : 1 | 0100000000000002 + | 0100000000000003 | (0008) Timestamp | DateTime : 2 | 0100000000000003 ++ | 0100000000000004 | (0008) Timestamp | DateTime : 3 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=EAVTHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=EAVTHistory.verified.txt index f6425d73..5ed3b835 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=EAVTHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=EAVTHistory.verified.txt @@ -1,8 +1,8 @@ -+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000002 -- | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 -+ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000002 -- | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 -+ | 0200000000000001 | (0016) Size | 42 B | 0100000000000002 -- | 0200000000000001 | (0016) Size | 42 B | 0100000000000003 -+ | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000002 -- | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000003 ++ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 +- | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000004 ++ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 +- | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000004 ++ | 0200000000000001 | (0016) Size | 0x000000000000002A | 0100000000000003 +- | 0200000000000001 | (0016) Size | 0x000000000000002A | 0100000000000004 ++ | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000003 +- | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=TxLog.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=TxLog.verified.txt index 0e2e9ad8..93ed76d2 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=TxLog.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=TxLog.verified.txt @@ -1,37 +1,80 @@ + | 0000000000000001 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/UniqueId | 0100000000000001 + | 0000000000000001 | (0002) ValueType | Ascii | 0100000000000001 -+ | 0000000000000001 | (0003) Indexed | Null | 0100000000000001 -+ | 0000000000000001 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000001 | (0003) Indexed | | 0100000000000001 ++ | 0000000000000001 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000002 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/ValueType | 0100000000000001 + | 0000000000000002 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000002 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000002 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000003 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Indexed | 0100000000000001 + | 0000000000000003 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000003 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000003 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000004 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Optional | 0100000000000001 + | 0000000000000004 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000004 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000004 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000005 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/NoHistory | 0100000000000001 + | 0000000000000005 | (0002) ValueType | Null | 0100000000000001 -+ | 0000000000000005 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000005 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001 + | 0000000000000006 | (0002) ValueType | UInt8 | 0100000000000001 -+ | 0000000000000006 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000006 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001 + | 0000000000000007 | (0002) ValueType | Utf8 | 0100000000000001 -+ | 0000000000000007 | (0004) Optional | Null | 0100000000000001 -+ | 0000000000000007 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000007 | (0004) Optional | | 0100000000000001 ++ | 0000000000000007 | (0006) Cardinality | 1 | 0100000000000001 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 + | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001 -+ | 0000000000000008 | (0006) Cardinality | One | 0100000000000001 ++ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001 + | 0100000000000001 | (0008) Timestamp | DateTime : 0 | 0100000000000001 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002 ++ | 0000000000000014 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000014 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000015 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000015 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000015 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 0000000000000016 | (0002) ValueType | UInt64 | 0100000000000002 ++ | 0000000000000016 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000017 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000017 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 ++ | 0000000000000018 | (0002) ValueType | Utf8 | 0100000000000002 ++ | 0000000000000018 | (0003) Indexed | | 0100000000000002 ++ | 0000000000000018 | (0006) Cardinality | 1 | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 0000000000000019 | (0002) ValueType | Reference | 0100000000000002 ++ | 0000000000000019 | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 000000000000001A | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001A | (0003) Indexed | | 0100000000000002 ++ | 000000000000001A | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 000000000000001B | (0002) ValueType | Utf8 | 0100000000000002 ++ | 000000000000001B | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001C | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001C | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001D | (0002) ValueType | Reference | 0100000000000002 ++ | 000000000000001D | (0006) Cardinality | 2 | 0100000000000002 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001E | (0002) ValueType | Blob | 0100000000000002 ++ | 000000000000001E | (0003) Indexed | | 0100000000000002 ++ | 000000000000001E | (0006) Cardinality | 1 | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 ++ | 000000000000001F | (0002) ValueType | HashedBlob | 0100000000000002 ++ | 000000000000001F | (0003) Indexed | | 0100000000000002 ++ | 000000000000001F | (0006) Cardinality | 1 | 0100000000000002 + | 0100000000000002 | (0008) Timestamp | DateTime : 1 | 0100000000000002 -+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000002 -+ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000002 -+ | 0200000000000001 | (0016) Size | 42 B | 0100000000000002 -+ | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000002 + | 0100000000000003 | (0008) Timestamp | DateTime : 2 | 0100000000000003 -- | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 -- | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 -- | 0200000000000001 | (0016) Size | 42 B | 0100000000000003 -- | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000003 ++ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003 ++ | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000003 ++ | 0200000000000001 | (0016) Size | 0x000000000000002A | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000003 ++ | 0100000000000004 | (0008) Timestamp | DateTime : 3 | 0100000000000004 +- | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000004 +- | 0200000000000001 | (0015) Hash | 0x00000000DEADBEEF | 0100000000000004 +- | 0200000000000001 | (0016) Size | 0x000000000000002A | 0100000000000004 +- | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=VAETHistory.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=VAETHistory.verified.txt index 523a0859..d9d22cc0 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=VAETHistory.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTestVerifyData/RocksDB.RetractedValuesAreSupported_type=VAETHistory.verified.txt @@ -1,2 +1,2 @@ -+ | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000002 -- | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000003 ++ | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000003 +- | 0200000000000001 | (0017) Mod | 0200000000000002 | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/InMemoryTests.CanLoadExistingAttributes.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/InMemoryTests.CanLoadExistingAttributes.verified.txt index 728e1d6c..89bdbca8 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/InMemoryTests.CanLoadExistingAttributes.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/InMemoryTests.CanLoadExistingAttributes.verified.txt @@ -6,3 +6,15 @@ + | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001 + | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/RocksDB.CanLoadExistingAttributes.verified.txt b/tests/NexusMods.MnemonicDB.Storage.Tests/RocksDB.CanLoadExistingAttributes.verified.txt index 728e1d6c..89bdbca8 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/RocksDB.CanLoadExistingAttributes.verified.txt +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/RocksDB.CanLoadExistingAttributes.verified.txt @@ -6,3 +6,15 @@ + | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001 + | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001 + | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001 ++ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002 ++ | 0000000000000015 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Hash | 0100000000000002 ++ | 0000000000000016 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Size | 0100000000000002 ++ | 0000000000000017 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Mod | 0100000000000002 ++ | 0000000000000018 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Name | 0100000000000002 ++ | 0000000000000019 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Mod/Loadout | 0100000000000002 ++ | 000000000000001A | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Loadout/Name | 0100000000000002 ++ | 000000000000001B | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Name | 0100000000000002 ++ | 000000000000001C | (0001) UniqueId | NexusMods.MnemonicDB.T...del.Collection/Loadout | 0100000000000002 ++ | 000000000000001D | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.Collection/Mod | 0100000000000002 ++ | 000000000000001E | (0001) UniqueId | NexusMods.MnemonicDB.S...stAttributes/InKeyBlob | 0100000000000002 ++ | 000000000000001F | (0001) UniqueId | NexusMods.MnemonicDB.S...Attributes/InValueBlob | 0100000000000002 diff --git a/tests/NexusMods.MnemonicDB.TestModel/Helpers/ExtensionMethods.cs b/tests/NexusMods.MnemonicDB.TestModel/Helpers/ExtensionMethods.cs index cfe76457..70f7e0df 100644 --- a/tests/NexusMods.MnemonicDB.TestModel/Helpers/ExtensionMethods.cs +++ b/tests/NexusMods.MnemonicDB.TestModel/Helpers/ExtensionMethods.cs @@ -1,7 +1,9 @@ using System.IO.Hashing; using System.Runtime.InteropServices; using System.Text; +using Microsoft.Extensions.Primitives; using NexusMods.MnemonicDB.Abstractions; +using NexusMods.MnemonicDB.Abstractions.BuiltInEntities; using NexusMods.MnemonicDB.Abstractions.DatomIterators; using NexusMods.MnemonicDB.Abstractions.ElementComparers; using NexusMods.MnemonicDB.Abstractions.Internals; @@ -12,6 +14,9 @@ public static class ExtensionMethods { public static string ToTable(this IEnumerable datoms, AttributeCache cache) { + var valueTagId = cache.GetAttributeId(AttributeDefinition.ValueType.Id); + var timestampId = cache.GetAttributeId(Transaction.Timestamp.Id); + string TruncateOrPad(string val, int length) { if (val.Length > length) @@ -40,15 +45,17 @@ string TruncateOrPad(string val, int length) sb.Append(" | "); sb.Append($"({attrId}) {symColumn}"); sb.Append(" | "); - + switch (datom.Prefix.ValueTag) { case ValueTags.Reference: + { var val = MemoryMarshal.Read(datom.ValueSpan); sb.Append(val.Value.ToString("X16").PadRight(48)); break; + } case ValueTags.Ascii: { var size = MemoryMarshal.Read(datom.ValueSpan); @@ -57,15 +64,100 @@ string TruncateOrPad(string val, int length) break; } + case ValueTags.Int64 when datom.A == timestampId: + sb.Append($"DateTime : {dateTimeCount++}".PadRight(48)); + break; case ValueTags.UInt64: var ul = MemoryMarshal.Read(datom.ValueSpan); - sb.Append(ul.ToString("X16").PadRight(48)); + sb.Append(("0x" + ul.ToString("X16")).PadRight(48)); break; case ValueTags.Blob: + { var code = XxHash3.HashToUInt64(datom.ValueSpan); var hash = code.ToString("X16"); - sb.Append($"Blob 0x{hash} {datom.ValueSpan.Length} bytes".PadRight(48)); + sb.Append($"{datom.Prefix.ValueTag} 0x{hash} {datom.ValueSpan.Length} bytes".PadRight(48)); + break; + } + case ValueTags.HashedBlob: + { + var code = XxHash3.HashToUInt64(datom.ValueSpan[sizeof(ulong)..]); + var hash = code.ToString("X16"); + sb.Append($"{datom.Prefix.ValueTag} 0x{hash} {datom.ValueSpan.Length} bytes".PadRight(48)); + break; + } + case ValueTags.Null: + sb.Append(" ".PadRight(48)); + break; + case ValueTags.UInt8 when datom.A == valueTagId: + var tag = MemoryMarshal.Read(datom.ValueSpan); + sb.Append($"{tag}".PadRight(48)); + break; + case ValueTags.UInt8: + sb.Append(MemoryMarshal.Read(datom.ValueSpan).ToString().PadRight(48)); + break; + case ValueTags.UInt16: + sb.Append(MemoryMarshal.Read(datom.ValueSpan).ToString().PadRight(48)); + break; + case ValueTags.Utf8: + { + var str = Encoding.UTF8.GetString(datom.ValueSpan[sizeof(int)..]); + sb.Append(TruncateOrPad(str, 48)); + break; + } + case ValueTags.Utf8Insensitive: + { + var str = Encoding.UTF8.GetString(datom.ValueSpan[sizeof(int)..]); + sb.Append(TruncateOrPad(str, 48)); + break; + } + case ValueTags.UInt32: + { + var val = MemoryMarshal.Read(datom.ValueSpan); + sb.Append(val.ToString().PadRight(48)); + break; + } + case ValueTags.UInt128: + { + var val = MemoryMarshal.Read(datom.ValueSpan); + sb.Append(val.ToString("X16").PadRight(48)); + break; + } + case ValueTags.Int16: + { + var val = MemoryMarshal.Read(datom.ValueSpan); + sb.Append(val.ToString().PadRight(48)); + break; + } + case ValueTags.Int32: + { + var val = MemoryMarshal.Read(datom.ValueSpan); + sb.Append(val.ToString().PadRight(48)); break; + } + case ValueTags.Int64: + { + var val = MemoryMarshal.Read(datom.ValueSpan); + sb.Append(val.ToString().PadRight(48)); + break; + } + case ValueTags.Int128: + { + var val = MemoryMarshal.Read(datom.ValueSpan); + sb.Append(val.ToString("X16").PadRight(48)); + break; + } + case ValueTags.Float32: + { + var val = MemoryMarshal.Read(datom.ValueSpan); + sb.Append(val.ToString().PadRight(48)); + break; + } + case ValueTags.Float64: + { + var val = MemoryMarshal.Read(datom.ValueSpan); + sb.Append(val.ToString().PadRight(48)); + break; + } default: var otherCode = XxHash3.HashToUInt64(datom.ValueSpan); var otherHash = otherCode.ToString("X16"); diff --git a/tests/NexusMods.MnemonicDB.Tests/AMnemonicDBTest.cs b/tests/NexusMods.MnemonicDB.Tests/AMnemonicDBTest.cs index 92fbab61..4ce4f8f1 100644 --- a/tests/NexusMods.MnemonicDB.Tests/AMnemonicDBTest.cs +++ b/tests/NexusMods.MnemonicDB.Tests/AMnemonicDBTest.cs @@ -1,4 +1,6 @@ -using Microsoft.Extensions.DependencyInjection; +using System.IO.Hashing; +using System.Text; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using NexusMods.MnemonicDB.Abstractions; using NexusMods.MnemonicDB.Abstractions.Models; @@ -19,7 +21,7 @@ public class AMnemonicDBTest : IDisposable { private readonly IAttribute[] _attributes; protected readonly IServiceProvider Provider; - private AttributeCache _attributeCache; + protected AttributeCache AttributeCache; private Backend _backend; private DatomStore _store; @@ -33,22 +35,22 @@ protected AMnemonicDBTest(IServiceProvider provider) Provider = provider; _attributes = provider.GetRequiredService>().ToArray(); - _attributeCache = new AttributeCache(); + AttributeCache = new AttributeCache(); Config = new DatomStoreSettings { Path = FileSystem.Shared.GetKnownPath(KnownPath.EntryDirectory) .Combine("tests_MnemonicDB" + Guid.NewGuid()) }; - _backend = new Backend(_attributeCache); + _backend = new Backend(AttributeCache); - _store = new DatomStore(provider.GetRequiredService>(), _attributeCache, Config, _backend); + _store = new DatomStore(provider.GetRequiredService>(), AttributeCache, Config, _backend); _analyzers = - new IAnalyzer[]{ + [ new DatomCountAnalyzer(), - new AttributesAnalyzer(), - }; + new AttributesAnalyzer() + ]; Connection = new Connection(provider.GetRequiredService>(), _store, provider, _attributes, _analyzers); @@ -69,9 +71,71 @@ protected SettingsTask VerifyModel(IEnumerable models) return VerifyTable(models.SelectMany(e => e)); } - protected SettingsTask VerifyTable(IEnumerable datoms) + protected SettingsTask VerifyTable(IEnumerable datoms) + { + return Verify(ToTable(datoms, AttributeCache)); + } + + public static string ToTable(IEnumerable datoms, AttributeCache cache) { - return Verify(datoms.ToTable(_attributeCache)); + string TruncateOrPad(string val, int length) + { + if (val.Length > length) + { + var midPoint = length / 2; + return (val[..(midPoint - 2)] + "..." + val[^(midPoint - 2)..]).PadRight(length); + } + + return val.PadRight(length); + } + + var dateTimeCount = 0; + + var sb = new StringBuilder(); + foreach (var datom in datoms) + { + var isRetract = datom.IsRetract; + + var symColumn = TruncateOrPad(datom.A.Id.Name, 24); + var attrId = cache.GetAttributeId(datom.A.Id).Value.ToString("X4"); + + sb.Append(isRetract ? "-" : "+"); + sb.Append(" | "); + sb.Append(datom.E.Value.ToString("X16")); + sb.Append(" | "); + sb.Append($"({attrId}) {symColumn}"); + sb.Append(" | "); + + + + switch (datom.ObjectValue) + { + case EntityId eid: + sb.Append(eid.Value.ToString("X16").PadRight(48)); + break; + case ulong ul: + sb.Append(ul.ToString("X16").PadRight(48)); + break; + case byte[] byteArray: + var code = XxHash3.HashToUInt64(byteArray); + var hash = code.ToString("X16"); + sb.Append($"Blob 0x{hash} {byteArray.Length} bytes".PadRight(48)); + break; + case DateTime dateTime: + sb.Append($"DateTime : {dateTimeCount++}".PadRight(48)); + break; + default: + sb.Append(TruncateOrPad(datom.ObjectValue.ToString()!, 48)); + break; + } + + sb.Append(" | "); + sb.Append(datom.T.Value.ToString("X16")); + + sb.AppendLine(); + } + + return sb.ToString(); } protected async Task InsertExampleData() @@ -134,9 +198,9 @@ protected async Task RestartDatomStore() GC.Collect(); - _backend = new Backend(_attributeCache); - _attributeCache = new AttributeCache(); - _store = new DatomStore(Provider.GetRequiredService>(), _attributeCache, Config, _backend); + _backend = new Backend(AttributeCache); + AttributeCache = new AttributeCache(); + _store = new DatomStore(Provider.GetRequiredService>(), AttributeCache, Config, _backend); Connection = new Connection(Provider.GetRequiredService>(), _store, Provider, _attributes, _analyzers); } diff --git a/tests/NexusMods.MnemonicDB.Tests/DbTests.cs b/tests/NexusMods.MnemonicDB.Tests/DbTests.cs index 935c7e8c..b7d4047c 100644 --- a/tests/NexusMods.MnemonicDB.Tests/DbTests.cs +++ b/tests/NexusMods.MnemonicDB.Tests/DbTests.cs @@ -86,7 +86,7 @@ public async Task ReadDatomsOverTime() foreach (var txId in txEs) { var db = Connection.AsOf(txId); - var resolved = db.Datoms(modId).Resolved(); + var resolved = db.Datoms(modId).Resolved(Connection); await VerifyTable(resolved).UseTextForParameters("mod data_" + txId.Value); } } @@ -213,7 +213,7 @@ public async Task CanGetCommitUpdates() { // Only Txes we care about if (update.RecentlyAdded.Any(d => d.E == realId)) - updates.Add(update.RecentlyAdded.Select(d => d.Resolved).ToArray()); + updates.Add(update.RecentlyAdded.Resolved(Connection).ToArray()); }); for (var idx = 0; idx < 4; idx++) @@ -621,14 +621,19 @@ public async Task CanObserveIndexChanges() List changes = new(); // Define the slice to observe - var slice = SliceDescriptor.Create(Mod.Name, Connection.Db.Registry); + var slice = SliceDescriptor.Create(Mod.Name, AttributeCache); + var resolver = Connection.AttributeResolver; // Setup the subscription using var _ = Connection.ObserveDatoms(slice) // Snapshot the values each time - .QueryWhenChanged(datoms => datoms.Items.Select(d => d.Resolved.ObjectValue.ToString()!).ToArray()) + .QueryWhenChanged(datoms => datoms.Items.Select(d => resolver.Resolve(d)).ToArray()) // Add the changes to the list - .Subscribe(x => changes.Add(x.Order().ToArray())); + .Subscribe(x => + { + var data = x.Select(o => o.ObjectValue.ToString()!).Order().ToArray(); + changes.Add(data); + }); // Rename a mod using var tx = Connection.BeginTransaction(); @@ -681,7 +686,7 @@ public async Task ObserveLargeDatomChanges() tx2.Add(loadout.E, Loadout.Name, "Test Loadout 10 Updated"); await tx2.Commit(); - list.Items.First(datom => datom.E == loadout.E).Resolved.ObjectValue.Should().Be("Test Loadout 10 Updated"); + list.Items.First(datom => datom.E == loadout.E).Resolved(Connection.AttributeResolver).ObjectValue.Should().Be("Test Loadout 10 Updated"); allLoadouts.Should().Be(10000); } @@ -836,7 +841,7 @@ public async Task CanObserveIndexChangesWithoutFlickering() List> changes = new(); // Define the slice to observe - var slice = SliceDescriptor.Create(Mod.Name, Connection.Db.Registry); + var slice = SliceDescriptor.Create(Mod.Name, AttributeCache); // Setup the subscription using var _ = Connection.ObserveDatoms(slice) @@ -899,7 +904,7 @@ public async Task MultipleIncludesDontSplitEntities() // If the above is working correctly we'll only have one entityId for the client, if it's wrong, the // one of the parents may have a different entityId - await VerifyTable(result.Db.Datoms(result.NewTx).Resolved()); + await VerifyTable(result.Db.Datoms(result.NewTx).Resolved(Connection)); } [Fact] @@ -933,7 +938,7 @@ public async Task MultipleIncludesCanBeConstructedSeparately() // If the above is working correctly we'll only have one entityId for the client, if it's wrong, the // one of the parents may have a different entityId - await VerifyTable(result.Db.Datoms(result.NewTx).Resolved()); + await VerifyTable(result.Db.Datoms(result.NewTx).Resolved(Connection)); } @@ -983,8 +988,8 @@ public async Task CanWriteTupleAttributes() var result = await tx.Commit(); - var avet = Connection.Db.Datoms(SliceDescriptor.Create(File.TuplePath, (EntityId.From(0), ""), (EntityId.MaxValueNoPartition, ""), Connection.Db.Registry)); - await VerifyTable(avet.Resolved()); + var avet = Connection.Db.Datoms(SliceDescriptor.Create(File.TuplePath, (EntityId.From(0), ""), (EntityId.MaxValueNoPartition, ""), AttributeCache)); + await VerifyTable(avet.Resolved(Connection)); } [Fact] @@ -1002,7 +1007,7 @@ public async Task CanUseTuple3Attributes() var results = await tx.Commit(); - await VerifyTable(results.Db.Datoms(File.TupleTest).Resolved()); + await VerifyTable(results.Db.Datoms(File.TupleTest).Resolved(Connection)); } [Fact] @@ -1029,7 +1034,7 @@ public async Task CanGetAnalyzerData() var countData = Connection.Db.AnalyzerData(); countData.Should().Be(result.Db.RecentlyAdded.Count); - var attrs = Connection.Db.AnalyzerData>(); + var attrs = Connection.Db.AnalyzerData>(); attrs.Should().NotBeEmpty(); } From c276d7a3a12431ba34268b07c4f74245a89b946d Mon Sep 17 00:00:00 2001 From: halgari Date: Thu, 19 Sep 2024 14:52:25 -0600 Subject: [PATCH 6/9] Everything but tuples work --- .../AttributeCache.cs | 7 +- .../AttributeResolver.cs | 6 ++ src/NexusMods.MnemonicDB/Connection.cs | 65 +++++++++---------- .../AMnemonicDBTest.cs | 4 +- 4 files changed, 46 insertions(+), 36 deletions(-) diff --git a/src/NexusMods.MnemonicDB.Abstractions/AttributeCache.cs b/src/NexusMods.MnemonicDB.Abstractions/AttributeCache.cs index 6babc5db..0485e9a5 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/AttributeCache.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/AttributeCache.cs @@ -38,7 +38,12 @@ public AttributeCache() } } - + + /// + /// All the defined attribute ids + /// + public IEnumerable AllAttributeIds => _attributeIdsBySymbol.Keys; + /// /// Resets the cache, causing it to re-query the database for the latest definitions. /// diff --git a/src/NexusMods.MnemonicDB.Abstractions/AttributeResolver.cs b/src/NexusMods.MnemonicDB.Abstractions/AttributeResolver.cs index 14f2cbb9..4ee6b6de 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/AttributeResolver.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/AttributeResolver.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Frozen; +using System.Collections.Generic; using System.Linq; using Microsoft.Extensions.DependencyInjection; using NexusMods.MnemonicDB.Abstractions.DatomIterators; @@ -45,4 +46,9 @@ public IReadDatom Resolve(Datom datom) /// Gets the service object of the specified type. /// public IServiceProvider ServiceProvider { get; } + + /// + /// The defined attributes as seen in the DI container + /// + public IEnumerable DefinedAttributes => _attrsById.Values; } diff --git a/src/NexusMods.MnemonicDB/Connection.cs b/src/NexusMods.MnemonicDB/Connection.cs index 548d2c42..f79a92bf 100644 --- a/src/NexusMods.MnemonicDB/Connection.cs +++ b/src/NexusMods.MnemonicDB/Connection.cs @@ -7,6 +7,7 @@ using Microsoft.Extensions.Logging; using NexusMods.MnemonicDB.Abstractions; using NexusMods.MnemonicDB.Abstractions.BuiltInEntities; +using NexusMods.MnemonicDB.Abstractions.ElementComparers; using NexusMods.MnemonicDB.Abstractions.IndexSegments; using NexusMods.MnemonicDB.Abstractions.Internals; using NexusMods.MnemonicDB.Abstractions.Query; @@ -24,7 +25,6 @@ namespace NexusMods.MnemonicDB; public class Connection : IConnection { private readonly IDatomStore _store; - private readonly Dictionary _declaredAttributes; private readonly ILogger _logger; private R3.BehaviorSubject _dbStream; @@ -34,13 +34,12 @@ public class Connection : IConnection /// /// Main connection class, co-ordinates writes and immutable reads /// - public Connection(ILogger logger, IDatomStore store, IServiceProvider provider, IEnumerable declaredAttributes, IEnumerable analyzers) + public Connection(ILogger logger, IDatomStore store, IServiceProvider provider, IEnumerable analyzers) { ServiceProvider = provider; AttributeCache = store.AttributeCache; AttributeResolver = new AttributeResolver(provider, AttributeCache); _logger = logger; - _declaredAttributes = declaredAttributes.ToDictionary(a => a.Id); _store = store; _dbStream = new R3.BehaviorSubject(default!); _analyzers = analyzers.ToArray(); @@ -145,47 +144,40 @@ public IObservable Revisions } } - private void AddMissingAttributes(IEnumerable declaredAttributes) + private void AddMissingAttributes() { - var existing = ExistingAttributes().ToDictionary(a => a.UniqueId); + var declaredAttributes = AttributeResolver.DefinedAttributes; + var existing = AttributeCache.AllAttributeIds.ToHashSet(); + if (existing.Count == 0) throw new AggregateException( "No attributes found in the database, something went wrong, as it should have been bootstrapped by now"); - var missing = declaredAttributes.Where(a => !existing.ContainsKey(a.Id)).ToArray(); + var missing = declaredAttributes.Where(a => !existing.Contains(a.Id)).ToArray(); if (missing.Length == 0) { - // Nothing new to assert, so just add the new data to the registry - throw new NotImplementedException(); - //_store.Registry.Populate(existing.Values.ToArray()); + // No changes to make to the schema, we can return early + return; } - - var newAttrs = new List(); - - var attrId = existing.Values.Max(a => a.AttrEntityId).Value; + + var attrId = existing.Select(sym => AttributeCache.GetAttributeId(sym)).Max().Value; + using var builder = new IndexSegmentBuilder(AttributeCache); foreach (var attr in missing) { - var id = ++attrId; - - var uniqueId = attr.Id; - newAttrs.Add(new DbAttribute(uniqueId, AttributeId.From(id), attr.LowLevelType, attr)); + var id = EntityId.From(++attrId); + builder.Add(id, AttributeDefinition.UniqueId, attr.Id); + builder.Add(id, AttributeDefinition.ValueType, attr.LowLevelType); + if (attr.IsIndexed) + builder.Add(id, AttributeDefinition.Indexed, Null.Instance); + builder.Add(id, AttributeDefinition.Cardinality, attr.Cardinalty); + if (attr.NoHistory) + builder.Add(id, AttributeDefinition.NoHistory, Null.Instance); + if (attr.DeclaredOptional) + builder.Add(id, AttributeDefinition.Optional, Null.Instance); } - _store.RegisterAttributes(newAttrs); - } - - private IEnumerable ExistingAttributes() - { - var db = new Db(_store.GetSnapshot(), TxId, AttributeCache) - { - Connection = this - }; - - foreach (var attribute in AttributeDefinition.All(db)) - { - var declared = _declaredAttributes[attribute.UniqueId]; - yield return new DbAttribute(attribute.UniqueId, AttributeId.From((ushort)attribute.Id.Value), attribute.ValueType, declared); - } + var (_, db) = _store.Transact(builder.Build()); + AttributeCache.Reset(db); } internal async Task Transact(IndexSegment datoms, HashSet? txFunctions) @@ -203,7 +195,14 @@ private void Bootstrap() { try { - AddMissingAttributes(_declaredAttributes.Values); + var initialSnapshot = _store.GetSnapshot(); + var initialDb = new Db(initialSnapshot, TxId, AttributeCache) + { + Connection = this + }; + AttributeCache.Reset(initialDb); + + AddMissingAttributes(); _dbStreamDisposable = ProcessUpdate(_store.TxLog) .Subscribe(itm => _dbStream.OnNext(itm)); diff --git a/tests/NexusMods.MnemonicDB.Tests/AMnemonicDBTest.cs b/tests/NexusMods.MnemonicDB.Tests/AMnemonicDBTest.cs index 4ce4f8f1..9fcb727f 100644 --- a/tests/NexusMods.MnemonicDB.Tests/AMnemonicDBTest.cs +++ b/tests/NexusMods.MnemonicDB.Tests/AMnemonicDBTest.cs @@ -52,7 +52,7 @@ protected AMnemonicDBTest(IServiceProvider provider) new AttributesAnalyzer() ]; - Connection = new Connection(provider.GetRequiredService>(), _store, provider, _attributes, _analyzers); + Connection = new Connection(provider.GetRequiredService>(), _store, provider, _analyzers); Logger = provider.GetRequiredService>(); } @@ -202,7 +202,7 @@ protected async Task RestartDatomStore() AttributeCache = new AttributeCache(); _store = new DatomStore(Provider.GetRequiredService>(), AttributeCache, Config, _backend); - Connection = new Connection(Provider.GetRequiredService>(), _store, Provider, _attributes, _analyzers); + Connection = new Connection(Provider.GetRequiredService>(), _store, Provider, _analyzers); } } From a3369787a316e27bbc777dc2b0ed45aa2095c9eb Mon Sep 17 00:00:00 2001 From: halgari Date: Thu, 19 Sep 2024 16:04:35 -0600 Subject: [PATCH 7/9] Fix the remaining tests --- src/NexusMods.MnemonicDB/Connection.cs | 2 +- .../Storage/Abstractions/IStoreBackend.cs | 5 ++ .../Storage/DatomStore.cs | 21 ++++- .../Storage/InMemoryBackend/Backend.cs | 6 +- .../Storage/RocksDbBackend/Backend.cs | 12 ++- .../Storage/RocksDbBackend/Snapshot.cs | 6 +- ...sts_MyModelArrayTest.Generated.verified.cs | 3 +- ...erator_Tests_MyModel.Generated.verified.cs | 3 +- .../ABackendTest.cs | 2 +- .../AStorageTest.cs | 12 ++- .../BackendTests/InMemoryTests.cs | 2 +- .../BackendTests/RocksDB.cs | 2 +- .../AMnemonicDBTest.cs | 16 ++-- ...tCommitUpdates_update_datom_0.verified.txt | 6 +- ...tCommitUpdates_update_datom_1.verified.txt | 6 +- ...tCommitUpdates_update_datom_2.verified.txt | 6 +- ...tCommitUpdates_update_datom_3.verified.txt | 6 +- ...bTests.CanGetDatomsFromEntity.verified.txt | 6 +- ...EntitiesInDifferentPartitions.verified.txt | 24 +++--- ...bTests.CanUseTuple3Attributes.verified.txt | 54 ++++++------- ...Tests.CanWriteTupleAttributes.verified.txt | 6 +- ....DbIsImmutable_mutated data 0.verified.txt | 8 +- ....DbIsImmutable_mutated data 1.verified.txt | 8 +- ....DbIsImmutable_mutated data 2.verified.txt | 8 +- ...s.DbIsImmutable_original data.verified.txt | 8 +- ....DbIsImmutable_original data0.verified.txt | 8 +- ....DbIsImmutable_original data1.verified.txt | 8 +- ....DbIsImmutable_original data2.verified.txt | 8 +- ...desCanBeConstructedSeparately.verified.txt | 8 +- ...ipleIncludesDontSplitEntities.verified.txt | 8 +- .../DbTests.ReadDatomsForEntity.verified.txt | 80 +++++++++---------- ...me_mod data_72057594037927939.verified.txt | 6 +- ...me_mod data_72057594037927940.verified.txt | 6 +- ...me_mod data_72057594037927941.verified.txt | 6 +- ...me_mod data_72057594037927942.verified.txt | 6 +- ...aAttributes_archive file data.verified.txt | 12 +-- ...HaveExtraAttributes_file data.verified.txt | 12 +-- 37 files changed, 216 insertions(+), 190 deletions(-) diff --git a/src/NexusMods.MnemonicDB/Connection.cs b/src/NexusMods.MnemonicDB/Connection.cs index f79a92bf..e96556c6 100644 --- a/src/NexusMods.MnemonicDB/Connection.cs +++ b/src/NexusMods.MnemonicDB/Connection.cs @@ -162,7 +162,7 @@ private void AddMissingAttributes() var attrId = existing.Select(sym => AttributeCache.GetAttributeId(sym)).Max().Value; using var builder = new IndexSegmentBuilder(AttributeCache); - foreach (var attr in missing) + foreach (var attr in missing.OrderBy(e => e.Id.Id)) { var id = EntityId.From(++attrId); builder.Add(id, AttributeDefinition.UniqueId, attr.Id); diff --git a/src/NexusMods.MnemonicDB/Storage/Abstractions/IStoreBackend.cs b/src/NexusMods.MnemonicDB/Storage/Abstractions/IStoreBackend.cs index a88acfc2..93821067 100644 --- a/src/NexusMods.MnemonicDB/Storage/Abstractions/IStoreBackend.cs +++ b/src/NexusMods.MnemonicDB/Storage/Abstractions/IStoreBackend.cs @@ -9,6 +9,11 @@ namespace NexusMods.MnemonicDB.Storage.Abstractions; public interface IStoreBackend : IDisposable { + /// + /// Returns the attribute cache for this store, this cache should be shared across + /// the datom store, the connection, and the db instances + /// + public AttributeCache AttributeCache { get; } public IWriteBatch CreateBatch(); public void Init(AbsolutePath location); diff --git a/src/NexusMods.MnemonicDB/Storage/DatomStore.cs b/src/NexusMods.MnemonicDB/Storage/DatomStore.cs index 8a8b24b8..b7f06696 100644 --- a/src/NexusMods.MnemonicDB/Storage/DatomStore.cs +++ b/src/NexusMods.MnemonicDB/Storage/DatomStore.cs @@ -74,9 +74,9 @@ public class DatomStore : IDatomStore /// /// DI constructor /// - public DatomStore(ILogger logger, AttributeCache attributeCache, DatomStoreSettings settings, - IStoreBackend backend) + public DatomStore(ILogger logger, DatomStoreSettings settings, IStoreBackend backend) { + _attributeCache = backend.AttributeCache; _pendingTransactions = new BlockingCollection(new ConcurrentQueue()); _backend = backend; @@ -87,7 +87,6 @@ public DatomStore(ILogger logger, AttributeCache attributeCache, Dat _logger = logger; _settings = settings; - _attributeCache = attributeCache; _backend.DeclareEAVT(IndexType.EAVTCurrent); _backend.DeclareEAVT(IndexType.EAVTHistory); @@ -460,6 +459,22 @@ private void Remap(in KeyPrefix prefix, Span valueSpan) var newId = Remap(oldId); MemoryMarshal.Write(valueSpan, newId); break; + case ValueTags.Tuple2: + { + var tag1 = (ValueTags)valueSpan[0]; + var tag2 = (ValueTags)valueSpan[1]; + if (tag1 == ValueTags.Reference) + { + var entityId = MemoryMarshal.Read(valueSpan.SliceFast(2)); + var newEntityId = Remap(entityId); + MemoryMarshal.Write(valueSpan.SliceFast(2), newEntityId); + } + if (tag2 == ValueTags.Reference) + { + throw new NotSupportedException("This attribute does not support remapping of the second element."); + } + break; + } } } diff --git a/src/NexusMods.MnemonicDB/Storage/InMemoryBackend/Backend.cs b/src/NexusMods.MnemonicDB/Storage/InMemoryBackend/Backend.cs index fbf6cc7d..45973b2f 100644 --- a/src/NexusMods.MnemonicDB/Storage/InMemoryBackend/Backend.cs +++ b/src/NexusMods.MnemonicDB/Storage/InMemoryBackend/Backend.cs @@ -17,13 +17,15 @@ public class Backend : IStoreBackend private readonly AttributeCache _attributeCache; private readonly IndexStore[] _stores; - public Backend(AttributeCache attributeCache) + public Backend() { - _attributeCache = attributeCache; + _attributeCache = new AttributeCache(); _stores = new IndexStore[Enum.GetValues().Select(i => (int)i).Max() + 1]; _indexes = new IIndex[Enum.GetValues().Select(i => (int)i).Max() + 1]; } + public AttributeCache AttributeCache => _attributeCache; + public IWriteBatch CreateBatch() { return new Batch(_stores); diff --git a/src/NexusMods.MnemonicDB/Storage/RocksDbBackend/Backend.cs b/src/NexusMods.MnemonicDB/Storage/RocksDbBackend/Backend.cs index 1918cadf..ec752451 100644 --- a/src/NexusMods.MnemonicDB/Storage/RocksDbBackend/Backend.cs +++ b/src/NexusMods.MnemonicDB/Storage/RocksDbBackend/Backend.cs @@ -8,12 +8,20 @@ namespace NexusMods.MnemonicDB.Storage.RocksDbBackend; -public class Backend(AttributeCache attributeCache) : IStoreBackend +public class Backend : IStoreBackend { private readonly ColumnFamilies _columnFamilies = new(); private readonly Dictionary _indexes = new(); internal readonly Dictionary Stores = new(); internal RocksDb? Db = null!; + private readonly AttributeCache _attributeCache; + + public Backend() + { + _attributeCache = new AttributeCache(); + } + + public AttributeCache AttributeCache => _attributeCache; public IWriteBatch CreateBatch() { @@ -37,7 +45,7 @@ public IIndex GetIndex(IndexType name) public ISnapshot GetSnapshot() { - return new Snapshot(this, attributeCache); + return new Snapshot(this, _attributeCache); } public void Init(AbsolutePath location) diff --git a/src/NexusMods.MnemonicDB/Storage/RocksDbBackend/Snapshot.cs b/src/NexusMods.MnemonicDB/Storage/RocksDbBackend/Snapshot.cs index 5cffc67b..88f50ef3 100644 --- a/src/NexusMods.MnemonicDB/Storage/RocksDbBackend/Snapshot.cs +++ b/src/NexusMods.MnemonicDB/Storage/RocksDbBackend/Snapshot.cs @@ -8,7 +8,7 @@ namespace NexusMods.MnemonicDB.Storage.RocksDbBackend; -internal class Snapshot(Backend backend, AttributeCache registry) : ISnapshot +internal class Snapshot(Backend backend, AttributeCache attributeCache) : ISnapshot { private readonly RocksDbSharp.Snapshot _snapshot = backend.Db!.CreateSnapshot(); @@ -23,7 +23,7 @@ public IndexSegment Datoms(SliceDescriptor descriptor) .SetIterateLowerBound(from.ToArray()) .SetIterateUpperBound(to.ToArray()); - using var builder = new IndexSegmentBuilder(registry); + using var builder = new IndexSegmentBuilder(attributeCache); using var iterator = backend.Db!.NewIterator(backend.Stores[descriptor.Index].Handle, options); if (reverse) @@ -68,7 +68,7 @@ public IEnumerable DatomsChunked(SliceDescriptor descriptor, int c .SetIterateLowerBound(from.ToArray()) .SetIterateUpperBound(to.ToArray()); - using var builder = new IndexSegmentBuilder(registry); + using var builder = new IndexSegmentBuilder(attributeCache); using var iterator = backend.Db!.NewIterator(backend.Stores[descriptor.Index].Handle, options); if (reverse) diff --git a/tests/NexusMods.MnemonicDB.SourceGenerator.Tests/ArrayTest#NexusMods_MnemonicDB_SourceGenerator_Tests_MyModelArrayTest.Generated.verified.cs b/tests/NexusMods.MnemonicDB.SourceGenerator.Tests/ArrayTest#NexusMods_MnemonicDB_SourceGenerator_Tests_MyModelArrayTest.Generated.verified.cs index 3f0e1c35..99dc3f66 100644 --- a/tests/NexusMods.MnemonicDB.SourceGenerator.Tests/ArrayTest#NexusMods_MnemonicDB_SourceGenerator_Tests_MyModelArrayTest.Generated.verified.cs +++ b/tests/NexusMods.MnemonicDB.SourceGenerator.Tests/ArrayTest#NexusMods_MnemonicDB_SourceGenerator_Tests_MyModelArrayTest.Generated.verified.cs @@ -223,9 +223,10 @@ public static ReadOnly Create(__ABSTRACTIONS__.IDb db, __ABSTRACTIONS__.EntityId /// public IEnumerator GetEnumerator() { + var resolver = Db.Connection.AttributeResolver; for (var i = 0; i < IndexSegment.Count; i++) { - yield return IndexSegment[i].Resolved; + yield return resolver.Resolve(IndexSegment[i]); } } diff --git a/tests/NexusMods.MnemonicDB.SourceGenerator.Tests/BasicTest#NexusMods_MnemonicDB_SourceGenerator_Tests_MyModel.Generated.verified.cs b/tests/NexusMods.MnemonicDB.SourceGenerator.Tests/BasicTest#NexusMods_MnemonicDB_SourceGenerator_Tests_MyModel.Generated.verified.cs index d7c679ee..057e391b 100644 --- a/tests/NexusMods.MnemonicDB.SourceGenerator.Tests/BasicTest#NexusMods_MnemonicDB_SourceGenerator_Tests_MyModel.Generated.verified.cs +++ b/tests/NexusMods.MnemonicDB.SourceGenerator.Tests/BasicTest#NexusMods_MnemonicDB_SourceGenerator_Tests_MyModel.Generated.verified.cs @@ -223,9 +223,10 @@ public static ReadOnly Create(__ABSTRACTIONS__.IDb db, __ABSTRACTIONS__.EntityId /// public IEnumerator GetEnumerator() { + var resolver = Db.Connection.AttributeResolver; for (var i = 0; i < IndexSegment.Count; i++) { - yield return IndexSegment[i].Resolved; + yield return resolver.Resolve(IndexSegment[i]); } } diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/ABackendTest.cs b/tests/NexusMods.MnemonicDB.Storage.Tests/ABackendTest.cs index 1bdd29ef..abf8bb9a 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/ABackendTest.cs +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/ABackendTest.cs @@ -17,7 +17,7 @@ namespace NexusMods.MnemonicDB.Storage.Tests; public abstract class ABackendTest( IServiceProvider provider, - Func backendFn) + Func backendFn) : AStorageTest(provider, backendFn) where TStoreType : IStoreBackend { diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/AStorageTest.cs b/tests/NexusMods.MnemonicDB.Storage.Tests/AStorageTest.cs index ad1147a4..fd80224a 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/AStorageTest.cs +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/AStorageTest.cs @@ -19,17 +19,16 @@ public abstract class AStorageTest : IDisposable private readonly AbsolutePath _path; private readonly IServiceProvider _provider; protected readonly DatomStoreSettings DatomStoreSettings; - protected readonly AttributeCache AttributeCache; + protected AttributeCache AttributeCache => DatomStore.AttributeCache; protected readonly ILogger Logger; private ulong _tempId = 1; protected IDatomStore DatomStore; - protected AStorageTest(IServiceProvider provider, Func? backendFn = null) + protected AStorageTest(IServiceProvider provider, Func? backendFn = null) { _provider = provider; - AttributeCache = new AttributeCache(); _path = FileSystem.Shared.GetKnownPath(KnownPath.EntryDirectory).Combine("tests_datomstore" + Guid.NewGuid()); @@ -38,11 +37,10 @@ protected AStorageTest(IServiceProvider provider, Func new Backend(registry); + backendFn ??= () => new Backend(); - DatomStore = new DatomStore(provider.GetRequiredService>(), AttributeCache, DatomStoreSettings, - backendFn(AttributeCache)); + DatomStore = new DatomStore(provider.GetRequiredService>(), DatomStoreSettings, backendFn()); Logger = provider.GetRequiredService>(); @@ -59,7 +57,7 @@ protected AStorageTest(IServiceProvider provider, Func(provider, registry => new Backend(registry)) { } + : ABackendTest(provider, () => new Backend()); diff --git a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTests/RocksDB.cs b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTests/RocksDB.cs index 7973d2dc..b6d095a4 100644 --- a/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTests/RocksDB.cs +++ b/tests/NexusMods.MnemonicDB.Storage.Tests/BackendTests/RocksDB.cs @@ -2,4 +2,4 @@ namespace NexusMods.MnemonicDB.Storage.Tests.BackendTests; -public class RocksDB(IServiceProvider provider) : ABackendTest(provider, registry => new Backend(registry)) { } +public class RocksDB(IServiceProvider provider) : ABackendTest(provider, () => new Backend()) { } diff --git a/tests/NexusMods.MnemonicDB.Tests/AMnemonicDBTest.cs b/tests/NexusMods.MnemonicDB.Tests/AMnemonicDBTest.cs index 9fcb727f..3c61a76b 100644 --- a/tests/NexusMods.MnemonicDB.Tests/AMnemonicDBTest.cs +++ b/tests/NexusMods.MnemonicDB.Tests/AMnemonicDBTest.cs @@ -21,7 +21,7 @@ public class AMnemonicDBTest : IDisposable { private readonly IAttribute[] _attributes; protected readonly IServiceProvider Provider; - protected AttributeCache AttributeCache; + protected AttributeCache AttributeCache => _store.AttributeCache; private Backend _backend; private DatomStore _store; @@ -35,16 +35,14 @@ protected AMnemonicDBTest(IServiceProvider provider) Provider = provider; _attributes = provider.GetRequiredService>().ToArray(); - AttributeCache = new AttributeCache(); - Config = new DatomStoreSettings { Path = FileSystem.Shared.GetKnownPath(KnownPath.EntryDirectory) .Combine("tests_MnemonicDB" + Guid.NewGuid()) }; - _backend = new Backend(AttributeCache); + _backend = new Backend(); - _store = new DatomStore(provider.GetRequiredService>(), AttributeCache, Config, _backend); + _store = new DatomStore(provider.GetRequiredService>(), Config, _backend); _analyzers = [ @@ -97,13 +95,12 @@ string TruncateOrPad(string val, int length) var isRetract = datom.IsRetract; var symColumn = TruncateOrPad(datom.A.Id.Name, 24); - var attrId = cache.GetAttributeId(datom.A.Id).Value.ToString("X4"); sb.Append(isRetract ? "-" : "+"); sb.Append(" | "); sb.Append(datom.E.Value.ToString("X16")); sb.Append(" | "); - sb.Append($"({attrId}) {symColumn}"); + sb.Append(symColumn); sb.Append(" | "); @@ -198,9 +195,8 @@ protected async Task RestartDatomStore() GC.Collect(); - _backend = new Backend(AttributeCache); - AttributeCache = new AttributeCache(); - _store = new DatomStore(Provider.GetRequiredService>(), AttributeCache, Config, _backend); + _backend = new Backend(); + _store = new DatomStore(Provider.GetRequiredService>(), Config, _backend); Connection = new Connection(Provider.GetRequiredService>(), _store, Provider, _analyzers); } diff --git a/tests/NexusMods.MnemonicDB.Tests/DbTests.CanGetCommitUpdates_update_datom_0.verified.txt b/tests/NexusMods.MnemonicDB.Tests/DbTests.CanGetCommitUpdates_update_datom_0.verified.txt index 1a07f7e0..d6963f4b 100644 --- a/tests/NexusMods.MnemonicDB.Tests/DbTests.CanGetCommitUpdates_update_datom_0.verified.txt +++ b/tests/NexusMods.MnemonicDB.Tests/DbTests.CanGetCommitUpdates_update_datom_0.verified.txt @@ -1,3 +1,3 @@ -+ | 0100000000000004 | (0008) Timestamp | DateTime : 0 | 0100000000000004 -- | 0200000000000001 | (000A) Hash | 0x00000000DEADBEEF | 0100000000000004 -+ | 0200000000000001 | (000A) Hash | 0x00000000DEADBFDD | 0100000000000004 ++ | 0100000000000004 | Timestamp | DateTime : 0 | 0100000000000004 +- | 0200000000000001 | Hash | 0x00000000DEADBEEF | 0100000000000004 ++ | 0200000000000001 | Hash | 0x00000000DEADBFDD | 0100000000000004 diff --git a/tests/NexusMods.MnemonicDB.Tests/DbTests.CanGetCommitUpdates_update_datom_1.verified.txt b/tests/NexusMods.MnemonicDB.Tests/DbTests.CanGetCommitUpdates_update_datom_1.verified.txt index a4e319b4..07f6c276 100644 --- a/tests/NexusMods.MnemonicDB.Tests/DbTests.CanGetCommitUpdates_update_datom_1.verified.txt +++ b/tests/NexusMods.MnemonicDB.Tests/DbTests.CanGetCommitUpdates_update_datom_1.verified.txt @@ -1,3 +1,3 @@ -+ | 0100000000000005 | (0008) Timestamp | DateTime : 0 | 0100000000000005 -- | 0200000000000001 | (000A) Hash | 0x00000000DEADBFDD | 0100000000000005 -+ | 0200000000000001 | (000A) Hash | 0x00000000DEADBFDE | 0100000000000005 ++ | 0100000000000005 | Timestamp | DateTime : 0 | 0100000000000005 +- | 0200000000000001 | Hash | 0x00000000DEADBFDD | 0100000000000005 ++ | 0200000000000001 | Hash | 0x00000000DEADBFDE | 0100000000000005 diff --git a/tests/NexusMods.MnemonicDB.Tests/DbTests.CanGetCommitUpdates_update_datom_2.verified.txt b/tests/NexusMods.MnemonicDB.Tests/DbTests.CanGetCommitUpdates_update_datom_2.verified.txt index aa2f4f7a..4b218f2d 100644 --- a/tests/NexusMods.MnemonicDB.Tests/DbTests.CanGetCommitUpdates_update_datom_2.verified.txt +++ b/tests/NexusMods.MnemonicDB.Tests/DbTests.CanGetCommitUpdates_update_datom_2.verified.txt @@ -1,3 +1,3 @@ -+ | 0100000000000006 | (0008) Timestamp | DateTime : 0 | 0100000000000006 -- | 0200000000000001 | (000A) Hash | 0x00000000DEADBFDE | 0100000000000006 -+ | 0200000000000001 | (000A) Hash | 0x00000000DEADBFDF | 0100000000000006 ++ | 0100000000000006 | Timestamp | DateTime : 0 | 0100000000000006 +- | 0200000000000001 | Hash | 0x00000000DEADBFDE | 0100000000000006 ++ | 0200000000000001 | Hash | 0x00000000DEADBFDF | 0100000000000006 diff --git a/tests/NexusMods.MnemonicDB.Tests/DbTests.CanGetCommitUpdates_update_datom_3.verified.txt b/tests/NexusMods.MnemonicDB.Tests/DbTests.CanGetCommitUpdates_update_datom_3.verified.txt index 288711b4..b374cfe4 100644 --- a/tests/NexusMods.MnemonicDB.Tests/DbTests.CanGetCommitUpdates_update_datom_3.verified.txt +++ b/tests/NexusMods.MnemonicDB.Tests/DbTests.CanGetCommitUpdates_update_datom_3.verified.txt @@ -1,3 +1,3 @@ -+ | 0100000000000007 | (0008) Timestamp | DateTime : 0 | 0100000000000007 -- | 0200000000000001 | (000A) Hash | 0x00000000DEADBFDF | 0100000000000007 -+ | 0200000000000001 | (000A) Hash | 0x00000000DEADBFE0 | 0100000000000007 ++ | 0100000000000007 | Timestamp | DateTime : 0 | 0100000000000007 +- | 0200000000000001 | Hash | 0x00000000DEADBFDF | 0100000000000007 ++ | 0200000000000001 | Hash | 0x00000000DEADBFE0 | 0100000000000007 diff --git a/tests/NexusMods.MnemonicDB.Tests/DbTests.CanGetDatomsFromEntity.verified.txt b/tests/NexusMods.MnemonicDB.Tests/DbTests.CanGetDatomsFromEntity.verified.txt index 285946ec..27212eb7 100644 --- a/tests/NexusMods.MnemonicDB.Tests/DbTests.CanGetDatomsFromEntity.verified.txt +++ b/tests/NexusMods.MnemonicDB.Tests/DbTests.CanGetDatomsFromEntity.verified.txt @@ -1,3 +1,3 @@ -+ | 0200000000000002 | (0011) Name | Mod1 - Updated | 0100000000000004 -+ | 0200000000000002 | (0012) Source | http://somesite.com/Mod1 | 0100000000000003 -+ | 0200000000000002 | (0013) Loadout | 0200000000000001 | 0100000000000003 ++ | 0200000000000002 | Loadout | 0200000000000001 | 0100000000000003 ++ | 0200000000000002 | Name | Mod1 - Updated | 0100000000000004 ++ | 0200000000000002 | Source | http://somesite.com/Mod1 | 0100000000000003 diff --git a/tests/NexusMods.MnemonicDB.Tests/DbTests.CanPutEntitiesInDifferentPartitions.verified.txt b/tests/NexusMods.MnemonicDB.Tests/DbTests.CanPutEntitiesInDifferentPartitions.verified.txt index 5ff2ab38..ada47417 100644 --- a/tests/NexusMods.MnemonicDB.Tests/DbTests.CanPutEntitiesInDifferentPartitions.verified.txt +++ b/tests/NexusMods.MnemonicDB.Tests/DbTests.CanPutEntitiesInDifferentPartitions.verified.txt @@ -1,12 +1,12 @@ -+ | 0200000000000001 | (0009) Path | C:\test1.txt | 0100000000000003 -+ | 0200000000000001 | (000A) Hash | 0x00000000DEADBEEF | 0100000000000003 -+ | 0200000000000001 | (000B) Size | 1 B | 0100000000000003 -+ | 0200000000000001 | (000C) Mod | 0000000000000001 | 0100000000000003 -+ | 0A00000000000001 | (0009) Path | C:\test2.txt | 0100000000000003 -+ | 0A00000000000001 | (000A) Hash | 0x00000000DEADBEEF | 0100000000000003 -+ | 0A00000000000001 | (000B) Size | 1 B | 0100000000000003 -+ | 0A00000000000001 | (000C) Mod | 0000000000000001 | 0100000000000003 -+ | C800000000000001 | (0009) Path | C:\test3.txt | 0100000000000003 -+ | C800000000000001 | (000A) Hash | 0x00000000DEADBEEF | 0100000000000003 -+ | C800000000000001 | (000B) Size | 1 B | 0100000000000003 -+ | C800000000000001 | (000C) Mod | 0000000000000001 | 0100000000000003 ++ | 0200000000000001 | Hash | 0x00000000DEADBEEF | 0100000000000003 ++ | 0200000000000001 | Mod | 0000000000000001 | 0100000000000003 ++ | 0200000000000001 | Path | C:\test1.txt | 0100000000000003 ++ | 0200000000000001 | Size | 1 B | 0100000000000003 ++ | 0A00000000000001 | Hash | 0x00000000DEADBEEF | 0100000000000003 ++ | 0A00000000000001 | Mod | 0000000000000001 | 0100000000000003 ++ | 0A00000000000001 | Path | C:\test2.txt | 0100000000000003 ++ | 0A00000000000001 | Size | 1 B | 0100000000000003 ++ | C800000000000001 | Hash | 0x00000000DEADBEEF | 0100000000000003 ++ | C800000000000001 | Mod | 0000000000000001 | 0100000000000003 ++ | C800000000000001 | Path | C:\test3.txt | 0100000000000003 ++ | C800000000000001 | Size | 1 B | 0100000000000003 diff --git a/tests/NexusMods.MnemonicDB.Tests/DbTests.CanUseTuple3Attributes.verified.txt b/tests/NexusMods.MnemonicDB.Tests/DbTests.CanUseTuple3Attributes.verified.txt index 3a91ab8b..94dd6f18 100644 --- a/tests/NexusMods.MnemonicDB.Tests/DbTests.CanUseTuple3Attributes.verified.txt +++ b/tests/NexusMods.MnemonicDB.Tests/DbTests.CanUseTuple3Attributes.verified.txt @@ -1,27 +1,27 @@ -+ | 0200000000000001 | (000E) TupleTest | (1, 1, 1) | 0100000000000003 -+ | 0200000000000002 | (000E) TupleTest | (1, 1, 2) | 0100000000000003 -+ | 0200000000000003 | (000E) TupleTest | (1, 1, 3) | 0100000000000003 -+ | 0200000000000004 | (000E) TupleTest | (1, 2, 1) | 0100000000000003 -+ | 0200000000000005 | (000E) TupleTest | (1, 2, 2) | 0100000000000003 -+ | 0200000000000006 | (000E) TupleTest | (1, 2, 3) | 0100000000000003 -+ | 0200000000000007 | (000E) TupleTest | (1, 3, 1) | 0100000000000003 -+ | 0200000000000008 | (000E) TupleTest | (1, 3, 2) | 0100000000000003 -+ | 0200000000000009 | (000E) TupleTest | (1, 3, 3) | 0100000000000003 -+ | 020000000000000A | (000E) TupleTest | (2, 1, 1) | 0100000000000003 -+ | 020000000000000B | (000E) TupleTest | (2, 1, 2) | 0100000000000003 -+ | 020000000000000C | (000E) TupleTest | (2, 1, 3) | 0100000000000003 -+ | 020000000000000D | (000E) TupleTest | (2, 2, 1) | 0100000000000003 -+ | 020000000000000E | (000E) TupleTest | (2, 2, 2) | 0100000000000003 -+ | 020000000000000F | (000E) TupleTest | (2, 2, 3) | 0100000000000003 -+ | 0200000000000010 | (000E) TupleTest | (2, 3, 1) | 0100000000000003 -+ | 0200000000000011 | (000E) TupleTest | (2, 3, 2) | 0100000000000003 -+ | 0200000000000012 | (000E) TupleTest | (2, 3, 3) | 0100000000000003 -+ | 0200000000000013 | (000E) TupleTest | (3, 1, 1) | 0100000000000003 -+ | 0200000000000014 | (000E) TupleTest | (3, 1, 2) | 0100000000000003 -+ | 0200000000000015 | (000E) TupleTest | (3, 1, 3) | 0100000000000003 -+ | 0200000000000016 | (000E) TupleTest | (3, 2, 1) | 0100000000000003 -+ | 0200000000000017 | (000E) TupleTest | (3, 2, 2) | 0100000000000003 -+ | 0200000000000018 | (000E) TupleTest | (3, 2, 3) | 0100000000000003 -+ | 0200000000000019 | (000E) TupleTest | (3, 3, 1) | 0100000000000003 -+ | 020000000000001A | (000E) TupleTest | (3, 3, 2) | 0100000000000003 -+ | 020000000000001B | (000E) TupleTest | (3, 3, 3) | 0100000000000003 ++ | 0200000000000001 | TupleTest | (1, 1, 1) | 0100000000000003 ++ | 0200000000000002 | TupleTest | (1, 1, 2) | 0100000000000003 ++ | 0200000000000003 | TupleTest | (1, 1, 3) | 0100000000000003 ++ | 0200000000000004 | TupleTest | (1, 2, 1) | 0100000000000003 ++ | 0200000000000005 | TupleTest | (1, 2, 2) | 0100000000000003 ++ | 0200000000000006 | TupleTest | (1, 2, 3) | 0100000000000003 ++ | 0200000000000007 | TupleTest | (1, 3, 1) | 0100000000000003 ++ | 0200000000000008 | TupleTest | (1, 3, 2) | 0100000000000003 ++ | 0200000000000009 | TupleTest | (1, 3, 3) | 0100000000000003 ++ | 020000000000000A | TupleTest | (2, 1, 1) | 0100000000000003 ++ | 020000000000000B | TupleTest | (2, 1, 2) | 0100000000000003 ++ | 020000000000000C | TupleTest | (2, 1, 3) | 0100000000000003 ++ | 020000000000000D | TupleTest | (2, 2, 1) | 0100000000000003 ++ | 020000000000000E | TupleTest | (2, 2, 2) | 0100000000000003 ++ | 020000000000000F | TupleTest | (2, 2, 3) | 0100000000000003 ++ | 0200000000000010 | TupleTest | (2, 3, 1) | 0100000000000003 ++ | 0200000000000011 | TupleTest | (2, 3, 2) | 0100000000000003 ++ | 0200000000000012 | TupleTest | (2, 3, 3) | 0100000000000003 ++ | 0200000000000013 | TupleTest | (3, 1, 1) | 0100000000000003 ++ | 0200000000000014 | TupleTest | (3, 1, 2) | 0100000000000003 ++ | 0200000000000015 | TupleTest | (3, 1, 3) | 0100000000000003 ++ | 0200000000000016 | TupleTest | (3, 2, 1) | 0100000000000003 ++ | 0200000000000017 | TupleTest | (3, 2, 2) | 0100000000000003 ++ | 0200000000000018 | TupleTest | (3, 2, 3) | 0100000000000003 ++ | 0200000000000019 | TupleTest | (3, 3, 1) | 0100000000000003 ++ | 020000000000001A | TupleTest | (3, 3, 2) | 0100000000000003 ++ | 020000000000001B | TupleTest | (3, 3, 3) | 0100000000000003 diff --git a/tests/NexusMods.MnemonicDB.Tests/DbTests.CanWriteTupleAttributes.verified.txt b/tests/NexusMods.MnemonicDB.Tests/DbTests.CanWriteTupleAttributes.verified.txt index 7e15bb1e..763df8fe 100644 --- a/tests/NexusMods.MnemonicDB.Tests/DbTests.CanWriteTupleAttributes.verified.txt +++ b/tests/NexusMods.MnemonicDB.Tests/DbTests.CanWriteTupleAttributes.verified.txt @@ -1,3 +1,3 @@ -+ | 0200000000000005 | (000D) TuplePath | (EId:1, 3) | 0100000000000003 -+ | 0200000000000003 | (000D) TuplePath | (EId:200000000000001, 1) | 0100000000000003 -+ | 0200000000000004 | (000D) TuplePath | (EId:200000000000001, 2) | 0100000000000003 ++ | 0200000000000005 | TuplePath | (EId:1, 3) | 0100000000000003 ++ | 0200000000000003 | TuplePath | (EId:200000000000001, 1) | 0100000000000003 ++ | 0200000000000004 | TuplePath | (EId:200000000000001, 2) | 0100000000000003 diff --git a/tests/NexusMods.MnemonicDB.Tests/DbTests.DbIsImmutable_mutated data 0.verified.txt b/tests/NexusMods.MnemonicDB.Tests/DbTests.DbIsImmutable_mutated data 0.verified.txt index 11d438cc..9d1c45a9 100644 --- a/tests/NexusMods.MnemonicDB.Tests/DbTests.DbIsImmutable_mutated data 0.verified.txt +++ b/tests/NexusMods.MnemonicDB.Tests/DbTests.DbIsImmutable_mutated data 0.verified.txt @@ -1,4 +1,4 @@ -+ | 0200000000000001 | (0009) Path | C:\test_0.txt_mutate | 0100000000000004 -+ | 0200000000000001 | (000A) Hash | 0x00000000DEADBEF0 | 0100000000000003 -+ | 0200000000000001 | (000B) Size | 1 B | 0100000000000003 -+ | 0200000000000001 | (000C) Mod | 0000000000000001 | 0100000000000003 ++ | 0200000000000001 | Hash | 0x00000000DEADBEF0 | 0100000000000003 ++ | 0200000000000001 | Mod | 0000000000000001 | 0100000000000003 ++ | 0200000000000001 | Path | C:\test_0.txt_mutate | 0100000000000004 ++ | 0200000000000001 | Size | 1 B | 0100000000000003 diff --git a/tests/NexusMods.MnemonicDB.Tests/DbTests.DbIsImmutable_mutated data 1.verified.txt b/tests/NexusMods.MnemonicDB.Tests/DbTests.DbIsImmutable_mutated data 1.verified.txt index a7cba7c5..49c48fc9 100644 --- a/tests/NexusMods.MnemonicDB.Tests/DbTests.DbIsImmutable_mutated data 1.verified.txt +++ b/tests/NexusMods.MnemonicDB.Tests/DbTests.DbIsImmutable_mutated data 1.verified.txt @@ -1,4 +1,4 @@ -+ | 0200000000000001 | (0009) Path | C:\test_1.txt_mutate | 0100000000000005 -+ | 0200000000000001 | (000A) Hash | 0x00000000DEADBEF0 | 0100000000000003 -+ | 0200000000000001 | (000B) Size | 1 B | 0100000000000003 -+ | 0200000000000001 | (000C) Mod | 0000000000000001 | 0100000000000003 ++ | 0200000000000001 | Hash | 0x00000000DEADBEF0 | 0100000000000003 ++ | 0200000000000001 | Mod | 0000000000000001 | 0100000000000003 ++ | 0200000000000001 | Path | C:\test_1.txt_mutate | 0100000000000005 ++ | 0200000000000001 | Size | 1 B | 0100000000000003 diff --git a/tests/NexusMods.MnemonicDB.Tests/DbTests.DbIsImmutable_mutated data 2.verified.txt b/tests/NexusMods.MnemonicDB.Tests/DbTests.DbIsImmutable_mutated data 2.verified.txt index f1004587..a9c9812b 100644 --- a/tests/NexusMods.MnemonicDB.Tests/DbTests.DbIsImmutable_mutated data 2.verified.txt +++ b/tests/NexusMods.MnemonicDB.Tests/DbTests.DbIsImmutable_mutated data 2.verified.txt @@ -1,4 +1,4 @@ -+ | 0200000000000001 | (0009) Path | C:\test_2.txt_mutate | 0100000000000006 -+ | 0200000000000001 | (000A) Hash | 0x00000000DEADBEF0 | 0100000000000003 -+ | 0200000000000001 | (000B) Size | 1 B | 0100000000000003 -+ | 0200000000000001 | (000C) Mod | 0000000000000001 | 0100000000000003 ++ | 0200000000000001 | Hash | 0x00000000DEADBEF0 | 0100000000000003 ++ | 0200000000000001 | Mod | 0000000000000001 | 0100000000000003 ++ | 0200000000000001 | Path | C:\test_2.txt_mutate | 0100000000000006 ++ | 0200000000000001 | Size | 1 B | 0100000000000003 diff --git a/tests/NexusMods.MnemonicDB.Tests/DbTests.DbIsImmutable_original data.verified.txt b/tests/NexusMods.MnemonicDB.Tests/DbTests.DbIsImmutable_original data.verified.txt index d7584076..ffcc0dec 100644 --- a/tests/NexusMods.MnemonicDB.Tests/DbTests.DbIsImmutable_original data.verified.txt +++ b/tests/NexusMods.MnemonicDB.Tests/DbTests.DbIsImmutable_original data.verified.txt @@ -1,4 +1,4 @@ -+ | 0200000000000001 | (0009) Path | C:\test.txt | 0100000000000003 -+ | 0200000000000001 | (000A) Hash | 0x00000000DEADBEF0 | 0100000000000003 -+ | 0200000000000001 | (000B) Size | 1 B | 0100000000000003 -+ | 0200000000000001 | (000C) Mod | 0000000000000001 | 0100000000000003 ++ | 0200000000000001 | Hash | 0x00000000DEADBEF0 | 0100000000000003 ++ | 0200000000000001 | Mod | 0000000000000001 | 0100000000000003 ++ | 0200000000000001 | Path | C:\test.txt | 0100000000000003 ++ | 0200000000000001 | Size | 1 B | 0100000000000003 diff --git a/tests/NexusMods.MnemonicDB.Tests/DbTests.DbIsImmutable_original data0.verified.txt b/tests/NexusMods.MnemonicDB.Tests/DbTests.DbIsImmutable_original data0.verified.txt index d7584076..ffcc0dec 100644 --- a/tests/NexusMods.MnemonicDB.Tests/DbTests.DbIsImmutable_original data0.verified.txt +++ b/tests/NexusMods.MnemonicDB.Tests/DbTests.DbIsImmutable_original data0.verified.txt @@ -1,4 +1,4 @@ -+ | 0200000000000001 | (0009) Path | C:\test.txt | 0100000000000003 -+ | 0200000000000001 | (000A) Hash | 0x00000000DEADBEF0 | 0100000000000003 -+ | 0200000000000001 | (000B) Size | 1 B | 0100000000000003 -+ | 0200000000000001 | (000C) Mod | 0000000000000001 | 0100000000000003 ++ | 0200000000000001 | Hash | 0x00000000DEADBEF0 | 0100000000000003 ++ | 0200000000000001 | Mod | 0000000000000001 | 0100000000000003 ++ | 0200000000000001 | Path | C:\test.txt | 0100000000000003 ++ | 0200000000000001 | Size | 1 B | 0100000000000003 diff --git a/tests/NexusMods.MnemonicDB.Tests/DbTests.DbIsImmutable_original data1.verified.txt b/tests/NexusMods.MnemonicDB.Tests/DbTests.DbIsImmutable_original data1.verified.txt index d7584076..ffcc0dec 100644 --- a/tests/NexusMods.MnemonicDB.Tests/DbTests.DbIsImmutable_original data1.verified.txt +++ b/tests/NexusMods.MnemonicDB.Tests/DbTests.DbIsImmutable_original data1.verified.txt @@ -1,4 +1,4 @@ -+ | 0200000000000001 | (0009) Path | C:\test.txt | 0100000000000003 -+ | 0200000000000001 | (000A) Hash | 0x00000000DEADBEF0 | 0100000000000003 -+ | 0200000000000001 | (000B) Size | 1 B | 0100000000000003 -+ | 0200000000000001 | (000C) Mod | 0000000000000001 | 0100000000000003 ++ | 0200000000000001 | Hash | 0x00000000DEADBEF0 | 0100000000000003 ++ | 0200000000000001 | Mod | 0000000000000001 | 0100000000000003 ++ | 0200000000000001 | Path | C:\test.txt | 0100000000000003 ++ | 0200000000000001 | Size | 1 B | 0100000000000003 diff --git a/tests/NexusMods.MnemonicDB.Tests/DbTests.DbIsImmutable_original data2.verified.txt b/tests/NexusMods.MnemonicDB.Tests/DbTests.DbIsImmutable_original data2.verified.txt index d7584076..ffcc0dec 100644 --- a/tests/NexusMods.MnemonicDB.Tests/DbTests.DbIsImmutable_original data2.verified.txt +++ b/tests/NexusMods.MnemonicDB.Tests/DbTests.DbIsImmutable_original data2.verified.txt @@ -1,4 +1,4 @@ -+ | 0200000000000001 | (0009) Path | C:\test.txt | 0100000000000003 -+ | 0200000000000001 | (000A) Hash | 0x00000000DEADBEF0 | 0100000000000003 -+ | 0200000000000001 | (000B) Size | 1 B | 0100000000000003 -+ | 0200000000000001 | (000C) Mod | 0000000000000001 | 0100000000000003 ++ | 0200000000000001 | Hash | 0x00000000DEADBEF0 | 0100000000000003 ++ | 0200000000000001 | Mod | 0000000000000001 | 0100000000000003 ++ | 0200000000000001 | Path | C:\test.txt | 0100000000000003 ++ | 0200000000000001 | Size | 1 B | 0100000000000003 diff --git a/tests/NexusMods.MnemonicDB.Tests/DbTests.MultipleIncludesCanBeConstructedSeparately.verified.txt b/tests/NexusMods.MnemonicDB.Tests/DbTests.MultipleIncludesCanBeConstructedSeparately.verified.txt index 85ce3fbf..0b21ccfa 100644 --- a/tests/NexusMods.MnemonicDB.Tests/DbTests.MultipleIncludesCanBeConstructedSeparately.verified.txt +++ b/tests/NexusMods.MnemonicDB.Tests/DbTests.MultipleIncludesCanBeConstructedSeparately.verified.txt @@ -1,4 +1,4 @@ -+ | 0100000000000003 | (0008) Timestamp | DateTime : 0 | 0100000000000003 -+ | 0200000000000001 | (001E) Name | Parent A | 0100000000000003 -+ | 0200000000000001 | (001F) Name | Parent B | 0100000000000003 -+ | 0200000000000001 | (0020) Name | Test Child | 0100000000000003 ++ | 0100000000000003 | Timestamp | DateTime : 0 | 0100000000000003 ++ | 0200000000000001 | Name | Test Child | 0100000000000003 ++ | 0200000000000001 | Name | Parent A | 0100000000000003 ++ | 0200000000000001 | Name | Parent B | 0100000000000003 diff --git a/tests/NexusMods.MnemonicDB.Tests/DbTests.MultipleIncludesDontSplitEntities.verified.txt b/tests/NexusMods.MnemonicDB.Tests/DbTests.MultipleIncludesDontSplitEntities.verified.txt index 85ce3fbf..0b21ccfa 100644 --- a/tests/NexusMods.MnemonicDB.Tests/DbTests.MultipleIncludesDontSplitEntities.verified.txt +++ b/tests/NexusMods.MnemonicDB.Tests/DbTests.MultipleIncludesDontSplitEntities.verified.txt @@ -1,4 +1,4 @@ -+ | 0100000000000003 | (0008) Timestamp | DateTime : 0 | 0100000000000003 -+ | 0200000000000001 | (001E) Name | Parent A | 0100000000000003 -+ | 0200000000000001 | (001F) Name | Parent B | 0100000000000003 -+ | 0200000000000001 | (0020) Name | Test Child | 0100000000000003 ++ | 0100000000000003 | Timestamp | DateTime : 0 | 0100000000000003 ++ | 0200000000000001 | Name | Test Child | 0100000000000003 ++ | 0200000000000001 | Name | Parent A | 0100000000000003 ++ | 0200000000000001 | Name | Parent B | 0100000000000003 diff --git a/tests/NexusMods.MnemonicDB.Tests/DbTests.ReadDatomsForEntity.verified.txt b/tests/NexusMods.MnemonicDB.Tests/DbTests.ReadDatomsForEntity.verified.txt index 62312b6e..252a8302 100644 --- a/tests/NexusMods.MnemonicDB.Tests/DbTests.ReadDatomsForEntity.verified.txt +++ b/tests/NexusMods.MnemonicDB.Tests/DbTests.ReadDatomsForEntity.verified.txt @@ -1,40 +1,40 @@ -+ | 0200000000000001 | (0009) Path | C:\test_0.txt | 0100000000000003 -+ | 0200000000000001 | (000A) Hash | 0x00000000DEADBEEF | 0100000000000003 -+ | 0200000000000001 | (000B) Size | 0 B | 0100000000000003 -+ | 0200000000000001 | (000C) Mod | 0000000000000001 | 0100000000000003 -+ | 0200000000000002 | (0009) Path | C:\test_1.txt | 0100000000000003 -+ | 0200000000000002 | (000A) Hash | 0x00000000DEADBEF0 | 0100000000000003 -+ | 0200000000000002 | (000B) Size | 1 B | 0100000000000003 -+ | 0200000000000002 | (000C) Mod | 0000000000000001 | 0100000000000003 -+ | 0200000000000003 | (0009) Path | C:\test_2.txt | 0100000000000003 -+ | 0200000000000003 | (000A) Hash | 0x00000000DEADBEF1 | 0100000000000003 -+ | 0200000000000003 | (000B) Size | 2 B | 0100000000000003 -+ | 0200000000000003 | (000C) Mod | 0000000000000001 | 0100000000000003 -+ | 0200000000000004 | (0009) Path | C:\test_3.txt | 0100000000000003 -+ | 0200000000000004 | (000A) Hash | 0x00000000DEADBEF2 | 0100000000000003 -+ | 0200000000000004 | (000B) Size | 3 B | 0100000000000003 -+ | 0200000000000004 | (000C) Mod | 0000000000000001 | 0100000000000003 -+ | 0200000000000005 | (0009) Path | C:\test_4.txt | 0100000000000003 -+ | 0200000000000005 | (000A) Hash | 0x00000000DEADBEF3 | 0100000000000003 -+ | 0200000000000005 | (000B) Size | 4 B | 0100000000000003 -+ | 0200000000000005 | (000C) Mod | 0000000000000001 | 0100000000000003 -+ | 0200000000000006 | (0009) Path | C:\test_5.txt | 0100000000000003 -+ | 0200000000000006 | (000A) Hash | 0x00000000DEADBEF4 | 0100000000000003 -+ | 0200000000000006 | (000B) Size | 5 B | 0100000000000003 -+ | 0200000000000006 | (000C) Mod | 0000000000000001 | 0100000000000003 -+ | 0200000000000007 | (0009) Path | C:\test_6.txt | 0100000000000003 -+ | 0200000000000007 | (000A) Hash | 0x00000000DEADBEF5 | 0100000000000003 -+ | 0200000000000007 | (000B) Size | 6 B | 0100000000000003 -+ | 0200000000000007 | (000C) Mod | 0000000000000001 | 0100000000000003 -+ | 0200000000000008 | (0009) Path | C:\test_7.txt | 0100000000000003 -+ | 0200000000000008 | (000A) Hash | 0x00000000DEADBEF6 | 0100000000000003 -+ | 0200000000000008 | (000B) Size | 7 B | 0100000000000003 -+ | 0200000000000008 | (000C) Mod | 0000000000000001 | 0100000000000003 -+ | 0200000000000009 | (0009) Path | C:\test_8.txt | 0100000000000003 -+ | 0200000000000009 | (000A) Hash | 0x00000000DEADBEF7 | 0100000000000003 -+ | 0200000000000009 | (000B) Size | 8 B | 0100000000000003 -+ | 0200000000000009 | (000C) Mod | 0000000000000001 | 0100000000000003 -+ | 020000000000000A | (0009) Path | C:\test_9.txt | 0100000000000003 -+ | 020000000000000A | (000A) Hash | 0x00000000DEADBEF8 | 0100000000000003 -+ | 020000000000000A | (000B) Size | 9 B | 0100000000000003 -+ | 020000000000000A | (000C) Mod | 0000000000000001 | 0100000000000003 ++ | 0200000000000001 | Hash | 0x00000000DEADBEEF | 0100000000000003 ++ | 0200000000000001 | Mod | 0000000000000001 | 0100000000000003 ++ | 0200000000000001 | Path | C:\test_0.txt | 0100000000000003 ++ | 0200000000000001 | Size | 0 B | 0100000000000003 ++ | 0200000000000002 | Hash | 0x00000000DEADBEF0 | 0100000000000003 ++ | 0200000000000002 | Mod | 0000000000000001 | 0100000000000003 ++ | 0200000000000002 | Path | C:\test_1.txt | 0100000000000003 ++ | 0200000000000002 | Size | 1 B | 0100000000000003 ++ | 0200000000000003 | Hash | 0x00000000DEADBEF1 | 0100000000000003 ++ | 0200000000000003 | Mod | 0000000000000001 | 0100000000000003 ++ | 0200000000000003 | Path | C:\test_2.txt | 0100000000000003 ++ | 0200000000000003 | Size | 2 B | 0100000000000003 ++ | 0200000000000004 | Hash | 0x00000000DEADBEF2 | 0100000000000003 ++ | 0200000000000004 | Mod | 0000000000000001 | 0100000000000003 ++ | 0200000000000004 | Path | C:\test_3.txt | 0100000000000003 ++ | 0200000000000004 | Size | 3 B | 0100000000000003 ++ | 0200000000000005 | Hash | 0x00000000DEADBEF3 | 0100000000000003 ++ | 0200000000000005 | Mod | 0000000000000001 | 0100000000000003 ++ | 0200000000000005 | Path | C:\test_4.txt | 0100000000000003 ++ | 0200000000000005 | Size | 4 B | 0100000000000003 ++ | 0200000000000006 | Hash | 0x00000000DEADBEF4 | 0100000000000003 ++ | 0200000000000006 | Mod | 0000000000000001 | 0100000000000003 ++ | 0200000000000006 | Path | C:\test_5.txt | 0100000000000003 ++ | 0200000000000006 | Size | 5 B | 0100000000000003 ++ | 0200000000000007 | Hash | 0x00000000DEADBEF5 | 0100000000000003 ++ | 0200000000000007 | Mod | 0000000000000001 | 0100000000000003 ++ | 0200000000000007 | Path | C:\test_6.txt | 0100000000000003 ++ | 0200000000000007 | Size | 6 B | 0100000000000003 ++ | 0200000000000008 | Hash | 0x00000000DEADBEF6 | 0100000000000003 ++ | 0200000000000008 | Mod | 0000000000000001 | 0100000000000003 ++ | 0200000000000008 | Path | C:\test_7.txt | 0100000000000003 ++ | 0200000000000008 | Size | 7 B | 0100000000000003 ++ | 0200000000000009 | Hash | 0x00000000DEADBEF7 | 0100000000000003 ++ | 0200000000000009 | Mod | 0000000000000001 | 0100000000000003 ++ | 0200000000000009 | Path | C:\test_8.txt | 0100000000000003 ++ | 0200000000000009 | Size | 8 B | 0100000000000003 ++ | 020000000000000A | Hash | 0x00000000DEADBEF8 | 0100000000000003 ++ | 020000000000000A | Mod | 0000000000000001 | 0100000000000003 ++ | 020000000000000A | Path | C:\test_9.txt | 0100000000000003 ++ | 020000000000000A | Size | 9 B | 0100000000000003 diff --git a/tests/NexusMods.MnemonicDB.Tests/DbTests.ReadDatomsOverTime_mod data_72057594037927939.verified.txt b/tests/NexusMods.MnemonicDB.Tests/DbTests.ReadDatomsOverTime_mod data_72057594037927939.verified.txt index f0e49499..3184eedb 100644 --- a/tests/NexusMods.MnemonicDB.Tests/DbTests.ReadDatomsOverTime_mod data_72057594037927939.verified.txt +++ b/tests/NexusMods.MnemonicDB.Tests/DbTests.ReadDatomsOverTime_mod data_72057594037927939.verified.txt @@ -1,3 +1,3 @@ -+ | 0200000000000001 | (0011) Name | Test Mod | 0100000000000003 -+ | 0200000000000001 | (0012) Source | http://test.com/ | 0100000000000003 -+ | 0200000000000001 | (0013) Loadout | 0200000000000002 | 0100000000000003 ++ | 0200000000000001 | Loadout | 0200000000000002 | 0100000000000003 ++ | 0200000000000001 | Name | Test Mod | 0100000000000003 ++ | 0200000000000001 | Source | http://test.com/ | 0100000000000003 diff --git a/tests/NexusMods.MnemonicDB.Tests/DbTests.ReadDatomsOverTime_mod data_72057594037927940.verified.txt b/tests/NexusMods.MnemonicDB.Tests/DbTests.ReadDatomsOverTime_mod data_72057594037927940.verified.txt index 6cd249fd..50bfbbc3 100644 --- a/tests/NexusMods.MnemonicDB.Tests/DbTests.ReadDatomsOverTime_mod data_72057594037927940.verified.txt +++ b/tests/NexusMods.MnemonicDB.Tests/DbTests.ReadDatomsOverTime_mod data_72057594037927940.verified.txt @@ -1,3 +1,3 @@ -+ | 0200000000000001 | (0011) Name | Test Mod 0 | 0100000000000004 -+ | 0200000000000001 | (0012) Source | http://test.com/ | 0100000000000003 -+ | 0200000000000001 | (0013) Loadout | 0200000000000002 | 0100000000000003 ++ | 0200000000000001 | Loadout | 0200000000000002 | 0100000000000003 ++ | 0200000000000001 | Name | Test Mod 0 | 0100000000000004 ++ | 0200000000000001 | Source | http://test.com/ | 0100000000000003 diff --git a/tests/NexusMods.MnemonicDB.Tests/DbTests.ReadDatomsOverTime_mod data_72057594037927941.verified.txt b/tests/NexusMods.MnemonicDB.Tests/DbTests.ReadDatomsOverTime_mod data_72057594037927941.verified.txt index 08fbb464..34e43b7e 100644 --- a/tests/NexusMods.MnemonicDB.Tests/DbTests.ReadDatomsOverTime_mod data_72057594037927941.verified.txt +++ b/tests/NexusMods.MnemonicDB.Tests/DbTests.ReadDatomsOverTime_mod data_72057594037927941.verified.txt @@ -1,3 +1,3 @@ -+ | 0200000000000001 | (0011) Name | Test Mod 1 | 0100000000000005 -+ | 0200000000000001 | (0012) Source | http://test.com/ | 0100000000000003 -+ | 0200000000000001 | (0013) Loadout | 0200000000000002 | 0100000000000003 ++ | 0200000000000001 | Loadout | 0200000000000002 | 0100000000000003 ++ | 0200000000000001 | Name | Test Mod 1 | 0100000000000005 ++ | 0200000000000001 | Source | http://test.com/ | 0100000000000003 diff --git a/tests/NexusMods.MnemonicDB.Tests/DbTests.ReadDatomsOverTime_mod data_72057594037927942.verified.txt b/tests/NexusMods.MnemonicDB.Tests/DbTests.ReadDatomsOverTime_mod data_72057594037927942.verified.txt index 27b1359f..6ad471dd 100644 --- a/tests/NexusMods.MnemonicDB.Tests/DbTests.ReadDatomsOverTime_mod data_72057594037927942.verified.txt +++ b/tests/NexusMods.MnemonicDB.Tests/DbTests.ReadDatomsOverTime_mod data_72057594037927942.verified.txt @@ -1,3 +1,3 @@ -+ | 0200000000000001 | (0011) Name | Test Mod 2 | 0100000000000006 -+ | 0200000000000001 | (0012) Source | http://test.com/ | 0100000000000003 -+ | 0200000000000001 | (0013) Loadout | 0200000000000002 | 0100000000000003 ++ | 0200000000000001 | Loadout | 0200000000000002 | 0100000000000003 ++ | 0200000000000001 | Name | Test Mod 2 | 0100000000000006 ++ | 0200000000000001 | Source | http://test.com/ | 0100000000000003 diff --git a/tests/NexusMods.MnemonicDB.Tests/DbTests.ReadModelsCanHaveExtraAttributes_archive file data.verified.txt b/tests/NexusMods.MnemonicDB.Tests/DbTests.ReadModelsCanHaveExtraAttributes_archive file data.verified.txt index c5ee2498..95a1a5b4 100644 --- a/tests/NexusMods.MnemonicDB.Tests/DbTests.ReadModelsCanHaveExtraAttributes_archive file data.verified.txt +++ b/tests/NexusMods.MnemonicDB.Tests/DbTests.ReadModelsCanHaveExtraAttributes_archive file data.verified.txt @@ -1,6 +1,6 @@ -+ | 0200000000000001 | (0009) Path | C:\test.txt | 0100000000000003 -+ | 0200000000000001 | (000A) Hash | 0x00000000DEADBEF0 | 0100000000000003 -+ | 0200000000000001 | (000B) Size | 1 B | 0100000000000003 -+ | 0200000000000001 | (000C) Mod | 0000000000000001 | 0100000000000003 -+ | 0200000000000001 | (000F) Path | C:\test.zip | 0100000000000003 -+ | 0200000000000001 | (0010) Hash | 0x00000000FEEDBEEF | 0100000000000003 ++ | 0200000000000001 | Hash | 0x00000000FEEDBEEF | 0100000000000003 ++ | 0200000000000001 | Path | C:\test.zip | 0100000000000003 ++ | 0200000000000001 | Hash | 0x00000000DEADBEF0 | 0100000000000003 ++ | 0200000000000001 | Mod | 0000000000000001 | 0100000000000003 ++ | 0200000000000001 | Path | C:\test.txt | 0100000000000003 ++ | 0200000000000001 | Size | 1 B | 0100000000000003 diff --git a/tests/NexusMods.MnemonicDB.Tests/DbTests.ReadModelsCanHaveExtraAttributes_file data.verified.txt b/tests/NexusMods.MnemonicDB.Tests/DbTests.ReadModelsCanHaveExtraAttributes_file data.verified.txt index c5ee2498..95a1a5b4 100644 --- a/tests/NexusMods.MnemonicDB.Tests/DbTests.ReadModelsCanHaveExtraAttributes_file data.verified.txt +++ b/tests/NexusMods.MnemonicDB.Tests/DbTests.ReadModelsCanHaveExtraAttributes_file data.verified.txt @@ -1,6 +1,6 @@ -+ | 0200000000000001 | (0009) Path | C:\test.txt | 0100000000000003 -+ | 0200000000000001 | (000A) Hash | 0x00000000DEADBEF0 | 0100000000000003 -+ | 0200000000000001 | (000B) Size | 1 B | 0100000000000003 -+ | 0200000000000001 | (000C) Mod | 0000000000000001 | 0100000000000003 -+ | 0200000000000001 | (000F) Path | C:\test.zip | 0100000000000003 -+ | 0200000000000001 | (0010) Hash | 0x00000000FEEDBEEF | 0100000000000003 ++ | 0200000000000001 | Hash | 0x00000000FEEDBEEF | 0100000000000003 ++ | 0200000000000001 | Path | C:\test.zip | 0100000000000003 ++ | 0200000000000001 | Hash | 0x00000000DEADBEF0 | 0100000000000003 ++ | 0200000000000001 | Mod | 0000000000000001 | 0100000000000003 ++ | 0200000000000001 | Path | C:\test.txt | 0100000000000003 ++ | 0200000000000001 | Size | 1 B | 0100000000000003 From 5fe64a2e7366bd241a0f8401257d921fabd9138f Mon Sep 17 00:00:00 2001 From: halgari Date: Fri, 20 Sep 2024 14:42:30 -0600 Subject: [PATCH 8/9] Update CHANGELOG.md --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73449998..201e9b83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ ## Changelog +### 0.9.83 - 20/09/2024 +* Optimized the interface with RocksDB used all throughout the library. Results in a 30% speedup on search operations +inside RocksDB. +* Removed the IAttributeRegistry and all associated IDs and implementations. Functionality is now split into two sub-modules + * AttributeCache - sealed class that is created by the backend store and is purely based on the database schema, used by most of the system + * AttributeResolver - DI dependant code that the frontend of the system uses to resolve DB datoms to C# attributes. Used very rarely +* It is now possible for most DB operations to be run completely ignorant of the C# attribute definitions. + ### 0.9.82 - 12/09/2024 * Fix a O(n) issue caused by Rx storing observers in a ImmutableList inside a `BehaviorSubject`. Switched to using R3 internally. Over time Rx's uses will be replaced with R3 to avoid these and several other issues From b7d50dcf70f390ceedd7999f164def266b92959d Mon Sep 17 00:00:00 2001 From: halgari Date: Fri, 20 Sep 2024 14:46:13 -0600 Subject: [PATCH 9/9] Delete old unused code --- .../Attribute.cs | 27 +------------------ .../IAttribute.cs | 7 ----- .../RegistryId.cs | 27 ------------------- src/NexusMods.MnemonicDB/Db.cs | 6 ++--- 4 files changed, 3 insertions(+), 64 deletions(-) delete mode 100644 src/NexusMods.MnemonicDB.Abstractions/RegistryId.cs diff --git a/src/NexusMods.MnemonicDB.Abstractions/Attribute.cs b/src/NexusMods.MnemonicDB.Abstractions/Attribute.cs index 1b104bc6..8d0ac5aa 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/Attribute.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/Attribute.cs @@ -25,9 +25,6 @@ public abstract partial class Attribute : IAttribute< private static Encoding Utf8Encoding = Encoding.UTF8; - - protected RegistryId.InlineCache Cache; - protected Attribute( ValueTags lowLevelType, string ns, @@ -173,12 +170,6 @@ protected virtual TValueType FromLowLevel(double value, ValueTags tags, Attribut /// public virtual bool DeclaredOptional { get; protected init; } - /// - public void SetDbId(RegistryId id, AttributeId attributeId) - { - Cache[id.Value] = attributeId; - } - /// public Type ValueType => typeof(TValueType); @@ -277,15 +268,6 @@ public override string ToString() { return Id.ToString(); } - - /// - /// Gets a service provider thats specific to this registry defined by the registry id - /// - protected IServiceProvider GetServiceProvider(RegistryId registryId) - { - throw new NotImplementedException(); - //return AttributeRegistryRegistry.Registries[registryId.Value]!.ServiceProvider; - } /// /// Typed datom for this attribute @@ -343,9 +325,7 @@ public void Retract(ITransaction tx) /// public Type ValueType => typeof(TValueType); - - public KeyPrefix prefix { get; init; } - + /// public override string ToString() { @@ -365,10 +345,5 @@ public int HashCodeByValue() { return HashCode.Combine(A, E, V); } - - public void Deconstruct(out KeyPrefix prefix) - { - prefix = this.prefix; - } } } diff --git a/src/NexusMods.MnemonicDB.Abstractions/IAttribute.cs b/src/NexusMods.MnemonicDB.Abstractions/IAttribute.cs index 10e03626..14e4dddb 100644 --- a/src/NexusMods.MnemonicDB.Abstractions/IAttribute.cs +++ b/src/NexusMods.MnemonicDB.Abstractions/IAttribute.cs @@ -34,13 +34,6 @@ public interface IAttribute /// public Symbol Id { get; } - /// - /// Sets the unique id of the attribute for the given registry - /// - /// - /// - public void SetDbId(RegistryId id, AttributeId attributeId); - /// /// True if the attribute is indexed, false if it is not. /// diff --git a/src/NexusMods.MnemonicDB.Abstractions/RegistryId.cs b/src/NexusMods.MnemonicDB.Abstractions/RegistryId.cs deleted file mode 100644 index 662d8c36..00000000 --- a/src/NexusMods.MnemonicDB.Abstractions/RegistryId.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Collections.Generic; -using System.Runtime.CompilerServices; -using TransparentValueObjects; - -namespace NexusMods.MnemonicDB.Abstractions; - -/// -/// It's extremely rare (basically only during migrations) that two attribute registry instances will exist -/// at one time. But it's possible, so we'll assign a unique identifier to each attribute registry, and use -/// this key to reference the attribute registry caches -/// -[ValueObject] -public readonly partial struct RegistryId -{ - - - [InlineArray(MaxSize)] - public struct InlineCache - { - /// - /// The maximum number of attributes that can be stored in the cache - /// - public const int MaxSize = 8; - - private AttributeId _registryId; - } -} diff --git a/src/NexusMods.MnemonicDB/Db.cs b/src/NexusMods.MnemonicDB/Db.cs index bc482ae2..382af64d 100644 --- a/src/NexusMods.MnemonicDB/Db.cs +++ b/src/NexusMods.MnemonicDB/Db.cs @@ -17,7 +17,6 @@ namespace NexusMods.MnemonicDB; internal class Db : IDb { private readonly IndexSegmentCache _cache; - private readonly RegistryId _registryId; /// /// The connection is used by several methods to navigate the graph of objects of Db, Connection, Datom Store, and @@ -42,10 +41,9 @@ public Db(ISnapshot snapshot, TxId txId, AttributeCache attributeCache) RecentlyAdded = snapshot.Datoms(SliceDescriptor.Create(txId)); } - private Db(ISnapshot snapshot, TxId txId, AttributeCache attributeCache, RegistryId registryId, IConnection connection, IndexSegmentCache newCache, IndexSegment recentlyAdded) + private Db(ISnapshot snapshot, TxId txId, AttributeCache attributeCache, IConnection connection, IndexSegmentCache newCache, IndexSegment recentlyAdded) { AttributeCache = attributeCache; - _registryId = registryId; _cache = newCache; _connection = connection; Snapshot = snapshot; @@ -60,7 +58,7 @@ private Db(ISnapshot snapshot, TxId txId, AttributeCache attributeCache, Registr internal Db WithNext(StoreResult storeResult, TxId txId) { var newCache = _cache.ForkAndEvict(storeResult, AttributeCache, out var newDatoms); - return new Db(storeResult.Snapshot, txId, AttributeCache, _registryId, _connection!, newCache, newDatoms); + return new Db(storeResult.Snapshot, txId, AttributeCache, _connection!, newCache, newDatoms); } private IndexSegment EntityDatoms(IDb db, EntityId id)