Table of Contents

Class StoreLockOwner

Namespace
Foundation.Data.Doublets.Cli
Assembly
Foundation.Data.Doublets.Cli.dll

Who holds a store lock (issue #194). The record is a few key=value lines, the same in the C#, Rust and JavaScript clink:

pid=4242
host=build-7
pid_namespace=pid:[4026531836]
start_time=1234567
acquired_at_ms=1764028800000
token=4242.5f0c2a9d1e3b4c6a
program=clink (csharp) 5.2.1

pid_namespace and start_time are only known on Linux; elsewhere they are empty and the owner is judged by host and process id.

public sealed record StoreLockOwner : IEquatable<StoreLockOwner>
Inheritance
StoreLockOwner
Implements
Inherited Members

Properties

AcquiredAtMs

public ulong AcquiredAtMs { get; init; }

Property Value

ulong

Host

public string Host { get; init; }

Property Value

string

Pid

public uint Pid { get; init; }

Property Value

uint

PidNamespace

public string PidNamespace { get; init; }

Property Value

string

Program

public string Program { get; init; }

Property Value

string

StartTime

public string StartTime { get; init; }

Property Value

string

Token

public string Token { get; init; }

Property Value

string

Methods

Current(string)

The record this process writes when it takes a lock.

public static StoreLockOwner Current(string token)

Parameters

token string

Returns

StoreLockOwner

CurrentPidNamespace()

The PID namespace of this process (Linux), so that a container does not judge the process ids of another; empty elsewhere.

public static string CurrentPidNamespace()

Returns

string

Describe()

One line for messages: every known field, then whether it still runs.

public string Describe()

Returns

string

HostName()

The name of this host as the Rust and JavaScript clink read it: gethostname on Unix, COMPUTERNAME on Windows.

public static string HostName()

Returns

string

Liveness()

Whether the owner still runs. Only an owner on this host and in this PID namespace can be judged; a reused process id is told apart by its start time where the system reports one.

public StoreLockLiveness Liveness()

Returns

StoreLockLiveness

Liveness(Func<uint, bool>)

Liveness() with the process probe given.

public StoreLockLiveness Liveness(Func<uint, bool> processAlive)

Parameters

processAlive Func<uint, bool>

Returns

StoreLockLiveness

Parse(string?)

Reads a record; null unless it names a process id. Unknown keys are ignored so that later versions can add fields.

public static StoreLockOwner? Parse(string? text)

Parameters

text string

Returns

StoreLockOwner

ProcessStartTime(uint)

When pid started, in clock ticks since boot (Linux); null elsewhere or when the process does not exist.

public static string? ProcessStartTime(uint pid)

Parameters

pid uint

Returns

string

StartTimeOfStat(string)

The starttime of a /proc/<pid>/stat line. The command name in parentheses may hold spaces; the fields after it start with the state (field 3), so starttime (field 22) is the 20th.

public static string? StartTimeOfStat(string stat)

Parameters

stat string

Returns

string

ToRecord()

The key=value lines of the record.

public string ToRecord()

Returns

string

UniqueToken()

<pid>.<random>: a token no other process, nor another call in this one, is likely to share.

public static string UniqueToken()

Returns

string