Skip to content

Commit 6edb2de

Browse files
committed
Merge branch 'monorepo-structure' of https://github.com/haskell-distributed/distributed-process-extras into monorepo-structure
2 parents 3e20c1d + ddec357 commit 6edb2de

File tree

26 files changed

+3233
-0
lines changed

26 files changed

+3233
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2017-06-13 Alexander Vershilov <[email protected]> 0.3.5
2+
* Bump dependencies
3+
* Cleanup code
4+
5+
2017-02-05 Tim Watson <watson.timothy @ google mail service dot com> 0.3.0
6+
7+
* re-implement whereIsRemote in terms of whereIsRemoteAsync
8+
* re-implement whereisOrStart to avoid leaking zombie processes
9+
* implement general NFSerializable instances
10+
* make Resolvable instance of (NodeId, String) exception safe
11+
* remove dependency on data-accessor
12+
* Relax upper bound on time for testing
13+
* documentation fixes and improvements
14+
15+
2017-02-05 Tim Watson <watson.timothy @ google mail service dot com> 0.3.0
16+
17+
* Update dependency bounds - drop support for distributed-process < 0.6.6
18+
* Drop support for GHC < 7.10
19+
* Fixes for testing with latest stack and CI changes
20+
21+
2016-02-16 Facundo Domínguez <[email protected]> 0.2.1.2
22+
23+
* Update dependency bounds.
24+
25+
2015-06-15 Facundo Domínguez <[email protected]> 0.2.1
26+
27+
* Use random port in tests.
28+
* Add compatibility with ghc-7.10.
29+
* Fix dependency bounds.
30+
* Add missing NFData instances.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Copyright Tim Watson, 2012-2013.
2+
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
* Redistributions of source code must retain the above copyright
9+
notice, this list of conditions and the following disclaimer.
10+
11+
* Redistributions in binary form must reproduce the above
12+
copyright notice, this list of conditions and the following
13+
disclaimer in the documentation and/or other materials provided
14+
with the distribution.
15+
16+
* Neither the name of the author nor the names of other
17+
contributors may be used to endorse or promote products derived
18+
from this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MAJOR TODOs (in no particular order)
2+
3+
- implement Observable for Mailbox
4+
- implement PCopy / pcopy :: PCopy a -> Process () and precv :: Process (Maybe (PCopy a))
5+
- provide InputChannel for PCopy data, i.e.:
6+
7+
data InputChannel a = ReadChan (ReceivePort a) | ReadSTM (STM a)
8+
9+
read (ReadChan rp) = expectChan rp
10+
read (ReadSTM stm) = liftIO $ atomically stm
11+
12+
offer
13+
14+
- implement RoundRobinRouter, ContentBasedRouter
15+
- finish off ResourcePool
16+
- double check we're using NFSerializable where possible/necessary
17+
18+
- implement LocalRegistry (?)
19+
- possibly rationalise Registry with LocalRegistry (?)
20+
- Health checks for services
21+
- Service Monitoring
22+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env runhaskell
2+
> import Distribution.Simple
3+
> main = defaultMain
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#! /bin/sh
2+
3+
travis_retry curl -L https://github.com/rubik/stack-hpc-coveralls/releases/download/v0.0.4.0/shc-linux-x64-$GHCVER.tar.bz2 | tar -xj
4+
shc -- --hpc-dir=$(stack $ARGS path --local-install-root)`/hpc/combined --dont-send combined all
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
name: distributed-process-extras
2+
version: 0.3.5
3+
cabal-version: >=1.8
4+
build-type: Simple
5+
license: BSD3
6+
license-file: LICENCE
7+
stability: experimental
8+
Copyright: Tim Watson 2012 - 2017
9+
Author: Tim Watson
10+
Maintainer: Tim Watson <[email protected]>
11+
Homepage: http://github.com/haskell-distributed/distributed-process-extras
12+
Bug-Reports: http://github.com/haskell-distributed/distributed-process-extras/issues
13+
synopsis: Cloud Haskell Extras
14+
description: Supporting library, providing common types and utilities used by the
15+
various libraries built on top of distributed-process
16+
category: Control
17+
Tested-With: GHC==7.10.3 GHC==8.0.1 GHC==8.0.2
18+
data-dir: ""
19+
extra-source-files: ChangeLog
20+
21+
source-repository head
22+
type: git
23+
location: https://github.com/haskell-distributed/distributed-process-extras
24+
25+
flag old-locale
26+
description: If false then depend on time >= 1.5.
27+
.
28+
If true then depend on time < 1.5 together with old-locale.
29+
default: False
30+
31+
library
32+
build-depends: base >= 4.8 && < 5,
33+
distributed-process >= 0.6.0 && < 0.8,
34+
binary >= 0.6.3.0 && < 0.9,
35+
deepseq >= 1.3.0.1 && < 1.6,
36+
mtl >= 2.0 && < 2.4,
37+
containers >= 0.4 && < 0.6,
38+
exceptions >= 0.5,
39+
hashable >= 1.2.0.5 && < 1.3,
40+
unordered-containers >= 0.2.3.0 && < 0.3,
41+
fingertree < 0.2,
42+
stm >= 2.4 && < 2.5,
43+
transformers >= 0.2 && < 0.6
44+
if flag(old-locale)
45+
Build-Depends: time < 1.5, old-locale >= 1.0 && <1.1
46+
else
47+
Build-Depends: time >= 1.5
48+
extensions: CPP
49+
other-extensions: ExistentialQuantification
50+
ghc-options: -Wall
51+
HS-Source-Dirs: src
52+
exposed-modules:
53+
Control.Distributed.Process.Extras,
54+
Control.Distributed.Process.Extras.Call,
55+
Control.Distributed.Process.Extras.Monitoring,
56+
Control.Distributed.Process.Extras.SystemLog,
57+
Control.Distributed.Process.Extras.Time,
58+
Control.Distributed.Process.Extras.Timer,
59+
Control.Distributed.Process.Extras.UnsafePrimitives,
60+
Control.Concurrent.Utils,
61+
Control.Distributed.Process.Extras.Internal.Containers.MultiMap,
62+
Control.Distributed.Process.Extras.Internal.Primitives,
63+
Control.Distributed.Process.Extras.Internal.Types,
64+
Control.Distributed.Process.Extras.Internal.Queue.SeqQ,
65+
Control.Distributed.Process.Extras.Internal.Queue.PriorityQ
66+
Control.Distributed.Process.Extras.Internal.Unsafe
67+
68+
test-suite InternalQueueTests
69+
type: exitcode-stdio-1.0
70+
x-uses-tf: true
71+
build-depends:
72+
base >= 4.6 && < 5,
73+
ansi-terminal >= 0.5 && < 0.9,
74+
distributed-process >= 0.6.0 && < 0.8,
75+
distributed-process-extras,
76+
distributed-process-systest >= 0.1.0 && < 0.3.0,
77+
HUnit >= 1.2 && < 2,
78+
test-framework >= 0.6 && < 0.9,
79+
test-framework-hunit,
80+
QuickCheck >= 2.4,
81+
test-framework-quickcheck2,
82+
rematch >= 0.2.0.0,
83+
ghc-prim
84+
hs-source-dirs:
85+
tests
86+
ghc-options: -Wall -rtsopts
87+
extensions: CPP
88+
main-is: TestQueues.hs
89+
cpp-options: -DTESTING
90+
91+
test-suite PrimitivesTests
92+
type: exitcode-stdio-1.0
93+
x-uses-tf: true
94+
build-depends:
95+
base >= 4.6 && < 5,
96+
ansi-terminal >= 0.5 && < 0.9,
97+
distributed-process >= 0.6.0 && < 0.8,
98+
distributed-process-extras,
99+
distributed-process-systest >= 0.1.0 && < 0.3.0,
100+
network-transport >= 0.4 && < 0.6,
101+
mtl,
102+
containers >= 0.4 && < 0.6,
103+
network-transport-tcp >= 0.4 && < 0.6,
104+
binary >= 0.6.3.0 && < 0.9,
105+
deepseq >= 1.3.0.1 && < 1.6,
106+
network >= 2.3 && < 2.7,
107+
HUnit >= 1.2 && < 2,
108+
stm >= 2.3 && < 2.5,
109+
test-framework >= 0.6 && < 0.9,
110+
test-framework-hunit,
111+
rematch >= 0.2.0.0,
112+
transformers
113+
hs-source-dirs:
114+
tests
115+
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind
116+
extensions: CPP
117+
main-is: TestPrimitives.hs
118+
119+
test-suite TimerTests
120+
type: exitcode-stdio-1.0
121+
x-uses-tf: true
122+
build-depends:
123+
base >= 4.6 && < 5,
124+
ansi-terminal >= 0.5 && < 0.9,
125+
deepseq >= 1.3.0.1 && < 1.6,
126+
distributed-process >= 0.6.0 && < 0.8,
127+
distributed-process-extras,
128+
distributed-process-systest >= 0.1.0 && < 0.3.0,
129+
network-transport >= 0.4 && < 0.6,
130+
network-transport-tcp >= 0.4 && < 0.6,
131+
HUnit >= 1.2 && < 2,
132+
test-framework >= 0.6 && < 0.9,
133+
test-framework-hunit,
134+
QuickCheck >= 2.4,
135+
test-framework-quickcheck2,
136+
rematch >= 0.2.0.0,
137+
ghc-prim
138+
hs-source-dirs:
139+
tests
140+
ghc-options: -Wall -rtsopts
141+
extensions: CPP
142+
main-is: TestTimer.hs
143+
cpp-options: -DTESTING
144+
145+
test-suite LoggerTests
146+
type: exitcode-stdio-1.0
147+
-- x-uses-tf: true
148+
build-depends:
149+
base >= 4.6 && < 5,
150+
ansi-terminal >= 0.5 && < 0.9,
151+
containers,
152+
hashable,
153+
unordered-containers >= 0.2.3.0 && < 0.3,
154+
distributed-process >= 0.6.0 && < 0.8,
155+
distributed-process-extras,
156+
distributed-process-systest >= 0.1.0 && < 0.3.0,
157+
distributed-static,
158+
bytestring,
159+
data-accessor,
160+
fingertree < 0.2,
161+
network-transport >= 0.4 && < 0.6,
162+
deepseq >= 1.3.0.1 && < 1.6,
163+
mtl,
164+
network-transport-tcp >= 0.4 && < 0.6,
165+
binary >= 0.6.3.0 && < 0.9,
166+
network >= 2.3 && < 2.7,
167+
HUnit >= 1.2 && < 2,
168+
stm >= 2.3 && < 2.5,
169+
time > 1.4 && < 1.9,
170+
test-framework >= 0.6 && < 0.9,
171+
test-framework-hunit,
172+
transformers,
173+
rematch >= 0.2.0.0,
174+
ghc-prim
175+
hs-source-dirs:
176+
tests
177+
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N -fno-warn-unused-do-bind
178+
extensions: CPP
179+
main-is: TestLog.hs
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{-# LANGUAGE ExistentialQuantification #-}
2+
module Control.Concurrent.Utils
3+
( Lock()
4+
, mkExclusiveLock
5+
, mkQLock
6+
, withLock
7+
) where
8+
9+
import Control.Monad.Catch (MonadMask)
10+
import qualified Control.Monad.Catch as Catch
11+
import Control.Concurrent.MVar
12+
( newMVar
13+
, takeMVar
14+
, putMVar
15+
)
16+
import Control.Concurrent.QSem
17+
import Control.Monad.IO.Class (MonadIO, liftIO)
18+
19+
-- | Opaque lock.
20+
data Lock = forall l . Lock l (l -> IO ()) (l -> IO ())
21+
22+
-- | Take a lock.
23+
acquire :: MonadIO m => Lock -> m ()
24+
acquire (Lock l acq _) = liftIO $ acq l
25+
26+
-- | Release lock.
27+
release :: MonadIO m => Lock -> m ()
28+
release (Lock l _ rel) = liftIO $ rel l
29+
30+
-- | Create exclusive lock. Only one process could take such lock.
31+
mkExclusiveLock :: IO Lock
32+
mkExclusiveLock = Lock <$> newMVar () <*> pure takeMVar <*> pure (flip putMVar ())
33+
34+
-- | Create quantity lock. A fixed number of processes can take this lock simultaniously.
35+
mkQLock :: Int -> IO Lock
36+
mkQLock n = Lock <$> newQSem n <*> pure waitQSem <*> pure signalQSem
37+
38+
-- | Run action under a held lock.
39+
withLock :: (MonadMask m, MonadIO m) => Lock -> m a -> m a
40+
withLock excl =
41+
Catch.bracket_ (acquire excl)
42+
(release excl)

0 commit comments

Comments
 (0)