Files
DorkNet/DorkNet.Server/Data/Entities/PrivateInstanceEntity.cs
Alexa 4edf25b2d5 Import december-2020-12-18 from private repo (scrubbed 2026-05-27)
Targets Rec Room 2020.12.18 client.

Re-import after adding:
- DorkNet.ClientMod/dorknet-clientmod.json.template — config schema
  the launcher's manifest-driven patcher renders into UserData/.
- tools/build-patcher-zip.ps1 — produces the dorknet-clientpatch-{key}.zip
  Release asset the launcher fetches.
- .github/workflows/release.yml — auto-publishes both Release assets
  on v1-december-* tag push.

Scrubbed via maintainer-side scrub-for-public.ps1: same drop rules as
the prior import, plus build-patcher-zip.ps1 added to the tools/
allow-list so it survives the scrub.
2026-05-27 01:04:12 +03:00

43 lines
1.9 KiB
C#

using System.ComponentModel.DataAnnotations;
namespace DorkNet.Server.Data.Entities;
/// <summary>
/// Durable record of a private (invite-only) Photon match created via
/// <c>POST /goto/room/{name}?CreatePrivateInstance=True</c>. Replaces
/// the in-process <c>ConcurrentDictionary</c> in
/// <see cref="DorkNet.Server.Services.PrivateInstanceService"/> so
/// invitations land on any replica.
///
/// Without this row in shared storage, an invite issued by Player A
/// (replica 1) wouldn't be visible to Player B's <c>POST /goto/instance/{id}</c>
/// when their request lands on replica 2 — they'd be routed to a fresh
/// public lobby instead of the inviter's match.
///
/// The associated invite list lives in <see cref="PrivateInstanceInviteeEntity"/>;
/// we keep it as a join table rather than a JSON column so the per-row
/// "is X invited to Y?" check stays a fast indexed lookup.
/// </summary>
public class PrivateInstanceEntity
{
/// <summary>The instance id used as the wire <c>roomInstanceId</c>
/// in matchmaking responses. Generated server-side at creation
/// time; stable for the lifetime of the match. NOT autoincrement —
/// the value is computed from owner/room/sub plus a nonce so the
/// id is itself unforgeable without the nonce.</summary>
public long Id { get; set; }
public long RoomId { get; set; }
public long SubRoomId { get; set; }
public long OwnerPlayerId { get; set; }
[MaxLength(256)] public string PhotonRoomId { get; set; } = string.Empty;
[MaxLength(64)] public string Location { get; set; } = string.Empty;
[MaxLength(256)] public string DataBlob { get; set; } = string.Empty;
[MaxLength(16)] public string PhotonRegion { get; set; } = "us";
public int MaxCapacity { get; set; } = 8;
[MaxLength(128)] public string Name { get; set; } = string.Empty;
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
}