Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable Unique for now, until we rework schema insertion to allow for tempIDs as attributeIDs #123

Merged
merged 2 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/NexusMods.MnemonicDB.Abstractions/AttributeCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,19 @@ public void Reset(IDb db)
}
_isIndexed = newIsIndexed;

var isUnique = db.Datoms(AttributeDefinition.Unique);

//var isUnique = db.Datoms(AttributeDefinition.Unique);
var newIsUnique = new BitArray(maxIndex);
/*
foreach (var datom in isUnique)
{
var id = datom.E.Value;
newIsUnique[(int)id] = true;
}
*/
_isUnique = newIsUnique;


var isNoHistory = db.Datoms(AttributeDefinition.NoHistory);
var newIsNoHistory = new BitArray(maxIndex);
if (isNoHistory.Any())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@
/// </summary>
public static readonly MarkerAttribute Indexed = new(Namespace, nameof(Indexed));

// Disabled until we figure out how to use TempIDs during attribute insertion
/// <summary>

Check warning on line 35 in src/NexusMods.MnemonicDB.Abstractions/BuiltInEntities/AttributeDefinition.cs

View workflow job for this annotation

GitHub Actions / build-and-test / Build and Test (ubuntu-latest)

XML comment is not placed on a valid language element

Check warning on line 35 in src/NexusMods.MnemonicDB.Abstractions/BuiltInEntities/AttributeDefinition.cs

View workflow job for this annotation

GitHub Actions / build-and-test / Build and Test (ubuntu-latest)

XML comment is not placed on a valid language element

Check warning on line 35 in src/NexusMods.MnemonicDB.Abstractions/BuiltInEntities/AttributeDefinition.cs

View workflow job for this annotation

GitHub Actions / build-and-test / Build and Test (windows-latest)

XML comment is not placed on a valid language element

Check warning on line 35 in src/NexusMods.MnemonicDB.Abstractions/BuiltInEntities/AttributeDefinition.cs

View workflow job for this annotation

GitHub Actions / build-and-test / Build and Test (windows-latest)

XML comment is not placed on a valid language element

Check warning on line 35 in src/NexusMods.MnemonicDB.Abstractions/BuiltInEntities/AttributeDefinition.cs

View workflow job for this annotation

GitHub Actions / build-and-test / Build and Test (macos-latest)

XML comment is not placed on a valid language element

Check warning on line 35 in src/NexusMods.MnemonicDB.Abstractions/BuiltInEntities/AttributeDefinition.cs

View workflow job for this annotation

GitHub Actions / build-and-test / Build and Test (macos-latest)

XML comment is not placed on a valid language element

Check warning on line 35 in src/NexusMods.MnemonicDB.Abstractions/BuiltInEntities/AttributeDefinition.cs

View workflow job for this annotation

GitHub Actions / build-and-test / Build and Test (macos-13)

XML comment is not placed on a valid language element

Check warning on line 35 in src/NexusMods.MnemonicDB.Abstractions/BuiltInEntities/AttributeDefinition.cs

View workflow job for this annotation

GitHub Actions / build-and-test / Build and Test (macos-13)

XML comment is not placed on a valid language element
/// True if the attribute is unique, that this attr/value pair can only exist on one entity at a time
/// </summary>
public static readonly MarkerAttribute Unique = new(Namespace, nameof(Unique));
// public static readonly MarkerAttribute Unique = new(Namespace, nameof(Unique));

/// <summary>
/// This attribute is optional.
Expand Down Expand Up @@ -69,8 +70,8 @@
tx.Add(eid, Cardinality, attribute.Cardinalty);
if (attribute.IsIndexed)
tx.Add(eid, Indexed, Null.Instance);
if (attribute.IsUnique)
tx.Add(eid, Unique, Null.Instance);
//if (attribute.IsUnique)
// tx.Add(eid, Unique, Null.Instance);
if (attribute.NoHistory)
tx.Add(eid, NoHistory, Null.Instance);
if (attribute.DeclaredOptional)
Expand All @@ -90,7 +91,7 @@
{ Cardinality, 6 },
{ Documentation, 7 },
{ Transaction.Timestamp, 8},
{ Unique, 9 }
//{ Unique, 9 }
};

/// <summary>
Expand All @@ -102,7 +103,7 @@
Insert(tx, ValueType);
Insert(tx, Documentation);
Insert(tx, Indexed);
Insert(tx, Unique);
//Insert(tx, Unique);
Insert(tx, Optional);
Insert(tx, NoHistory);
Insert(tx, Cardinality);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ public override void Execute(DatomStore store)

if (cache.IsUnique(aid) != attribute.IsUnique)
{
/*
if (attribute.IsUnique)
builder.Add(EntityId.From(aid.Value), AttributeDefinition.Unique, Null.Instance);
else
builder.Add(EntityId.From(aid.Value), AttributeDefinition.Unique, Null.Instance, true);
*/
}

if (cache.GetValueTag(aid) != attribute.LowLevelType)
Expand Down Expand Up @@ -87,8 +89,8 @@ private void AddAttribute(IAttribute definition, in IndexSegmentBuilder builder)
if (definition.IsIndexed)
builder.Add(id, AttributeDefinition.Indexed, Null.Instance);

if (definition.IsUnique)
builder.Add(id, AttributeDefinition.Unique, Null.Instance);
//if (definition.IsUnique)
// builder.Add(id, AttributeDefinition.Unique, Null.Instance);

if (definition.DeclaredOptional)
builder.Add(id, AttributeDefinition.Optional, Null.Instance);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
+ | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001
+ | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001
+ | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001
+ | 0000000000000009 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Unique | 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
Expand All @@ -27,7 +26,6 @@
+ | 0000000000000006 | (0002) ValueType | UInt8 | 0100000000000001
+ | 0000000000000007 | (0002) ValueType | Utf8 | 0100000000000001
+ | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001
+ | 0000000000000009 | (0002) ValueType | Null | 0100000000000001
+ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002
+ | 0000000000000015 | (0002) ValueType | UInt64 | 0100000000000002
+ | 0000000000000016 | (0002) ValueType | UInt64 | 0100000000000002
Expand Down Expand Up @@ -56,7 +54,6 @@
+ | 0000000000000006 | (0006) Cardinality | 1 | 0100000000000001
+ | 0000000000000007 | (0006) Cardinality | 1 | 0100000000000001
+ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001
+ | 0000000000000009 | (0006) Cardinality | 1 | 0100000000000001
+ | 0000000000000014 | (0006) Cardinality | 1 | 0100000000000002
+ | 0000000000000015 | (0006) Cardinality | 1 | 0100000000000002
+ | 0000000000000016 | (0006) Cardinality | 1 | 0100000000000002
Expand All @@ -77,7 +74,6 @@
+ | 0100000000000006 | (0008) Timestamp | DateTime : 5 | 0100000000000006
+ | 0100000000000007 | (0008) Timestamp | DateTime : 6 | 0100000000000007
+ | 0100000000000008 | (0008) Timestamp | DateTime : 7 | 0100000000000008
+ | 0000000000000001 | (0009) Unique | | 0100000000000001
+ | 0200000000000003 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000005
+ | 0200000000000004 | (001E) InKeyBlob | Blob 0xB85FD37A0A050E63 255 bytes | 0100000000000006
+ | 0200000000000003 | (001F) InValueBlob | HashedBlob 0x8FFA0F9DFCB11153 16777216 bytes | 0100000000000005
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
+ | 0000000000000003 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Indexed | 0100000000000001
+ | 0000000000000005 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/NoHistory | 0100000000000001
+ | 0000000000000004 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Optional | 0100000000000001
+ | 0000000000000009 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Unique | 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
+ | 0000000000000001 | (0002) ValueType | Ascii | 0100000000000001
+ | 0000000000000001 | (0003) Indexed | | 0100000000000001
+ | 0000000000000001 | (0006) Cardinality | 1 | 0100000000000001
+ | 0000000000000001 | (0009) Unique | | 0100000000000001
+ | 0000000000000002 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/ValueType | 0100000000000001
+ | 0000000000000002 | (0002) ValueType | UInt8 | 0100000000000001
+ | 0000000000000002 | (0006) Cardinality | 1 | 0100000000000001
Expand All @@ -25,9 +24,6 @@
+ | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001
+ | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001
+ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001
+ | 0000000000000009 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Unique | 0100000000000001
+ | 0000000000000009 | (0002) ValueType | Null | 0100000000000001
+ | 0000000000000009 | (0006) Cardinality | 1 | 0100000000000001
+ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002
+ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002
+ | 0000000000000014 | (0003) Indexed | | 0100000000000002
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
+ | 0000000000000001 | (0002) ValueType | Ascii | 0100000000000001
+ | 0000000000000001 | (0003) Indexed | | 0100000000000001
+ | 0000000000000001 | (0006) Cardinality | 1 | 0100000000000001
+ | 0000000000000001 | (0009) Unique | | 0100000000000001
+ | 0000000000000002 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/ValueType | 0100000000000001
+ | 0000000000000002 | (0002) ValueType | UInt8 | 0100000000000001
+ | 0000000000000002 | (0006) Cardinality | 1 | 0100000000000001
Expand All @@ -25,9 +24,6 @@
+ | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001
+ | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001
+ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001
+ | 0000000000000009 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Unique | 0100000000000001
+ | 0000000000000009 | (0002) ValueType | Null | 0100000000000001
+ | 0000000000000009 | (0006) Cardinality | 1 | 0100000000000001
+ | 0100000000000001 | (0008) Timestamp | DateTime : 0 | 0100000000000001
+ | 0000000000000014 | (0001) UniqueId | NexusMods.MnemonicDB.TestModel.File/Path | 0100000000000002
+ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
+ | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001
+ | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001
+ | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001
+ | 0000000000000009 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Unique | 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
Expand All @@ -27,7 +26,6 @@
+ | 0000000000000006 | (0002) ValueType | UInt8 | 0100000000000001
+ | 0000000000000007 | (0002) ValueType | Utf8 | 0100000000000001
+ | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001
+ | 0000000000000009 | (0002) ValueType | Null | 0100000000000001
+ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002
+ | 0000000000000015 | (0002) ValueType | UInt64 | 0100000000000002
+ | 0000000000000016 | (0002) ValueType | UInt64 | 0100000000000002
Expand Down Expand Up @@ -56,7 +54,6 @@
+ | 0000000000000006 | (0006) Cardinality | 1 | 0100000000000001
+ | 0000000000000007 | (0006) Cardinality | 1 | 0100000000000001
+ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001
+ | 0000000000000009 | (0006) Cardinality | 1 | 0100000000000001
+ | 0000000000000014 | (0006) Cardinality | 1 | 0100000000000002
+ | 0000000000000015 | (0006) Cardinality | 1 | 0100000000000002
+ | 0000000000000016 | (0006) Cardinality | 1 | 0100000000000002
Expand All @@ -73,7 +70,6 @@
+ | 0100000000000002 | (0008) Timestamp | DateTime : 1 | 0100000000000002
+ | 0100000000000003 | (0008) Timestamp | DateTime : 2 | 0100000000000003
+ | 0100000000000004 | (0008) Timestamp | DateTime : 3 | 0100000000000004
+ | 0000000000000001 | (0009) Unique | | 0100000000000001
+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003
+ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000004
+ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
+ | 0000000000000006 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Cardinality | 0100000000000001
+ | 0000000000000007 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Documentation | 0100000000000001
+ | 0000000000000008 | (0001) UniqueId | NexusMods.MnemonicDB.Transaction/Timestamp | 0100000000000001
+ | 0000000000000009 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Unique | 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
Expand All @@ -27,7 +26,6 @@
+ | 0000000000000006 | (0002) ValueType | UInt8 | 0100000000000001
+ | 0000000000000007 | (0002) ValueType | Utf8 | 0100000000000001
+ | 0000000000000008 | (0002) ValueType | Int64 | 0100000000000001
+ | 0000000000000009 | (0002) ValueType | Null | 0100000000000001
+ | 0000000000000014 | (0002) ValueType | Utf8Insensitive | 0100000000000002
+ | 0000000000000015 | (0002) ValueType | UInt64 | 0100000000000002
+ | 0000000000000016 | (0002) ValueType | UInt64 | 0100000000000002
Expand Down Expand Up @@ -56,7 +54,6 @@
+ | 0000000000000006 | (0006) Cardinality | 1 | 0100000000000001
+ | 0000000000000007 | (0006) Cardinality | 1 | 0100000000000001
+ | 0000000000000008 | (0006) Cardinality | 1 | 0100000000000001
+ | 0000000000000009 | (0006) Cardinality | 1 | 0100000000000001
+ | 0000000000000014 | (0006) Cardinality | 1 | 0100000000000002
+ | 0000000000000015 | (0006) Cardinality | 1 | 0100000000000002
+ | 0000000000000016 | (0006) Cardinality | 1 | 0100000000000002
Expand All @@ -73,7 +70,6 @@
+ | 0100000000000002 | (0008) Timestamp | DateTime : 1 | 0100000000000002
+ | 0100000000000003 | (0008) Timestamp | DateTime : 2 | 0100000000000003
+ | 0100000000000004 | (0008) Timestamp | DateTime : 3 | 0100000000000004
+ | 0000000000000001 | (0009) Unique | | 0100000000000001
+ | 0200000000000001 | (0014) Path | /foo/bar | 0100000000000003
+ | 0200000000000002 | (0014) Path | /foo/qux | 0100000000000004
+ | 0200000000000002 | (0014) Path | /qix/bar | 0100000000000003
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
+ | 0000000000000003 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Indexed | 0100000000000001
+ | 0000000000000005 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/NoHistory | 0100000000000001
+ | 0000000000000004 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Optional | 0100000000000001
+ | 0000000000000009 | (0001) UniqueId | NexusMods.MnemonicDB.DatomStore/Unique | 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
Expand Down
Loading
Loading