fabaccess-bffh/runtime/console-api/schema/resources.capnp

99 lines
3.0 KiB
Cap'n Proto
Raw Normal View History

2023-05-05 13:41:31 +02:00
@0xd75a34c00d06ab36;
using Common = import "common.capnp";
struct Update {
newResource @0 :List(Resource);
# List of new resources that were created since the last Update was sent
statsUpdate @1 :Common.IntMap(Stats);
# All resource stats that have changed since the last update
newPollOps @2 :List(PollOp);
# List of all new poll ops that have been invoked on resources since the last update
droppedEvents @3 :UInt64;
# Count of how many resource events were not recorded because the applications event buffer was
# at capacity.
#
# If everything is working normally, this is 0. If it is not that may inidcate that some data is
# missing from this update and it may be necessary to increase the number of events buffered by
# the application to ensure that data loss is avoided.
#
# If the application's instrumentation ensures reliable delivery of events, this will alway be 0
}
struct Resource {
id @0 :Common.Id;
# The resource's ID.
#
# This uniquely identifies this resource across all *currently live* resoures.
metadata @1 :Common.MetaId;
# Numeric ID of the resource's Metadata.
concreteType @2 :Text;
# Name of the concrete Rust type of this resource
kind @3 :Kind;
# The kind of this resource
struct Kind {
union {
2023-05-05 14:14:33 +02:00
known @0 :WellKnown;
2023-05-05 13:41:31 +02:00
other @1 :Text;
}
enum WellKnown {
timer @0;
}
}
location @4 :Common.Location;
# The location in code where this resource was created
parentResourceId @5 :Common.Id;
# ID of the parent resource
internal @6 :Bool;
# Wether or not this resource is an internal component of another resource
}
struct Stats {
# Task runtime stats of a resource
createdAt @0 :Common.Timestamp;
# Timestamp of when the resource was created
droppedAt @1 :Common.Timestamp;
# Timestamp of when the resource was dropped
attributes @2 :List(Common.Attribute);
# State attributes of the resource. These are dependent on the type of the resource. For example
# a timer resource will have a duration, while a semaphore resource may have permits as an
# attribute. These values may change over time as the state of the resource changes. Therefore
# they live in the runtime stats rather than the static data describing the resource
}
struct PollOp {
metadata @1 :Common.MetaId;
# Numeric ID of the op's Metadata
#
# This identifies the `Metadata` that describes the `tracing` span corresponding to this op. The
# metadata for this ID will have been sent in a prior `RegisterMetadata` message.
resource @0 :Common.Id;
# The resource's ID
name @2 :Text;
# Name of this op (e.g. poll_elapsed, new_timeout, reset, etc.)
task @3 :Common.Id;
# The ID of the task context that this poll op has been called from
asyncOp @4 :Common.Id;
# The ID of the async op that this poll op is part of
ready @5 :Bool;
# Wheter this poll op has return with `Ready` or not.
}