public sealed class SocialBridgeDoc 28's social rules against doc 27's IGuildGrain: answered in the frame, written down afterwards, and never awaited.
Remarks
LedgerBridge's and LockoutBridge's shape — ISocialStore is synchronous because a guild-chat line and a party invite both ask it mid-frame, and ADR-016 forbids awaiting the grain that owns the answer. So it is answered from a view and the change is posted.
⚠ The roster this realm holds is only the members it can name, and a 500-member guild has maybe thirty of them online. A gameplay PlayerId is a session id widened (see From), so somebody who is not connected to this realm has no gameplay id at all and cannot be seated. That is not a defect to engineer around — it is the same partial view LedgerBridge already keeps of a balance — but it makes one thing lethal: a partial roster must never be written back as the whole truth, or the write deletes everybody who was offline.
⚠ So a guild is written as operations, and there is no state-shaped save. SaveGuild is implemented and counted rather than obeyed — see the remarks on it — because a diff of two rosters has thrown away who did it, and every IGuildGrain method needs an actor since every guild rule is about authority. Invite, Kick, Promote and Rename are the path that keeps the actor.
⚠ GuildOf has LockoutBridge's cold-read problem. Returning None for somebody whose guild was never loaded reads as "in no guild", which admits them to a rival's guild chat and drops the tag their hall's permissions hang off. The interface cannot say "I do not know", so IsWarm is what a caller checks and a cold read is counted and raised.
⚠ The local checks are optimism and the grain re-checks everything. A cap of 500 measured against thirty seated members will say yes when the guild is full. That is LedgerBridge's trade exactly: the frame is answered, the grain is the authority, and the disagreement is counted in Divergences.
Fields and properties (8)
public int GuildsHow many guilds the view holds.
public int WarmHow many players have had their guild resolved.
public int PendingHow many guild edits are waiting.
public int PendingGraphsHow many graph writes are waiting.
public int ColdReadsHow many times somebody's guild or graph was asked about who had never been loaded. Never anything but zero.
public int DivergencesHow many queued edits the grain refused after the view had allowed them.
public int StateWritesHow many times a guild was saved by state rather than by operation.
public SocialGraphs GraphsEvery graph this realm holds, which is what makes a block mean anything.
Events (2)
Methods (20)
public SocialBridge(IGameplayIdentity identity, SocialLibrary? library = null)Makes one.
public bool IsWarm(PlayerId player)Whether somebody's guild has been resolved.
public Guild? Warmed(PlayerId player, GuildRow? row)Puts somebody's guild in, as the cluster gave it.
public SocialGraph? Warmed(PlayerKey owner, IEnumerable<SocialLink> links)Puts somebody's friends and blocks in, as storage gave them.
public int Admitted(PlayerKey key, PlayerId player)Projects everything this realm knows about somebody who has just been let in.
public bool Forget(PlayerId player)Forgets somebody who left.
public Guild? LoadGuild(GuildId id)Loads a guild.
public GuildId GuildOf(PlayerId player)public SocialGraph? LoadGraph(PlayerId player)Loads somebody's friends and blocks.
public GuildRefusal Invite(PlayerId by, GuildId id, PlayerId player, GameplayTagRange invitePermission = default(GameplayTagRange))Invites somebody, applying the rules here and queueing the write.
public GuildRefusal Kick(PlayerId by, GuildId id, PlayerId player, GameplayTagRange kickPermission = default(GameplayTagRange))Removes somebody, applying the rules here and queueing the write.
public GuildRefusal Promote(PlayerId by, GuildId id, PlayerId player, int rank)Moves somebody to another rung, applying the rules here and queueing the write.
public bool Rename(PlayerId by, GuildId id, int rank, string name)Renames a rung, applying it here and queueing the write.
public void SaveGuild(Guild guild)public void SaveGraph(SocialGraph graph)public ImmutableArray<GuildEdit> Drain()Takes every guild edit waiting to be written down.
public ImmutableArray<PendingGraph> DrainGraphs()Takes every graph waiting to be written down.
public bool Settle(GuildEdit edit)Says an edit landed.
public bool Settle(GuildEdit edit, GuildRefusal refusal)Says the grain refused an edit the view had already applied.
public bool Settle(PendingGraph write)Says a graph landed.
Used by (6)
- MmoRealmMmo.Realm
- RealmTestsMmo.Realm.Tests
- ShardMmo.Soak
- SoakMmo.Soak
- HousekeepingTestsVixen.Live.Gameplay.Tests
- SocialBridgeTestsVixen.Live.Gameplay.Tests