-
Notifications
You must be signed in to change notification settings - Fork 17
ProcessId
Paul Louth edited this page Feb 20, 2017
·
1 revision
A process ID is simply a wrapped string that looks like a file-path:
/root/user/my-process
It is the simplest way of referring to another Process and can be used with all functions of the Process system. So for example to send a message to a process you would call:
ProcessId pid = "/root/user/my-process"
tell(pid, "hello");
The ProcessId
has lots of helpers to make it easy to construct valid IDs.
Property or Method | Behaviour | Example | Was | Becomes |
---|---|---|---|---|
[name] |
Create a child ProcessId
|
var child = parent["child"] |
/parent |
/parent/child |
Parent() |
Step up to the parent | var parent = child.Parent() |
/parent/child |
/parent |
GetName() |
Get the leaf ProcessName
|
var name = pid.GetName() |
/parent/child |
"child" |
Skip(num) |
Remove the first num names |
var pid = pid.Skip(2) |
/a/b/c |
/c |
Take(num) |
Drop all after the next num names |
var pid = pid.Take(2) |
/a/b/c |
/a/b |
Head() |
Take the first name | var pid = pid.Head() |
/a/b/c |
/a |
Tail() |
Drop all after the first name | var pid = pid.Tail() |
/a/b/c |
/b/c |
Count() |
Returns the number of names | var pid = pid.Count() |
/a/b/c |
3 |
Append(pid) |
Join two ProcessIds together | var pid = pid.Append('/c/d') |
/a/b |
a/b/c/d |
Process.Top |
The root | var pid = Process.Top["root"]["user"] |
n/a | /root/user |
NOTE: A ProcessId
is made up of a series of ProcessName
values. A ProcessName
can also represent a set of ProcessId
values. This allows a for a ProcessId
that looks like so:
/root/user/[/proc,/something]/another
This type of ProcessId
is used by dispatchers to represent multiple Process endpoints in a single ProcessId
and to allow for any functionality that uses a ProcessId
to work with 0-n processes with the same API.