bap_connection_publication.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #pragma once
  2. #include <cstdint>
  3. #include "../internal.h"
  4. #include "internal.h"
  5. #include "queuez/queuez_state_validation.h"
  6. #include "transactions/definition.h"
  7. namespace sunrise::server::bap::encrypted {
  8. /** Connection fields one request may publish, captured before its transaction commits. */
  9. struct ConnectionFields {
  10. middleware::bap::activity_message::patch_epoch::PatchEpoch patchEpoch{};
  11. activity_message::JoinIngressDiagnostic joinIngress{};
  12. /** The join carries the only member key the client ever sends. */
  13. std::uint64_t joinMemberKey{};
  14. /** The join also names the character the player signed in on. */
  15. std::uint64_t joinCharacterSoid{};
  16. bool retainsPatchEpoch{};
  17. /** Set when this transaction commits one client-authored type-23 identity. */
  18. bool receivesClientIdentity{};
  19. /** Set by a join or a transition-token change, which are the client starting a load. */
  20. bool opensTransitionWindow{};
  21. /** Set by a join alone, which re-arms the roster warm-up the new container needs. */
  22. bool joinsActivity{};
  23. };
  24. /** Reserves one process-lifetime ActivityClient generation without wrapping. */
  25. [[nodiscard]] bool reserve_activity_binding_generation(std::uint64_t& generation) noexcept;
  26. /**
  27. * Captures the connection fields one service outcome carries.
  28. * @param outcome Prepared outcome, still holding its uncommitted mutations.
  29. * @return The fields to publish once the transaction commits.
  30. */
  31. [[nodiscard]] ConnectionFields connection_fields(const ServiceOutcome& outcome) noexcept;
  32. /**
  33. * Publishes the captured connection fields after a successful commit.
  34. * @param session Connection-owned activity binding and epoch.
  35. * @param publication Committed State bindings.
  36. * @param fields Fields captured before the commit.
  37. */
  38. void publish_connection_fields(Session& session,
  39. const transactions::Publication& publication,
  40. const ConnectionFields& fields) noexcept;
  41. /** Records one membership body after its complete frame reaches the transport caller. */
  42. void note_activity_membership_delivery(Session& session) noexcept;
  43. /** Stages one body's retained host directory until its frame is published or discarded. */
  44. void stage_activity_advertisement(Session& session, const AdvertisementRetains& retains) noexcept;
  45. /** Publishes the staged directory's retains and releases the previous delivered ones. */
  46. void commit_staged_advertisement(Session& session) noexcept;
  47. /** Releases a retained directory that never reached the caller. */
  48. void discard_staged_advertisement(Session& session) noexcept;
  49. /** Releases every exact activity binding and advertisement owned by one BAP link. */
  50. void release_activity_connection(Session& session) noexcept;
  51. /**
  52. * Arms the owed Family-4 and banner re-pushes when the queuez publication asks for them.
  53. * @param session Connection-owned re-push timers.
  54. * @param queuezPublication Staged queuez publication.
  55. */
  56. void arm_repushes(Session& session, const queuez::StagedPublication& queuezPublication) noexcept;
  57. } // namespace sunrise::server::bap::encrypted