JSON backing store, I/O fixes, Networking Security
Introduced Newtonsoft.Json-backed persistence. Improved backing-store reliability and serialization across the caching stack. Improved networking security posture. Key changes: - Add new GameCult.Caching.NewtonsoftJson project with SingleFile/MultiFile backing stores and polymorphic known-type envelopes. - Add MessagePack helper serialization (DatabaseEntrySerialization) and update MessagePack backing stores to use the shared options/resolver; add DatabaseLink formatter and generator/analyzer docs. - Update CultLib.sln to include the new projects and new caching tests project. - Improve CultCache persistence behavior: track pending store operations, wait for operations on PullAll, and centralize async push handling with error logging. - Harden file I/O in multi-file/single-file stores: atomic temp-file writes, safe Replace/Move semantics, rename-safe deletes, and improved file-watcher subscription and debounce disposal. - Add README files and documentation for several subprojects and packaging projects. These changes add JSON persistence support, improve serialization consistency, and make on-disk operations more robust and observable.
This commit is contained in:
parent
d88eecb4ba
commit
0bfc85a4f2
50 changed files with 3957 additions and 325 deletions
|
|
@ -8,9 +8,16 @@ using Microsoft.CodeAnalysis.Text;
|
|||
|
||||
namespace GameCult.Caching.MessagePack.Generator
|
||||
{
|
||||
/// <summary>
|
||||
/// Generates MessagePack formatters and resolver mappings for concrete <c>DatabaseEntry</c> types.
|
||||
/// </summary>
|
||||
[Generator]
|
||||
public class DatabaseEntryMessagePackGenerator : IIncrementalGenerator
|
||||
{
|
||||
/// <summary>
|
||||
/// Configures the incremental generator pipeline.
|
||||
/// </summary>
|
||||
/// <param name="ctx">The generator initialization context.</param>
|
||||
public void Initialize(IncrementalGeneratorInitializationContext ctx)
|
||||
{
|
||||
// Select DatabaseEntry subclass declarations
|
||||
|
|
|
|||
63
src/GameCult.Caching.MessagePack.Generator/README.md
Normal file
63
src/GameCult.Caching.MessagePack.Generator/README.md
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
# GameCult.Caching.MessagePack.Generator
|
||||
|
||||
`GameCult.Caching.MessagePack.Generator` is a Roslyn incremental source generator that emits MessagePack formatters for concrete `DatabaseEntry` subclasses.
|
||||
|
||||
## Scope
|
||||
|
||||
This project is infrastructure for the caching stack. Application code usually does not reference it directly.
|
||||
|
||||
Its job is to:
|
||||
|
||||
- find non-abstract subclasses of `DatabaseEntry`
|
||||
- generate concrete `IMessagePackFormatter<T>` implementations
|
||||
- generate resolver mappings consumed by `DatabaseEntryResolver`
|
||||
|
||||
## What It Generates
|
||||
|
||||
For each discovered concrete `DatabaseEntry` subtype, the generator emits:
|
||||
|
||||
- a formatter type
|
||||
- a resolver mapping entry
|
||||
|
||||
Member ordering is:
|
||||
|
||||
1. `ID` first
|
||||
2. members with `[Key(...)]`, ordered by key
|
||||
3. remaining non-ignored instance fields and properties
|
||||
|
||||
That gives predictable binary layout while still supporting manual `[Key]` ordering.
|
||||
|
||||
## Example
|
||||
|
||||
Given:
|
||||
|
||||
```csharp
|
||||
[MessagePackObject]
|
||||
public class PlayerData : DatabaseEntry, INamedEntry
|
||||
{
|
||||
[Key(1)] public string Email = string.Empty;
|
||||
[Key(2)] public string PasswordHash = string.Empty;
|
||||
[Key(3)] public string Username = string.Empty;
|
||||
|
||||
[IgnoreMember]
|
||||
public string EntryName
|
||||
{
|
||||
get => Username;
|
||||
set => Username = value;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
the generator emits the formatter plumbing needed for MessagePack serialization of `PlayerData` without manually implementing an `IMessagePackFormatter<PlayerData>`.
|
||||
|
||||
## When You Need To Think About This Package
|
||||
|
||||
Usually only when:
|
||||
|
||||
- formatter generation is not happening
|
||||
- a cache-entry type is not serializing as expected
|
||||
- you are debugging build-time source generation behavior
|
||||
|
||||
## Distribution
|
||||
|
||||
The generator is packaged for consumers through [../GameCult.Caching.MessagePack.Analyzers/README.md](../GameCult.Caching.MessagePack.Analyzers/README.md).
|
||||
Loading…
Reference in a new issue