Files
DorkNet/DorkNet.Server/Data/Entities/PrivateInstanceEntity.cs
Alexa d471b418b9 Import march-2020-03-10 from private repo (scrubbed 2026-05-27)
Targets Rec Room 2020.03.10 client (also serves 2020.03.06).

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 dorknet-clientpatch-{key}.zip
  for v1-march-* Release uploads.
- .github/workflows/release.yml — on tag push publishes both
  dorknet-server-march_2020_03_10-win-x64.zip and
  dorknet-clientpatch-march_2020_03_10.zip as Release assets.

Same scrub rules as december; tools/build-patcher-zip.ps1 added to
the maintainer-side allow-list so it survives.
2026-05-27 01:06: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;
}