ChannelService.vala 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. namespace Statum {
  2. /**
  3. * One-way realtime push service for slot updates.
  4. *
  5. * {@link StateService} injects a {@link ChannelService} (the singleton
  6. * {@link ChannelEndpoint}) so that every state mutation auto-pushes the
  7. * resulting frame to any channels subscribed to that slot. The dependency is
  8. * deliberately one-way: a {@link ChannelService} never injects
  9. * {@link StateService}, so there is no DI cycle.
  10. *
  11. * The push is a no-op when no stream is subscribed to `key`, so selective
  12. * fan-out emerges naturally from subscriptions. The low-level
  13. * {@link ChannelEndpoint.push_set}/{@link ChannelEndpoint.push_clear} remain
  14. * callable directly for advanced cases.
  15. */
  16. public interface ChannelService : Object {
  17. /**
  18. * Pushes a `set` event carrying `frame_json` to every channel subscribed
  19. * to `key`. No-op when nothing is subscribed.
  20. */
  21. public abstract async void push_set(string key, string frame_json);
  22. /**
  23. * Pushes a `clear` event for `key` to every channel subscribed to it.
  24. * No-op when nothing is subscribed.
  25. */
  26. public abstract async void push_clear(string key);
  27. }
  28. }