Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Christian Merten
haskell-gargantext
Commits
9ea7d5f3
Verified
Commit
9ea7d5f3
authored
May 22, 2024
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[central-exchange] very simple implementation using nanomsg
parent
dc0df15d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
109 additions
and
0 deletions
+109
-0
Main.hs
bin/gargantext-central-exchange/Main.hs
+70
-0
cabal.project
cabal.project
+10
-0
gargantext.cabal
gargantext.cabal
+21
-0
pkgs.nix
nix/pkgs.nix
+6
-0
AsyncUpdates.hs
src/Gargantext/Core/AsyncUpdates.hs
+2
-0
No files found.
bin/gargantext-central-exchange/Main.hs
0 → 100644
View file @
9ea7d5f3
{-|
Module : Main.hs
Description : Gargantext central exchange for async notifications
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
-}
{-# LANGUAGE Strict #-}
module
Main
where
import
Control.Concurrent
(
threadDelay
)
import
Control.Monad
(
join
,
mapM_
)
import
Data.ByteString.Char8
qualified
as
C
import
Data.Text
qualified
as
T
import
Gargantext.Prelude
import
Nanomsg
import
Options.Applicative
data
Command
=
Server
|
Client
parser
::
Parser
(
IO
()
)
parser
=
subparser
(
command
"server"
(
info
(
pure
gServer
)
idm
)
<>
command
"client"
(
info
(
pure
gClient
)
idm
)
)
main
::
IO
()
main
=
join
$
execParser
(
info
parser
idm
)
gClient
::
IO
()
gClient
=
do
withSocket
Push
$
\
s
->
do
_
<-
connect
s
"tcp://localhost:5560"
let
str
=
C
.
unwords
(
take
1000
$
repeat
"hello"
)
C
.
putStrLn
$
C
.
pack
"sending: "
<>
(
C
.
take
100
str
)
replicateM_
100
$
send
s
str
gServer
::
IO
()
gServer
=
do
withSocket
Pull
$
\
s
->
do
_
<-
bind
s
"tcp://*:5560"
forever
$
do
putText
"receiving"
r
<-
recv
s
C
.
putStrLn
$
C
.
take
100
r
-- r <- recv' s
-- -- putText $ T.pack $ C.unpack r
-- putText "..."
-- case r of
-- Nothing -> pure ()
-- Just r' -> C.putStrLn $ C.take 100 r'
-- threadDelay 1000000
-- withSocket Pub $ \s -> do
-- _ <- bind s "tcp://*:5560"
-- mapM_ (\num -> sendNumber s num) (cycle [1..1000000 :: Int])
-- where
-- sendNumber s number = do
-- threadDelay 1000 -- let's conserve some cycles
-- let numAsString = show number
-- send s (C.pack numAsString)
cabal.project
View file @
9ea7d5f3
...
...
@@ -165,7 +165,17 @@ source-repository-package
type
:
git
location
:
https
://
github
.
com
/
robstewart57
/
rdf4h
.
git
tag
:
4f
d2edf30c141600ffad6d730cc4c1c08a6dbce4
source
-
repository
-
package
type
:
git
location
:
https
://
github
.
com
/
garganscript
/
nanomsg
-
haskell
tag
:
5e4
e119881d81b8a8f77a79b3caaebb1bb304790
--
source
-
repository
-
package
--
type
:
git
--
location
:
https
://
github
.
com
/
jimenezrick
/
nng
-
haskell
--
tag
:
31e52
d7bc720e5fb9daf1c1e8bc1fd156d577af2
allow
-
older
:
*
allow
-
newer
:
*
...
...
gargantext.cabal
View file @
9ea7d5f3
...
...
@@ -848,6 +848,27 @@ executable gargantext-upgrade
, gargantext-prelude
, postgresql-simple ^>= 0.6.4
, text ^>= 1.2.4.1
executable gargantext-central-exchange
import:
defaults
main-is: Main.hs
other-modules:
Paths_gargantext
hs-source-dirs:
bin/gargantext-central-exchange
build-depends:
bytestring ^>= 0.10.12.0
, gargantext
, gargantext-prelude
, nanomsg-haskell >= 0.2.4 && < 0.3
-- , nng-haskell
, optparse-applicative >= 0.18.1.0 && < 0.19
, optparse-generic ^>= 1.4.7
, postgresql-simple ^>= 0.6.4
, text ^>= 1.2.4.1
, unordered-containers ^>= 0.2.16.0
, vector ^>= 0.7.3
test-suite garg-test-tasty
import:
...
...
nix/pkgs.nix
View file @
9ea7d5f3
...
...
@@ -33,6 +33,10 @@ rec {
];
});
# nng180 = pkgs.nng.overrideAttrs (new: old: rec {
# version = "1.8.0";
# });
igraph_0_10_4
=
pkgs
.
igraph
.
overrideAttrs
(
finalAttrs
:
previousAttrs
:
{
version
=
"0.10.4"
;
...
...
@@ -125,6 +129,8 @@ rec {
igraph_0_10_4
libpqxx
libsodium
nanomsg
# nng180
zeromq
curl
]
++
(
lib
.
optionals
stdenv
.
isDarwin
[
...
...
src/Gargantext/Core/AsyncUpdates.hs
View file @
9ea7d5f3
...
...
@@ -8,6 +8,8 @@ Stability : experimental
Portability : POSIX
-}
{-# OPTIONS_GHC -Wno-deprecations #-}
-- FIXME(cgenie) undefined remains in code
module
Gargantext.Core.AsyncUpdates
where
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment