fuchsia.netemul.sync

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.

Publish

Publishes event on the bus.

Request

NameType
data Event

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

NameType
data Event

Response

NameType

OnBusData

Notifies client of new event.

Response

NameType
data Event

GetClients

Get list of named clients.

Request

NameType

Response

NameType
clients vector<string>

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

NameType
client string

OnClientDetached

Notifies a client was detached.

Response

NameType
client string

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

NameType
clients vector<string>
timeout zx/duration

Response

NameType
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

NameType
data Event
timeout zx/duration

Response

NameType
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

NameType
busName string
clientName 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

NameType
barrierName string
threshold uint32
timeout zx/duration

Response

NameType
result bool

STRUCTS

TABLES

Event

Defined in fuchsia.netemul.sync/sync.fidl

Simple data structure passed on netemul bus.

OrdinalNameTypeDescription
1 code int32

User-defined event code.

2 message string

string message.

3 arguments vector<uint8>

serialized arguments.