icdevs / ICEventsWG

WG for developing an Event System(pub/sub) on the Internet Computer
3 stars 3 forks source link

Vote Required: General Consensus on Including Wild Cards at the Standard Level #33

Closed skilesare closed 5 months ago

skilesare commented 6 months ago

https://github.com/icdevs/ICEventsWG/issues/24

General Consensus has been reached that we should include wild cards in subscriptions at a protocol standard level, but that implementations MAY ignore these due to technical limitations.

Subscription Info

Subscription Registration Namespaces

Implementations MAY support wildcards for subscriptions. For example, a subscription to *.icrc1.transfer might register a subscriber to any events that produce a standard icrc1.transfer event regardless of the canister that emitted it. The subscription canister must take technical limitations into account when making these subscriptions as the canister may overload itself. The wild-card language that is used is purposely left out of this standard and must be defined by the implementation of the events system.

Filtering records

A subscriber MAY provide a filter in textual representation to filter out certain records for the subscription. Implementations SHOULD continue to develop CandyPath that can filter through ICRC-16 values, but the implementation MAY use a text query language of their own choosing.

Skipping records

A subscriber MAY provide a skip parameter to ask the canister to skip broadcasting for either bandwidth or distribution reasons. The skip parameter is a tuple of the mod and optional offset (nat, opt nat). If the mod is set then the subscriber should only receive a message if the mod of the value provided is 0. This can be offset for partitioning by using the optional partition variable. By using this pattern a subscriber set can ensure that all messages make it to a set of subscribers with a distributed message set.

type Skip = record {nat; opt nat};

type SubscriptionRegistration {
  namespace: Text;
  config: [ICRC16Map];
  filter: ?Text; 
  skip: ?Skip;
  stopped: Bool;
};
skilesare commented 5 months ago

General Concensus