This commit is contained in:
Dmitry Zuikov 2024-08-01 22:19:03 +03:00
parent 6567b39307
commit 0bd163bc25
2 changed files with 36 additions and 32 deletions

View File

@ -59,7 +59,23 @@ metaFromSyntax syn =
metaDataEntries :: forall c m . (c ~ C, IsContext c, MonadUnliftIO m) => MakeDictM c m () metaDataEntries :: forall c m . (c ~ C, IsContext c, MonadUnliftIO m) => MakeDictM c m ()
metaDataEntries = do 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 [StringLike tree, ListVal ins] -> do
ha <- orThrowUser "invalid hash" (fromStringMay tree) ha <- orThrowUser "invalid hash" (fromStringMay tree)

View File

@ -165,18 +165,6 @@ reflogEntries = do
_ -> throwIO (BadFormException @C nil) _ -> 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)