mirror of https://github.com/voidlizard/hbs2
subscribe lwwref
This commit is contained in:
parent
b6c85789b9
commit
97521d4577
|
@ -160,13 +160,17 @@ export key refs = do
|
|||
reflog <- asks _refLogAPI
|
||||
ip <- asks _progress
|
||||
|
||||
subscribeLWWRef key
|
||||
|
||||
lww@LWWBlockData{..} <- waitOrInitLWWRef
|
||||
|
||||
let puk0 = fromLwwRefKey key
|
||||
|
||||
debug $ red $ pretty $ AsBase58 lwwRefLogPubKey
|
||||
|
||||
(sk0,pk0) <- liftIO $ runKeymanClient do
|
||||
creds <- loadCredentials lwwRefLogPubKey
|
||||
>>= orThrowUser "can't load credentials"
|
||||
creds <- loadCredentials puk0
|
||||
>>= orThrowUser ("can't load credentials" <+> pretty (AsBase58 puk0))
|
||||
pure ( view peerSignSk creds, view peerSignPk creds )
|
||||
|
||||
(puk,sk) <- derivedKey @HBS2Basic @'Sign lwwRefSeed sk0
|
||||
|
|
|
@ -72,6 +72,8 @@ importRepoWait lwwKey = do
|
|||
|
||||
meet <- newTVarIO (mempty :: HashMap HashRef Int)
|
||||
|
||||
subscribeLWWRef lwwKey
|
||||
|
||||
flip fix (IWaitLWWBlock 20) $ \next -> \case
|
||||
|
||||
IWaitLWWBlock w | w <= 0 -> do
|
||||
|
@ -86,9 +88,8 @@ importRepoWait lwwKey = do
|
|||
pause @'Seconds 2
|
||||
next (IWaitLWWBlock (pred w))
|
||||
|
||||
Just blk -> do
|
||||
error "FOUND SHIT!"
|
||||
pure ()
|
||||
Just (LWWBlockData{..}) -> do
|
||||
next (IWaitRefLog 20 lwwRefLogPubKey)
|
||||
|
||||
IWaitRefLog w puk | w <= 0 -> do
|
||||
throwIO ImportRefLogNotFound
|
||||
|
|
|
@ -3,6 +3,7 @@ module HBS2.Git.Client.RefLog where
|
|||
import HBS2.Git.Client.Prelude
|
||||
import HBS2.Git.Client.App.Types
|
||||
import HBS2.Git.Data.RefLog
|
||||
import HBS2.Git.Data.LWWBlock
|
||||
|
||||
data RefLogRequestTimeout = RefLogRequestTimeout
|
||||
deriving (Show,Typeable)
|
||||
|
@ -20,6 +21,11 @@ subscribeRefLog puk = do
|
|||
void $ callService @RpcPollAdd api (puk, "reflog", 13)
|
||||
|
||||
|
||||
subscribeLWWRef :: (GitPerks m, MonadReader GitEnv m) => LWWRefKey HBS2Basic -> m ()
|
||||
subscribeLWWRef puk = do
|
||||
api <- asks _peerAPI
|
||||
void $ callService @RpcPollAdd api (fromLwwRefKey puk, "lwwref", 17)
|
||||
|
||||
getRefLogMerkle :: (GitPerks m, MonadReader GitEnv m) => RefLogId -> m (Maybe HashRef)
|
||||
getRefLogMerkle puk = do
|
||||
|
||||
|
|
Loading…
Reference in New Issue