Skip to content

Commit e9228a4

Browse files
committed
Merge branch 'pr/89'
Change-Id: I2efeaa4d10f564addf33473a119e46b79c8eb747
2 parents 3603ec7 + 58426f8 commit e9228a4

File tree

5 files changed

+107
-0
lines changed

5 files changed

+107
-0
lines changed

core/readconcern/readconcern.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,17 @@ func Linearizable() *ReadConcern {
4040
return New(Level("linearizable"))
4141
}
4242

43+
// Available specifies that the query should return data from the instance with no guarantee
44+
// that the data has been written to a majority of the replica set members (i.e. may be rolled back).
45+
func Available() *ReadConcern {
46+
return New(Level("available"))
47+
}
48+
49+
// Snapshot is only available for operations within multi-document transactions.
50+
func Snapshot() *ReadConcern {
51+
return New(Level("snapshot"))
52+
}
53+
4354
// New constructs a new read concern from the given string.
4455
func New(options ...Option) *ReadConcern {
4556
concern := &ReadConcern{}

data/read-write-concern/connection-string/read-concern.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,33 @@
2424
"readConcern": {
2525
"level": "majority"
2626
}
27+
},
28+
{
29+
"description": "available specified",
30+
"uri": "mongodb://localhost/?readConcernLevel=available",
31+
"valid": true,
32+
"warning": false,
33+
"readConcern": {
34+
"level": "available"
35+
}
36+
},
37+
{
38+
"description": "snapshot specified",
39+
"uri": "mongodb://localhost/?readConcernLevel=snapshot",
40+
"valid": true,
41+
"warning": false,
42+
"readConcern": {
43+
"level": "snapshot"
44+
}
45+
},
46+
{
47+
"description": "linearizable specified",
48+
"uri": "mongodb://localhost/?readConcernLevel=linearizable",
49+
"valid": true,
50+
"warning": false,
51+
"readConcern": {
52+
"level": "linearizable"
53+
}
2754
}
2855
]
2956
}

data/read-write-concern/connection-string/read-concern.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,21 @@ tests:
1717
valid: true
1818
warning: false
1919
readConcern: { level: "majority" }
20+
-
21+
description: "available specified"
22+
uri: "mongodb://localhost?readConcernLevel=available"
23+
valid: true
24+
warning: false
25+
readConcern: { level: "available" }
26+
-
27+
description: "snapshot specified"
28+
uri: "mongodb://localhost?readConcernLevel=snapshot"
29+
valid: true
30+
warning: false
31+
readConcern: { level: "snapshot" }
32+
-
33+
description: "linearizable specified"
34+
uri: "mongodb://localhost?readConcernLevel=linearizable"
35+
valid: true
36+
warning: false
37+
readConcern: { level: "linearizable" }

data/read-write-concern/document/read-concern.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,39 @@
2828
"level": "local"
2929
},
3030
"isServerDefault": false
31+
},
32+
{
33+
"description": "Available",
34+
"valid": true,
35+
"readConcern": {
36+
"level": "available"
37+
},
38+
"readConcernDocument": {
39+
"level": "available"
40+
},
41+
"isServerDefault": false
42+
},
43+
{
44+
"description": "Snapshot",
45+
"valid": true,
46+
"readConcern": {
47+
"level": "snapshot"
48+
},
49+
"readConcernDocument": {
50+
"level": "snapshot"
51+
},
52+
"isServerDefault": false
53+
},
54+
{
55+
"description": "Linearizable",
56+
"valid": true,
57+
"readConcern": {
58+
"level": "linearizable"
59+
},
60+
"readConcernDocument": {
61+
"level": "linearizable"
62+
},
63+
"isServerDefault": false
3164
}
3265
]
3366
}

data/read-write-concern/document/read-concern.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,22 @@ tests:
1616
valid: true
1717
readConcern: { level: "local" }
1818
readConcernDocument: { level: "local" }
19+
isServerDefault: false
20+
-
21+
description: "Available"
22+
valid: true
23+
readConcern: { level: "available" }
24+
readConcernDocument: { level: "available" }
25+
isServerDefault: false
26+
-
27+
description: "Snapshot"
28+
valid: true
29+
readConcern: { level: "snapshot" }
30+
readConcernDocument: { level: "snapshot" }
31+
isServerDefault: false
32+
-
33+
description: "Linearizable"
34+
valid: true
35+
readConcern: { level: "linearizable" }
36+
readConcernDocument: { level: "linearizable" }
1937
isServerDefault: false

0 commit comments

Comments
 (0)