Add CultNet shard write forwarding policy
This commit is contained in:
parent
4af500a87d
commit
1f527ae99b
8 changed files with 218 additions and 29 deletions
36
src/GameCult.Networking/CultNetShardWriteForwarding.cs
Normal file
36
src/GameCult.Networking/CultNetShardWriteForwarding.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
using System.Threading.Tasks;
|
||||
|
||||
namespace GameCult.Networking
|
||||
{
|
||||
/// <summary>
|
||||
/// Forwards shard writes to an authoritative owner.
|
||||
/// </summary>
|
||||
public interface ICultNetShardWriteForwarder
|
||||
{
|
||||
/// <summary>
|
||||
/// Forwards a raw document put to the shard owner.
|
||||
/// </summary>
|
||||
Task ForwardPutAsync(CultNetShardDescriptor shard, CultNetDocumentPutRawMessage message);
|
||||
|
||||
/// <summary>
|
||||
/// Forwards a raw document delete to the shard owner.
|
||||
/// </summary>
|
||||
Task ForwardDeleteAsync(CultNetShardDescriptor shard, CultNetDocumentDeleteMessage message);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Options controlling shard write forwarding from a database server bridge.
|
||||
/// </summary>
|
||||
public sealed class CultNetDatabaseServerOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets whether non-primary writes may be forwarded to shard owners.
|
||||
/// </summary>
|
||||
public bool ForwardNonPrimaryWrites { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the forwarder used when non-primary write forwarding is enabled.
|
||||
/// </summary>
|
||||
public ICultNetShardWriteForwarder? WriteForwarder { get; set; }
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue