mirror of https://github.com/voidlizard/hbs2
wip
This commit is contained in:
parent
6567b39307
commit
0bd163bc25
|
@ -59,7 +59,23 @@ metaFromSyntax syn =
|
|||
metaDataEntries :: forall c m . (c ~ C, IsContext c, MonadUnliftIO m) => MakeDictM c m ()
|
||||
metaDataEntries = do
|
||||
|
||||
entry $ bindMatch "hbs2:tree:metadata:update-gk" $ \case
|
||||
brief "update group key for tree"
|
||||
$ args [arg "string" "tree", arg "list" "update-ops"]
|
||||
$ desc ( "update-ops is a list of pairs, like" <> line
|
||||
<> indent 4 ( parens ("list"
|
||||
<+> indent 2 (vcat [ parens "remove . PUBLIC-KEY-ID"
|
||||
, parens "add . PUBLIC-KEY-ID"
|
||||
]))))
|
||||
$ returns "string" "new-tree-hash"
|
||||
$ examples [qc|
|
||||
|
||||
(define gk (hbs2:groupkey:load 6XJGpJszP6f68fmhF17AtJ9PTgE7BKk8RMBHWQ2rXu6N))
|
||||
|
||||
(hbs2:groupkey:update gk
|
||||
(list (remove . CcRDzezX1XQdPxRMuMKzJkfHFB4yG7vGJeTYvScKkbP8)
|
||||
(add . EiwWxY3xwTfnLKJdzzxNMZgA2ZvYAZd9e8B8pFeCtnrn)))
|
||||
|]
|
||||
$ entry $ bindMatch "hbs2:tree:metadata:update-gk" $ \case
|
||||
[StringLike tree, ListVal ins] -> do
|
||||
|
||||
ha <- orThrowUser "invalid hash" (fromStringMay tree)
|
||||
|
|
|
@ -165,18 +165,6 @@ reflogEntries = do
|
|||
|
||||
_ -> throwIO (BadFormException @C nil)
|
||||
|
||||
brief "list transactions from reflog"
|
||||
$ entry $ bindMatch "hbs2:reflog:tx:parse" $ \case
|
||||
[StringLike hash] -> do
|
||||
|
||||
sto <- ContT withPeerStorage
|
||||
hashref <- orThrowUser "bad hash" (fromStringMay @HashRef hash)
|
||||
void $ hasBlock sto (fromHashRef hashref) `orDie` "no block"
|
||||
let sref = AnnotatedHashRef Nothing hashref
|
||||
rlu <- lift $ mkRefLogUpdateFrom reflog (pure $ LBS.toStrict $ serialise sref) <&> serialise
|
||||
pure $ mkForm "blob" [mkStr (LBS8.unpack rlu)]
|
||||
|
||||
_ -> throwIO (BadFormException @C nil)
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue