mirror of https://github.com/voidlizard/hbs2
wip, gossip on policy update
This commit is contained in:
parent
0c80d9b676
commit
1739669e47
|
@ -168,7 +168,7 @@ instance ( s ~ Encryption e, e ~ L4Proto
|
|||
Right{} -> pure $ Right ()
|
||||
Left{} -> pure $ Left (MailboxCreateFailed "database operation")
|
||||
|
||||
mailboxSetPolicy MailboxProtoWorker{..} sbox = do
|
||||
mailboxSetPolicy me@MailboxProtoWorker{..} sbox = do
|
||||
-- check policy version
|
||||
-- check policy has peers
|
||||
-- write policy block
|
||||
|
@ -211,7 +211,17 @@ instance ( s ~ Encryption e, e ~ L4Proto
|
|||
on conflict (mailbox) do update set hash = excluded.hash
|
||||
|] (MailboxRefKey @s who, PolicyHash what)
|
||||
|
||||
-- TODO: ASAP-gossip-new-state
|
||||
|
||||
void $ runMaybeT do
|
||||
msp <- mailboxGetStatus me (MailboxRefKey @s who)
|
||||
>>= toMPlus
|
||||
>>= toMPlus
|
||||
|
||||
creds <- mailboxGetCredentials @s me
|
||||
let box = makeSignedBox @s (view peerSignPk creds) (view peerSignSk creds) msp
|
||||
|
||||
liftIO $ withPeerM mpwPeerEnv do
|
||||
gossip (MailBoxProtoV1 @s @e (MailboxStatus box))
|
||||
|
||||
pure what
|
||||
|
||||
|
|
|
@ -29,8 +29,9 @@ import Lens.Micro.Platform
|
|||
import Control.Monad.Reader
|
||||
import Control.Monad.Trans.Maybe
|
||||
|
||||
type ForMailboxRPC m = (MonadIO m, HasRpcContext MailboxAPI RPC2Context m)
|
||||
|
||||
type ForMailboxRPC m = ( MonadIO m
|
||||
, HasRpcContext MailboxAPI RPC2Context m
|
||||
)
|
||||
|
||||
instance (MonadIO m) => HandleMethod m RpcMailboxPoke where
|
||||
|
||||
|
|
|
@ -71,7 +71,6 @@ data MailBoxProtoMessage s e =
|
|||
SendMessage (Message s) -- already has signed box
|
||||
| CheckMailbox (Maybe Word64) (MailboxKey s)
|
||||
| MailboxStatus (SignedBox (MailBoxStatusPayload s) s) -- signed by peer
|
||||
| SetPolicy (SignedBox (SetPolicyPayload s) s)
|
||||
| DeleteMessages (SignedBox (DeleteMessagesPayload s) s)
|
||||
deriving stock (Generic)
|
||||
|
||||
|
@ -340,9 +339,6 @@ mailboxProto inner adapter mess = deferred @p do
|
|||
|
||||
void $ mailboxAcceptStatus adapter (MailboxRefKey mbsMailboxKey) who content
|
||||
|
||||
SetPolicy{} -> do
|
||||
none
|
||||
|
||||
DeleteMessages{} -> do
|
||||
none
|
||||
|
||||
|
|
Loading…
Reference in New Issue