mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-11 02:25:39 +03:00
DIndex seems to be working, added simple test
This commit is contained in:
parent
2eaacba7e0
commit
328939809c
@ -121,7 +121,7 @@ process recv = scope "Mux.process" $ do
|
||||
L.warn logger $ "dropped packet @ " ++ show (Base64.encode destination)
|
||||
pure True
|
||||
Just callback -> do
|
||||
L.warn logger $ "packet delivered @ " ++ show (Base64.encode destination)
|
||||
L.debug logger $ "packet delivered @ " ++ show (Base64.encode destination)
|
||||
callback content
|
||||
pure True
|
||||
|
||||
|
@ -195,9 +195,9 @@ handle crypto allow env lang p r = Mux.debug (show r) >> case r of
|
||||
Mux.debug $ "runLocal Pure"
|
||||
liftIO $ eval lang t
|
||||
runLocal (Send c@(Channel cid) a) = do
|
||||
Mux.warn $ "runLocal Send " ++ show c ++ " " ++ show a
|
||||
Mux.debug $ "runLocal Send " ++ show c ++ " " ++ show a
|
||||
a <- liftIO $ eval lang a
|
||||
Mux.warn $ "runLocal Send[2] " ++ show c ++ " " ++ show a
|
||||
Mux.debug $ "runLocal Send[2] " ++ show c ++ " " ++ show a
|
||||
Mux.process1 (Mux.Packet cid (Put.runPutS (serialize a)))
|
||||
pure (unit lang)
|
||||
runLocal (Sleep (Seconds seconds)) = do
|
||||
|
11
unison-src/dindex-main.u
Normal file
11
unison-src/dindex-main.u
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
do Remote
|
||||
root := Remote.spawn;
|
||||
Remote.transfer root;
|
||||
ind := DIndex.empty;
|
||||
nodes := Remote.replicate 10 Remote.spawn;
|
||||
Remote.traverse (node -> Remote.at' node (DIndex.join ind)) nodes;
|
||||
DIndex.insert "It's..." "ALIIIVE!!!!" ind;
|
||||
-- Remote.parallel-traverse DIndex.Timeout (k -> DIndex.insert k k ind) (Vector.range 0 5);
|
||||
r := DIndex.lookup "It's..." ind;
|
||||
pure (Debug.watch "result" r);;
|
@ -35,9 +35,7 @@ DIndex.lookup k ind = do Remote
|
||||
nind;;)
|
||||
;
|
||||
-- todo: use Remote.quorum here
|
||||
-- Remote.race DIndex.Timeout <| Vector.map localLookup nodes;;
|
||||
rs := Remote.traverse localLookup nodes;
|
||||
pure (Vector.at 0 rs |> Optional.bind identity);;
|
||||
Remote.race DIndex.Timeout <| Vector.map localLookup nodes;;
|
||||
;
|
||||
|
||||
DIndex.insert : ∀ k v . k -> v -> DIndex k v -> Remote Unit;
|
||||
@ -86,6 +84,7 @@ DIndex.rebalance k ind = do Remote
|
||||
ov;;)
|
||||
;;
|
||||
;
|
||||
|
||||
DIndex.leave : ∀ k v . Node -> DIndex k v -> Remote Unit;
|
||||
DIndex.leave node ind = do Remote
|
||||
local-ind := Index.lookup node ind;
|
||||
|
Loading…
Reference in New Issue
Block a user