Skip to content

Commit 5980bc1

Browse files
Add a clarificatory remark and one example to openReplicaSet'
Merge pull request mongodb-haskell#127 from why-not-try-calmer/adrien/few-clarifications
2 parents 3bb466c + 410fdd5 commit 5980bc1

File tree

5 files changed

+92
-1
lines changed

5 files changed

+92
-1
lines changed

Database/MongoDB/Connection.hs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,14 @@ openReplicaSetSRV hostname = do
172172

173173
openReplicaSetSRV' :: HostName -> IO ReplicaSet
174174
-- ^ Open /secure/ connections (on demand) to servers in a replica set. The seedlist and replica set name is fetched from the SRV and TXT DNS records for the given hostname. The value of 'globalConnectTimeout' at the time of this call is the timeout used for future member connect attempts. To use your own value call 'openReplicaSetSRV'''' instead.
175+
--
176+
-- The preferred connection method for cloud MongoDB providers. A typical connecting sequence is shown in the example below.
177+
--
178+
-- ==== __Example__
179+
-- > do
180+
-- > pipe <- openReplicatSetSRV' "cluster#.xxxxx.yyyyy.zzz"
181+
-- > is_auth <- access pipe master "admin" $ auth user_name password
182+
-- > unless (not is_auth) (throwIO $ userError "Authentication failed!")
175183
openReplicaSetSRV' hostname = do
176184
timeoutSecs <- readIORef globalConnectTimeout
177185
_openReplicaSetSRV timeoutSecs Secure hostname

Database/MongoDB/Internal/Protocol.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@ pcall p@Pipeline{..} message = do
195195
-- * Pipe
196196

197197
type Pipe = Pipeline
198-
-- ^ Thread-safe TCP connection with pipelined requests
198+
-- ^ Thread-safe TCP connection with pipelined requests. In long-running applications the user is expected to use it as a "client": create a `Pipe`
199+
-- at startup, use it as long as possible, watch out for possible timeouts, and close it on shutdown. Bearing in mind that disconnections may be triggered by MongoDB service providers, the user is responsible for re-creating their `Pipe` whenever necessary.
199200

200201
newPipe :: ServerData -> Handle -> IO Pipe
201202
-- ^ Create pipe over handle

dist-newstyle/cache/config

11.1 KB
Binary file not shown.

stack.yaml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# This file was automatically generated by 'stack init'
2+
#
3+
# Some commonly used options have been documented as comments in this file.
4+
# For advanced use and comprehensive documentation of the format, please see:
5+
# https://docs.haskellstack.org/en/stable/yaml_configuration/
6+
7+
# Resolver to choose a 'specific' stackage snapshot or a compiler version.
8+
# A snapshot resolver dictates the compiler version and the set of packages
9+
# to be used for project dependencies. For example:
10+
#
11+
# resolver: lts-3.5
12+
# resolver: nightly-2015-09-21
13+
# resolver: ghc-7.10.2
14+
#
15+
# The location of a snapshot can be provided as a file or url. Stack assumes
16+
# a snapshot provided as a file might change, whereas a url resource does not.
17+
#
18+
# resolver: ./custom-snapshot.yaml
19+
# resolver: https://example.com/snapshots/2018-01-01.yaml
20+
resolver:
21+
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/21.yaml
22+
23+
# User packages to be built.
24+
# Various formats can be used as shown in the example below.
25+
#
26+
# packages:
27+
# - some-directory
28+
# - https://example.com/foo/bar/baz-0.0.2.tar.gz
29+
# subdirs:
30+
# - auto-update
31+
# - wai
32+
packages:
33+
- .
34+
# Dependency packages to be pulled from upstream that are not in the resolver.
35+
# These entries can reference officially published versions as well as
36+
# forks / in-progress versions pinned to a git hash. For example:
37+
#
38+
# extra-deps:
39+
# - acme-missiles-0.3
40+
# - git: https://github.com/commercialhaskell/stack.git
41+
# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
42+
#
43+
# extra-deps: []
44+
45+
# Override default flag values for local packages and extra-deps
46+
flags:
47+
mongoDB:
48+
_old-network: false
49+
50+
# Extra package databases containing global packages
51+
# extra-package-dbs: []
52+
53+
# Control whether we use the GHC we find on the path
54+
# system-ghc: true
55+
#
56+
# Require a specific version of stack, using version ranges
57+
# require-stack-version: -any # Default
58+
# require-stack-version: ">=2.7"
59+
#
60+
# Override the architecture used by stack, especially useful on Windows
61+
# arch: i386
62+
# arch: x86_64
63+
#
64+
# Extra directories used by stack for building
65+
# extra-include-dirs: [/path/to/dir]
66+
# extra-lib-dirs: [/path/to/dir]
67+
#
68+
# Allow a newer minor version of GHC than the snapshot specifies
69+
# compiler-check: newer-minor

stack.yaml.lock

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# This file was autogenerated by Stack.
2+
# You should not edit this file by hand.
3+
# For more information, please see the documentation at:
4+
# https://docs.haskellstack.org/en/stable/lock_files
5+
6+
packages: []
7+
snapshots:
8+
- completed:
9+
size: 586110
10+
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/21.yaml
11+
sha256: ce4fb8d44f3c6c6032060a02e0ebb1bd29937c9a70101c1517b92a87d9515160
12+
original:
13+
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/18/21.yaml

0 commit comments

Comments
 (0)