-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'monorepo-structure' of https://github.com/haskell-distr…
…ibuted/network-transport-inmemory into monorepo-structure
- Loading branch information
Showing
9 changed files
with
648 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
0.5.4 | ||
* Bump bounds in test suite. | ||
0.5.3 | ||
* Bump bytestring bound to build with ghc-9.8. | ||
0.5.2 | ||
* Introduce internal module. | ||
* Fixes dependency bounds. | ||
0.5.1 | ||
* Fixed bug in cleanup procedure. | ||
0.5 | ||
* Complete reimplementation based on STM primitives. | ||
* Rename Network.Transport.Chan to Network.Transport.InMemory. | ||
* Disable multicast support until it is properly implemented. | ||
* Expose internals. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Copyright Well-Typed LLP, 2011-2012 | ||
|
||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above | ||
copyright notice, this list of conditions and the following | ||
disclaimer in the documentation and/or other materials provided | ||
with the distribution. | ||
|
||
* Neither the name of the owner nor the names of other | ||
contributors may be used to endorse or promote products derived | ||
from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import Distribution.Simple | ||
main = defaultMain |
67 changes: 67 additions & 0 deletions
67
packages/network-transport-inmemory/network-transport-inmemory.cabal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
Name: network-transport-inmemory | ||
Version: 0.5.4 | ||
Cabal-Version: >=1.10 | ||
Build-Type: Simple | ||
License: BSD3 | ||
License-file: LICENSE | ||
Copyright: Well-Typed LLP, Tweag I/O Limited | ||
Author: Duncan Coutts, Nicolas Wu, Edsko de Vries, Alexander Vershilov | ||
Maintainer: Facundo Domínguez <[email protected]> | ||
Stability: experimental | ||
Homepage: http://haskell-distributed.github.com | ||
Bug-Reports: https://github.com/haskell-distributed/network-transport-inmemory/issues | ||
Synopsis: In-memory instantiation of Network.Transport | ||
Description: This is a transport implementation that could be used for local | ||
communication in the same address space (i.e. one process). | ||
. | ||
It could be used either for testing purposes or for local | ||
communication that require the network-transport semantics. | ||
. | ||
NB: network-tranpsport-inmemory does not support cross-transport | ||
communication. All endpoints that want to comminicate should be | ||
created using the same transport. | ||
|
||
Tested-With: GHC==9.0.2 GHC==9.2.8 GHC==9.4.5 GHC==9.6.4 GHC==9.8.2 | ||
Category: Network | ||
extra-source-files: ChangeLog | ||
|
||
Source-Repository head | ||
Type: git | ||
Location: https://github.com/haskell-distributed/network-transport-inmemory | ||
|
||
Library | ||
Build-Depends: base >= 4.6 && < 5, | ||
network-transport >= 0.4.0.0 && < 0.7, | ||
data-accessor >= 0.2 && < 0.3, | ||
bytestring >= 0.9 && < 0.13, | ||
containers >= 0.4 && < 0.8, | ||
stm >= 2.0 && < 3.0 | ||
Exposed-modules: Network.Transport.InMemory | ||
Network.Transport.InMemory.Internal | ||
Network.Transport.InMemory.Debug | ||
default-language: Haskell2010 | ||
ghc-options: -Wall | ||
HS-Source-Dirs: src | ||
|
||
Test-Suite TestMulticastInMemory | ||
Type: exitcode-stdio-1.0 | ||
Build-Depends: base >= 4.6 && < 5, | ||
network-transport-inmemory, | ||
network-transport, | ||
network-transport-tests >= 0.1 && < 0.4 | ||
Main-Is: TestMulticastInMemory.hs | ||
default-language: Haskell2010 | ||
ghc-options: -Wall -fno-warn-unused-do-bind | ||
HS-Source-Dirs: tests | ||
Buildable: False | ||
|
||
Test-Suite TestInMemory | ||
Type: exitcode-stdio-1.0 | ||
Build-Depends: base >= 4.6 && < 5, | ||
network-transport-inmemory, | ||
network-transport-tests >= 0.1 && < 0.4, | ||
network-transport | ||
Main-Is: TestInMemory.hs | ||
default-language: Haskell2010 | ||
ghc-options: -Wall -fno-warn-unused-do-bind | ||
HS-Source-Dirs: tests |
20 changes: 20 additions & 0 deletions
20
packages/network-transport-inmemory/src/Network/Transport/InMemory.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
-- | In-memory implementation of the Transport API. | ||
module Network.Transport.InMemory | ||
( createTransport | ||
, createTransportExposeInternals | ||
-- * For testing purposes | ||
, TransportInternals(..) | ||
, breakConnection | ||
) where | ||
|
||
import Network.Transport | ||
import Network.Transport.InMemory.Internal | ||
import Network.Transport.InMemory.Debug | ||
|
||
-- | Create a new Transport. | ||
-- | ||
-- Only a single transport should be created per Haskell process | ||
-- (threads can, and should, create their own endpoints though). | ||
createTransport :: IO Transport | ||
createTransport = fmap fst createTransportExposeInternals | ||
|
24 changes: 24 additions & 0 deletions
24
packages/network-transport-inmemory/src/Network/Transport/InMemory/Debug.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
-- | | ||
-- Module: Network.Transport.InMemory.Debug | ||
-- | ||
-- Miscelanteous functions for debug purposes. | ||
module Network.Transport.InMemory.Debug | ||
( breakConnection | ||
) where | ||
|
||
import Control.Concurrent.STM | ||
import Network.Transport | ||
import Network.Transport.InMemory.Internal | ||
|
||
-- | Function that simulate failing connection between two endpoints, | ||
-- after calling this function both endpoints will receive ConnectionEventLost | ||
-- message, and all @LocalConnectionValid@ connections will | ||
-- be put into @LocalConnectionFailed@ state. | ||
breakConnection :: TransportInternals | ||
-> EndPointAddress -- ^ @From@ connection | ||
-> EndPointAddress -- ^ @To@ connection | ||
-> String -- ^ Error message | ||
-> IO () | ||
breakConnection (TransportInternals state) from to message = | ||
atomically $ apiBreakConnection state from to message | ||
|
Oops, something went wrong.