Add Gitea NuGet publish workflow and finalize current storage/index/docs updates.
Some checks failed
NuGet Publish / build-and-pack (push) Failing after 24s
NuGet Publish / publish-to-gitea (push) Has been skipped

This commit is contained in:
Joseph Doherty
2026-02-20 13:32:10 -05:00
parent 52445078a1
commit 528939d3a0
6 changed files with 185 additions and 92 deletions

View File

@@ -16,6 +16,7 @@ using System;
using System.IO;
using System.Diagnostics;
using System.Threading;
using ZB.MOM.WW.CBDD.Core;
[assembly: InternalsVisibleTo("ZB.MOM.WW.CBDD.Tests")]
@@ -48,7 +49,7 @@ public class DocumentCollection<T> : DocumentCollection<ObjectId, T> where T : c
/// </summary>
/// <typeparam name="TId">Type of the primary key</typeparam>
/// <typeparam name="T">Type of the entity</typeparam>
public partial class DocumentCollection<TId, T> : IDisposable where T : class
public partial class DocumentCollection<TId, T> : IDisposable, ICompactionAwareCollection where T : class
{
private readonly ITransactionHolder _transactionHolder;
private readonly IStorageEngine _storage;
@@ -130,15 +131,27 @@ public partial class DocumentCollection<TId, T> : IDisposable where T : class
private void RefreshPrimaryIndexRootFromMetadata()
{
_indexManager.RefreshFromStorageMetadata();
var primaryRootPageId = _indexManager.PrimaryRootPageId;
if (primaryRootPageId == 0)
var metadata = _storage.GetCollectionMetadata(_collectionName);
if (metadata == null || metadata.PrimaryRootPageId == 0)
return;
if (primaryRootPageId != _primaryIndex.RootPageId)
if (metadata.PrimaryRootPageId != _primaryIndex.RootPageId)
{
_primaryIndex.SetRootPageId(primaryRootPageId);
_primaryIndex.SetRootPageId(metadata.PrimaryRootPageId);
}
}
void ICompactionAwareCollection.RefreshIndexBindingsAfterCompaction()
{
var metadata = _storage.GetCollectionMetadata(_collectionName);
if (metadata == null)
return;
_indexManager.RebindFromMetadata(metadata);
if (metadata.PrimaryRootPageId != 0 && metadata.PrimaryRootPageId != _primaryIndex.RootPageId)
{
_primaryIndex.SetRootPageId(metadata.PrimaryRootPageId);
}
}