diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Test.hs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Test.hs b/src/Test.hs index 2a8e0df..df36556 100644 --- a/src/Test.hs +++ b/src/Test.hs @@ -33,6 +33,7 @@ import Service import State import Storage import Storage.Internal (unsafeStoreRawBytes) +import Storage.Merge import Sync @@ -177,6 +178,7 @@ type Command = CommandM () commands :: [(Text, Command)] commands = map (T.pack *** id) [ ("store", cmdStore) + , ("stored-roots", cmdStoredRoots) , ("create-identity", cmdCreateIdentity) , ("start-server", cmdStartServer) , ("watch-local-identity", cmdWatchLocalIdentity) @@ -198,6 +200,13 @@ cmdStore = do ref <- liftIO $ unsafeStoreRawBytes st $ BL.fromChunks [encodeUtf8 otype, BC.singleton ' ', BC.pack (show $ B.length cnt), BC.singleton '\n', cnt] cmdOut $ "store-done " ++ show (refDigest ref) +cmdStoredRoots :: Command +cmdStoredRoots = do + st <- asks tiStorage + [tref] <- asks tiParams + Just ref <- liftIO $ readRef st (encodeUtf8 tref) + cmdOut $ "stored-roots" ++ concatMap ((' ':) . show . refDigest . storedRef) (storedRoots $ wrappedLoad @Object ref) + cmdCreateIdentity :: Command cmdCreateIdentity = do st <- asks tiStorage |