Event¶
Canonical path: o6.server.Event
Root shortcut: o6.Event
Event
dataclass
¶
Bases: MutableMapping[QualifiedName | str, Any]
Reusable server-side event draft.
Construct with o6.Event(server, ...) and trigger as often as needed.
Construction does not access the address space or emit an event.
As a mutable mapping of event fields, it supports dict(event),
len(event), del event[key], and iteration. The attributes below can be
reassigned between triggers.
Field keys are event-filter path strings such as "/BatchId", or
QualifiedName values when a namespace matters.
When eventType is None, each trigger() resolves it from
eventInstance's type if supplied, otherwise from source's declared
GeneratesEvent target. The draft itself keeps eventType=None.
See Events.
Attributes¶
Functions¶
__init__
¶
__init__(
_server,
eventType=None,
source=(lambda: ns0.instances.server)(),
message="",
severity=1,
fields=dict(),
eventInstance=None,
)
trigger
¶
Emit this event once and return its EventId.
Field values are resolved from fields first, then from
eventInstance, then from the BaseEventType defaults.
Returns:
| Type | Description |
|---|---|
MaybeAwaitable[bytes]
|
The generated 16-byte EventId. |
Raises:
| Type | Description |
|---|---|
ValueError
|
|
TypeError
|
|
StatusCodeError
|
Reading the instance or emitting the event failed. |