Address¶
casty.ActorAddress
dataclass
¶
Immutable address identifying an actor within a Casty system.
Uses a URI scheme: casty://system@host:port/path for remote actors
and casty://system/path for local actors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
system
|
str
|
Name of the actor system. |
required |
path
|
str
|
Slash-prefixed path of the actor within the system. |
required |
host
|
str or None
|
Hostname for remote addresses, |
None
|
port
|
int or None
|
TCP port for remote addresses, |
None
|
Examples:
>>> local = ActorAddress(system="my-system", path="/user/counter")
>>> local.is_local
True
>>> local.to_uri()
'casty://my-system/user/counter'
>>> remote = ActorAddress(system="cluster", path="/user/worker", host="10.0.0.1", port=25520)
>>> remote.to_uri()
'casty://cluster@10.0.0.1:25520/user/worker'
system
instance-attribute
¶
path
instance-attribute
¶
host = None
class-attribute
instance-attribute
¶
port = None
class-attribute
instance-attribute
¶
node_id = None
class-attribute
instance-attribute
¶
is_local
property
¶
to_uri()
¶
from_uri(uri)
staticmethod
¶
Parse a casty:// URI into an ActorAddress.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
uri
|
str
|
A URI of the form |
required |
Returns:
| Type | Description |
|---|---|
ActorAddress
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If uri does not match either pattern. |
Examples: