mirror of https://github.com/voidlizard/hbs2
wip
This commit is contained in:
parent
191bdbcf25
commit
85e0d4b99a
|
@ -28,9 +28,10 @@ import HBS2.Git.Web.Html.Root
|
||||||
import HBS2.Git.Web.Html.Issue
|
import HBS2.Git.Web.Html.Issue
|
||||||
import HBS2.Git.Web.Html.Repo
|
import HBS2.Git.Web.Html.Repo
|
||||||
import HBS2.Git.Web.Html.Fixme
|
import HBS2.Git.Web.Html.Fixme
|
||||||
|
|
||||||
import HBS2.Peer.CLI.Detect
|
import HBS2.Peer.CLI.Detect
|
||||||
|
|
||||||
|
import DBPipe.SQLite
|
||||||
|
|
||||||
import Data.Config.Suckless.Script
|
import Data.Config.Suckless.Script
|
||||||
|
|
||||||
import Lucid (renderTextT,HtmlT(..),toHtml)
|
import Lucid (renderTextT,HtmlT(..),toHtml)
|
||||||
|
@ -142,7 +143,6 @@ runDashBoardM m = do
|
||||||
xdgData <- liftIO $ getXdgDirectory XdgData hbs2_git_dashboard
|
xdgData <- liftIO $ getXdgDirectory XdgData hbs2_git_dashboard
|
||||||
|
|
||||||
let dataDir = xdgData
|
let dataDir = xdgData
|
||||||
let dbFile = xdgData </> "state.db"
|
|
||||||
|
|
||||||
-- FIXME: unix-socket-from-config
|
-- FIXME: unix-socket-from-config
|
||||||
soname <- detectRPC `orDie` "hbs2-peer rpc not found"
|
soname <- detectRPC `orDie` "hbs2-peer rpc not found"
|
||||||
|
@ -191,6 +191,18 @@ runDashBoardM m = do
|
||||||
lwwAPI
|
lwwAPI
|
||||||
sto
|
sto
|
||||||
|
|
||||||
|
void $ ContT $ withAsync do
|
||||||
|
fix \next -> do
|
||||||
|
dbe' <- readTVarIO (_db env)
|
||||||
|
case dbe' of
|
||||||
|
Just dbe -> do
|
||||||
|
notice $ green "Aquired database!"
|
||||||
|
runPipe dbe
|
||||||
|
|
||||||
|
Nothing -> do
|
||||||
|
pause @'Seconds 5
|
||||||
|
next
|
||||||
|
|
||||||
void $ ContT $ withAsync do
|
void $ ContT $ withAsync do
|
||||||
q <- withDashBoardEnv env $ asks _pipeline
|
q <- withDashBoardEnv env $ asks _pipeline
|
||||||
forever do
|
forever do
|
||||||
|
@ -678,6 +690,17 @@ theDict = do
|
||||||
t <- asks _dashBoardIndexIgnoreCaches
|
t <- asks _dashBoardIndexIgnoreCaches
|
||||||
atomically $ writeTVar t False
|
atomically $ writeTVar t False
|
||||||
|
|
||||||
|
entry $ bindMatch "debug:build-commit-index" $ nil_ $ \case
|
||||||
|
[SignPubKeyLike lw] -> lift do
|
||||||
|
buildCommitTreeIndex (LWWRefKey lw)
|
||||||
|
|
||||||
|
_ -> throwIO $ BadFormException @C nil
|
||||||
|
|
||||||
|
-- rs <- selectRepoFixme
|
||||||
|
-- for_ rs $ \(r,f) -> do
|
||||||
|
-- liftIO $ print $ pretty r <+> pretty (AsBase58 f)
|
||||||
|
|
||||||
|
|
||||||
entry $ bindMatch "debug:select-repo-fixme" $ nil_ $ const $ lift do
|
entry $ bindMatch "debug:select-repo-fixme" $ nil_ $ const $ lift do
|
||||||
rs <- selectRepoFixme
|
rs <- selectRepoFixme
|
||||||
for_ rs $ \(r,f) -> do
|
for_ rs $ \(r,f) -> do
|
||||||
|
|
|
@ -769,8 +769,12 @@ buildCommitTreeIndex lww = do
|
||||||
commits <- listCommits
|
commits <- listCommits
|
||||||
env <- ask
|
env <- ask
|
||||||
|
|
||||||
|
ignoreCaches <- getIgnoreCaches
|
||||||
|
|
||||||
for_ commits $ \co -> void $ runMaybeT do
|
for_ commits $ \co -> void $ runMaybeT do
|
||||||
checkCommitProcessed co >>= guard . not
|
done <- checkCommitProcessed co
|
||||||
|
let skip = done && not ignoreCaches
|
||||||
|
guard (not skip)
|
||||||
updateRepoData env co
|
updateRepoData env co
|
||||||
|
|
||||||
updateForks
|
updateForks
|
||||||
|
|
|
@ -81,9 +81,9 @@ updateIndexFromPeer = do
|
||||||
Right hxs -> do
|
Right hxs -> do
|
||||||
for_ hxs $ \htx -> void $ runMaybeT do
|
for_ hxs $ \htx -> void $ runMaybeT do
|
||||||
|
|
||||||
-- done <- lift $ withState $ isProcessed (HashRef $ hashObject @HbSync (serialise (lw,htx)))
|
done <- lift $ withState $ isProcessed (HashRef $ hashObject @HbSync (serialise (lw,htx)))
|
||||||
|
|
||||||
-- guard (not done)
|
guard (not done)
|
||||||
|
|
||||||
getBlock sto (fromHashRef htx) >>= toMPlus
|
getBlock sto (fromHashRef htx) >>= toMPlus
|
||||||
<&> deserialiseOrFail @(RefLogUpdate L4Proto)
|
<&> deserialiseOrFail @(RefLogUpdate L4Proto)
|
||||||
|
@ -105,12 +105,12 @@ updateIndexFromPeer = do
|
||||||
let rlwwseq = RepoLwwSeq (fromIntegral $ lwwSeq wv)
|
let rlwwseq = RepoLwwSeq (fromIntegral $ lwwSeq wv)
|
||||||
insertRepoHead l rlwwseq (RepoRefLog rk) tx rh rhead
|
insertRepoHead l rlwwseq (RepoRefLog rk) tx rh rhead
|
||||||
|
|
||||||
-- insertProcessed (HashRef $ hashObject @HbSync (serialise (l,coerce @_ @HashRef tx)))
|
insertProcessed (HashRef $ hashObject @HbSync (serialise (l,coerce @_ @HashRef tx)))
|
||||||
|
|
||||||
for_ fme $ \f -> do
|
for_ fme $ \f -> do
|
||||||
insertRepoFixme l rlwwseq f
|
insertRepoFixme l rlwwseq f
|
||||||
|
|
||||||
buildCommitTreeIndex (coerce lw)
|
-- buildCommitTreeIndex (coerce lw)
|
||||||
|
|
||||||
fxe <- selectRepoFixme
|
fxe <- selectRepoFixme
|
||||||
|
|
||||||
|
|
|
@ -178,6 +178,7 @@ executable hbs2-git-dashboard
|
||||||
, hbs2-git-dashboard-core
|
, hbs2-git-dashboard-core
|
||||||
, hbs2-peer
|
, hbs2-peer
|
||||||
, suckless-conf
|
, suckless-conf
|
||||||
|
, db-pipe
|
||||||
|
|
||||||
, binary
|
, binary
|
||||||
, bytestring
|
, bytestring
|
||||||
|
|
Loading…
Reference in New Issue