Open a directory store without creating anything

Opening a directory store, read-only or writable, created the .records
folder and its .commit.lock before reading a manifest that might not
exist. Only a write creates them now: PullAll takes the commit lease with
create: false, which opens an existing lock and returns no lease when
there is none (no writer has ever committed there, so there is nothing to
exclude). CommitBatch and PushAll create the folder and lock as before.

Test DirectoryMessagePackBackingStore_Open_CreatesNothing_UntilAWrite:
opening a missing store and a manifest-less .records folder, read-only
and writable, leaves the filesystem unchanged; the first flush creates the
manifest, the lock and one page. With the previous lease code restored
the test fails on the first read-only open.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-14 13:43:45 +02:00
commit debe616716
7 changed files with 66 additions and 120 deletions

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 5a7d06cb8f1e491785b3ae24034f1121
timeCreated: 1779630000

View file

@ -1,87 +0,0 @@
using System;
namespace GameCult.Unity.Caching
{
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Class, Inherited = true)]
public sealed class CultInspectorLabelAttribute : Attribute
{
public CultInspectorLabelAttribute(string label)
{
Label = label ?? string.Empty;
}
public string Label { get; }
}
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, Inherited = true)]
public sealed class CultInspectorHiddenAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, Inherited = true)]
public sealed class CultInspectorReadOnlyAttribute : Attribute
{
}
// Lower values appear first; members without it keep their key order.
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, Inherited = true)]
public sealed class CultInspectorOrderAttribute : Attribute
{
public CultInspectorOrderAttribute(int order)
{
Order = order;
}
public int Order { get; }
}
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, Inherited = true)]
public sealed class CultInspectorTextAreaAttribute : Attribute
{
public CultInspectorTextAreaAttribute(int minLines = 3, int maxLines = 12)
{
MinLines = minLines;
MaxLines = maxLines;
}
public int MinLines { get; }
public int MaxLines { get; }
}
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, Inherited = true)]
public sealed class CultInspectorRangeAttribute : Attribute
{
public CultInspectorRangeAttribute(float min, float max)
{
Min = min;
Max = max;
}
public float Min { get; }
public float Max { get; }
}
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, Inherited = true)]
public sealed class CultInspectorAssetPathAttribute : Attribute
{
public CultInspectorAssetPathAttribute(Type assetType = null)
{
AssetType = assetType;
}
public Type AssetType { get; }
}
// Marks an editor class implementing ICultInspectorDrawer as the drawer for every member of MemberType,
// or of any closed form when MemberType is an open generic definition. It wins over the built-in drawers.
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
public sealed class CultInspectorDrawerAttribute : Attribute
{
public CultInspectorDrawerAttribute(Type memberType)
{
MemberType = memberType ?? throw new ArgumentNullException(nameof(memberType));
}
public Type MemberType { get; }
}
}

View file

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 8871d3eb346242e3b0acfd6da5108676
timeCreated: 1779630000

View file

@ -1,14 +0,0 @@
{
"name": "GameCult.Unity.Caching",
"rootNamespace": "GameCult.Unity.Caching",
"references": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": true
}

View file

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: ab6636c1402c4c579df9c07101542f13
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: