generated from Nexus-Mods/NexusMods.App.Template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support serialization of accumulators
- Loading branch information
Showing
5 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,27 @@ | ||
using System; | ||
using System.Buffers; | ||
using NexusMods.EventSourcing.Abstractions.Serialization; | ||
|
||
namespace NexusMods.EventSourcing.Abstractions; | ||
|
||
/// <summary> | ||
/// An accumulator is used to accumulate values from events, it is opaque to everything but the attribute definition that created it. | ||
/// </summary> | ||
public interface IAccumulator | ||
{ | ||
|
||
/// <summary> | ||
/// Writes the accumulator to the given buffer writer. | ||
/// </summary> | ||
/// <param name="writer"></param> | ||
/// <param name="registry"></param> | ||
public void WriteTo(IBufferWriter<byte> writer, ISerializationRegistry registry); | ||
|
||
/// <summary> | ||
/// Reads the accumulator from the given buffer reader, the span may be larger than the accumulator. Returns the | ||
/// number of bytes read. | ||
/// </summary> | ||
/// <param name="reader"></param> | ||
/// <param name="registry"></param> | ||
public int ReadFrom(ref ReadOnlySpan<byte> reader, ISerializationRegistry registry); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters