Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- data BackendNotification = BackendNotification {}
- fedNotifToBackendNotif :: forall {k} (tag :: k). (HasFedPath tag, HasVersionRange tag, KnownComponent (NotificationComponent k), ToJSON (Payload tag)) => RequestId -> Domain -> Payload tag -> BackendNotification
- newtype PayloadBundle (c :: Component) = PayloadBundle {}
- toBundle :: forall {k} (tag :: k). (HasFedPath tag, HasVersionRange tag, KnownComponent (NotificationComponent k), ToJSON (Payload tag)) => RequestId -> Domain -> Payload tag -> PayloadBundle (NotificationComponent k)
- makeBundle :: forall {k} (tag :: k) c. (HasFedPath tag, HasVersionRange tag, KnownComponent (NotificationComponent k), ToJSON (Payload tag), c ~ NotificationComponent k) => Payload tag -> FedQueueClient c (PayloadBundle c)
- type BackendNotificationAPI = Capture "name" Text :> (ReqBody '[JSON] RawJson :> Post '[JSON] EmptyResponse)
- sendNotification :: FederatorClientVersionedEnv -> Component -> Text -> RawJson -> IO (Either FederatorClientError ())
- enqueue :: Channel -> RequestId -> Domain -> Domain -> DeliveryMode -> FedQueueClient c a -> IO a
- routingKey :: Text -> Text
- type DefederationDomain = Domain
- ensureQueue :: Channel -> Text -> IO ()
- newtype FedQueueClient c a = FedQueueClient (ReaderT FedQueueEnv IO a)
- data FedQueueEnv = FedQueueEnv {}
- data EnqueueError = EnqueueError String
Documentation
data BackendNotification Source #
NOTE: Stored in RabbitMQ, any changes to serialization of this object could cause notifications to get lost.
BackendNotification | |
|
Instances
FromJSON BackendNotification Source # | |
Defined in Wire.API.Federation.BackendNotifications parseJSON :: Value -> Parser BackendNotification Source # parseJSONList :: Value -> Parser [BackendNotification] Source # | |
ToJSON BackendNotification Source # | |
Defined in Wire.API.Federation.BackendNotifications toJSON :: BackendNotification -> Value Source # toEncoding :: BackendNotification -> Encoding Source # toJSONList :: [BackendNotification] -> Value Source # toEncodingList :: [BackendNotification] -> Encoding Source # | |
Show BackendNotification Source # | |
Defined in Wire.API.Federation.BackendNotifications showsPrec :: Int -> BackendNotification -> ShowS # show :: BackendNotification -> String # showList :: [BackendNotification] -> ShowS # | |
Eq BackendNotification Source # | |
Defined in Wire.API.Federation.BackendNotifications (==) :: BackendNotification -> BackendNotification -> Bool # (/=) :: BackendNotification -> BackendNotification -> Bool # | |
ToSchema BackendNotification Source # | |
fedNotifToBackendNotif :: forall {k} (tag :: k). (HasFedPath tag, HasVersionRange tag, KnownComponent (NotificationComponent k), ToJSON (Payload tag)) => RequestId -> Domain -> Payload tag -> BackendNotification Source #
Convert a federation endpoint to a backend notification to be enqueued to a RabbitMQ queue.
newtype PayloadBundle (c :: Component) Source #
Instances
FromJSON (PayloadBundle c) Source # | |
Defined in Wire.API.Federation.BackendNotifications parseJSON :: Value -> Parser (PayloadBundle c) Source # parseJSONList :: Value -> Parser [PayloadBundle c] Source # | |
ToJSON (PayloadBundle c) Source # | |
Defined in Wire.API.Federation.BackendNotifications toJSON :: PayloadBundle c -> Value Source # toEncoding :: PayloadBundle c -> Encoding Source # toJSONList :: [PayloadBundle c] -> Value Source # toEncodingList :: [PayloadBundle c] -> Encoding Source # | |
Semigroup (PayloadBundle c) Source # | |
Defined in Wire.API.Federation.BackendNotifications (<>) :: PayloadBundle c -> PayloadBundle c -> PayloadBundle c # sconcat :: NonEmpty (PayloadBundle c) -> PayloadBundle c # stimes :: Integral b => b -> PayloadBundle c -> PayloadBundle c # | |
ToSchema (PayloadBundle c) Source # | |
Defined in Wire.API.Federation.BackendNotifications |
:: forall {k} (tag :: k). (HasFedPath tag, HasVersionRange tag, KnownComponent (NotificationComponent k), ToJSON (Payload tag)) | |
=> RequestId | |
-> Domain | The origin domain |
-> Payload tag | |
-> PayloadBundle (NotificationComponent k) |
makeBundle :: forall {k} (tag :: k) c. (HasFedPath tag, HasVersionRange tag, KnownComponent (NotificationComponent k), ToJSON (Payload tag), c ~ NotificationComponent k) => Payload tag -> FedQueueClient c (PayloadBundle c) Source #
type BackendNotificationAPI = Capture "name" Text :> (ReqBody '[JSON] RawJson :> Post '[JSON] EmptyResponse) Source #
sendNotification :: FederatorClientVersionedEnv -> Component -> Text -> RawJson -> IO (Either FederatorClientError ()) Source #
enqueue :: Channel -> RequestId -> Domain -> Domain -> DeliveryMode -> FedQueueClient c a -> IO a Source #
routingKey :: Text -> Text Source #
type DefederationDomain = Domain Source #
ensureQueue :: Channel -> Text -> IO () Source #
If you ever change this function and modify queue parameters, know that it will start failing in the next release! So be prepared to write migrations.
Internal machinery
newtype FedQueueClient c a Source #
Reads a servant request and puts the information in relevant RabbitMQ queue. Perhaps none of this should be servant code anymore. But it is here to allow smooth transition to RabbitMQ based notification pushing.
Use fedQueueClient
to create an action and pass it
to enqueue
Instances
data FedQueueEnv Source #
FedQueueEnv | |
|
Instances
MonadReader FedQueueEnv (FedQueueClient c) Source # | |
Defined in Wire.API.Federation.BackendNotifications ask :: FedQueueClient c FedQueueEnv # local :: (FedQueueEnv -> FedQueueEnv) -> FedQueueClient c a -> FedQueueClient c a # reader :: (FedQueueEnv -> a) -> FedQueueClient c a # |
data EnqueueError Source #
Instances
Exception EnqueueError Source # | |
Defined in Wire.API.Federation.BackendNotifications | |
Show EnqueueError Source # | |
Defined in Wire.API.Federation.BackendNotifications showsPrec :: Int -> EnqueueError -> ShowS # show :: EnqueueError -> String # showList :: [EnqueueError] -> ShowS # |