Table of Contents

Class MemoryHistoryStore

Namespace
McServerLauncher.Services
Assembly
McServerLauncher.dll

Loads and saves one server's MemoryHistory.

public sealed class MemoryHistoryStore
Inheritance
MemoryHistoryStore
Inherited Members

Remarks

Under %APPDATA%\McServerLauncher\memory<serverId>\history.json, beside the content ledger and for the same reason: it is about the app's view of the server, so it neither travels with the world nor fills its backups. Only the latest MaxSessions runs are kept; what the app learns from them is about how the server is used now.

Constructors

MemoryHistoryStore(string)

public MemoryHistoryStore(string directory)

Parameters

directory string

Fields

MaxSessions

How many runs are kept.

public const int MaxSessions = 30

Field Value

int

Properties

RootDirectory

Where every server's history lives. Settable so tests can point it at a temp folder.

public static string RootDirectory { get; set; }

Property Value

string

Sessions

The kept runs, oldest first. A copy: safe to read while another run is added.

public IReadOnlyList<MemorySession> Sessions { get; }

Property Value

IReadOnlyList<MemorySession>

Methods

Add(MemorySession)

Adds a finished run, drops the oldest beyond MaxSessions and saves.

public void Add(MemorySession session)

Parameters

session MemorySession

For(string)

The store for a server, shared by everything that asks for it.

public static MemoryHistoryStore For(string serverId)

Parameters

serverId string

Returns

MemoryHistoryStore

PruneOrphans(IEnumerable<string>)

Deletes the history of servers that are no longer in the app. A removed server's id is never reused, so what is left would only pile up for ever.

public static void PruneOrphans(IEnumerable<string> liveServerIds)

Parameters

liveServerIds IEnumerable<string>

SetNextStartBoost(long)

Asks for mb more memory at the next start, once.

public void SetNextStartBoost(long mb)

Parameters

mb long

TakeNextStartBoost()

The raise waiting for the next start, which it clears. 0 when there is none.

public long TakeNextStartBoost()

Returns

long