PROTOCOLS
Bus
Defined in fuchsia.netemul.sync/sync.fidl
Represents a named bus: a bus is a broadcast pub/sub network that distributes Events. Events are not stored, only forwarded to attached clients.
EnsurePublish
Publishes data on bus and only returns when data has been dispatched. Use this if you need guarantees that the data was broadcast before continuing. Note that this ensures that the data will be published to all listening clients, but it cannot guarantee that all clients will have observed the event before it returns.
Request
Name | Type |
---|---|
data |
Event
|
Response
Name | Type |
---|
GetClients
Get list of named clients.
Request
Name | Type |
---|
Response
Name | Type |
---|---|
clients |
vector<string>
|
OnBusData
Notifies client of new event.
Response
Name | Type |
---|---|
data |
Event
|
OnClientAttached
Notifies a client is now attached.
Upon subscribing to a bus, a client will always receive an OnClientAttached
event for each
client present on the bus at the moment it joined.
Response
Name | Type |
---|---|
client |
string
|
OnClientDetached
Notifies a client was detached.
Response
Name | Type |
---|---|
client |
string
|
Publish
Publishes event on the bus.
Request
Name | Type |
---|---|
data |
Event
|
WaitForClients
Waits for up to timeout
(nsec) for all the clients in clients
.
Returns true if all clients are present on the bus before timeout expired.
If result
is false, absent
will contain the entries in clients
that still weren't
present on the bus when the timout expired.
Use timeout
<= 0 for indefinite wait.
Request
Name | Type |
---|---|
clients |
vector<string>
|
timeout |
zx/duration
|
Response
Name | Type |
---|---|
result |
bool
|
absent |
vector<string>?
|
WaitForEvent
Waits for up to timeout
(nsec) for an event that matches data
.
Event equality is performed by comparing all set fields in data
.
Returns true if event was received before timeout expired.
Use timeout
<= 0 for indefinite wait.
Request
Name | Type |
---|---|
data |
Event
|
timeout |
zx/duration
|
Response
Name | Type |
---|---|
result |
bool
|
SyncManager
Defined in fuchsia.netemul.sync/sync.fidl
The SyncManager is the entry point to attach a client to a bus or use other synchronization primitives. The client's 'ticket' to remain on the bus is the channel obtained through the 'BusSubscribe' call.
BusSubscribe
Subscribes to bus 'busName' with a given client name. Duplicate client names are disallowed and will cause the request to return unfulfilled.
Request
Name | Type |
---|---|
bus_name |
string
|
client_name |
string
|
bus |
request<Bus>
|
WaitForBarrierThreshold
Waits on a named counter barrier with name barrierName
.
Functon will return true if the number of waits pending on the barrier matches or exceeds
threshold
before timeout
(nsec) expires.
Use timeout
<= 0 for indefinite wait.
Request
Name | Type |
---|---|
barrier_name |
string
|
threshold |
uint32
|
timeout |
zx/duration
|
Response
Name | Type |
---|---|
result |
bool
|
STRUCTS
TABLES
Event
Defined in fuchsia.netemul.sync/sync.fidl
Simple data structure passed on netemul bus.
Ordinal | Name | Type | Description |
---|---|---|---|
1 | code |
int32
|
User-defined event code. |
2 | message |
string
|
string:MAX message. |
3 | arguments |
vector<uint8>
|
serialized arguments. |