Skip to content

Commit

Permalink
Merge branch 'pr/89'
Browse files Browse the repository at this point in the history
Change-Id: I2efeaa4d10f564addf33473a119e46b79c8eb747
  • Loading branch information
skriptble committed Sep 20, 2018
2 parents 3603ec7 + 58426f8 commit e9228a4
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 0 deletions.
11 changes: 11 additions & 0 deletions core/readconcern/readconcern.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ func Linearizable() *ReadConcern {
return New(Level("linearizable"))
}

// Available specifies that the query should return data from the instance with no guarantee
// that the data has been written to a majority of the replica set members (i.e. may be rolled back).
func Available() *ReadConcern {
return New(Level("available"))
}

// Snapshot is only available for operations within multi-document transactions.
func Snapshot() *ReadConcern {
return New(Level("snapshot"))
}

// New constructs a new read concern from the given string.
func New(options ...Option) *ReadConcern {
concern := &ReadConcern{}
Expand Down
27 changes: 27 additions & 0 deletions data/read-write-concern/connection-string/read-concern.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,33 @@
"readConcern": {
"level": "majority"
}
},
{
"description": "available specified",
"uri": "mongodb://localhost/?readConcernLevel=available",
"valid": true,
"warning": false,
"readConcern": {
"level": "available"
}
},
{
"description": "snapshot specified",
"uri": "mongodb://localhost/?readConcernLevel=snapshot",
"valid": true,
"warning": false,
"readConcern": {
"level": "snapshot"
}
},
{
"description": "linearizable specified",
"uri": "mongodb://localhost/?readConcernLevel=linearizable",
"valid": true,
"warning": false,
"readConcern": {
"level": "linearizable"
}
}
]
}
18 changes: 18 additions & 0 deletions data/read-write-concern/connection-string/read-concern.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,21 @@ tests:
valid: true
warning: false
readConcern: { level: "majority" }
-
description: "available specified"
uri: "mongodb://localhost?readConcernLevel=available"
valid: true
warning: false
readConcern: { level: "available" }
-
description: "snapshot specified"
uri: "mongodb://localhost?readConcernLevel=snapshot"
valid: true
warning: false
readConcern: { level: "snapshot" }
-
description: "linearizable specified"
uri: "mongodb://localhost?readConcernLevel=linearizable"
valid: true
warning: false
readConcern: { level: "linearizable" }
33 changes: 33 additions & 0 deletions data/read-write-concern/document/read-concern.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,39 @@
"level": "local"
},
"isServerDefault": false
},
{
"description": "Available",
"valid": true,
"readConcern": {
"level": "available"
},
"readConcernDocument": {
"level": "available"
},
"isServerDefault": false
},
{
"description": "Snapshot",
"valid": true,
"readConcern": {
"level": "snapshot"
},
"readConcernDocument": {
"level": "snapshot"
},
"isServerDefault": false
},
{
"description": "Linearizable",
"valid": true,
"readConcern": {
"level": "linearizable"
},
"readConcernDocument": {
"level": "linearizable"
},
"isServerDefault": false
}
]
}
18 changes: 18 additions & 0 deletions data/read-write-concern/document/read-concern.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,22 @@ tests:
valid: true
readConcern: { level: "local" }
readConcernDocument: { level: "local" }
isServerDefault: false
-
description: "Available"
valid: true
readConcern: { level: "available" }
readConcernDocument: { level: "available" }
isServerDefault: false
-
description: "Snapshot"
valid: true
readConcern: { level: "snapshot" }
readConcernDocument: { level: "snapshot" }
isServerDefault: false
-
description: "Linearizable"
valid: true
readConcern: { level: "linearizable" }
readConcernDocument: { level: "linearizable" }
isServerDefault: false

0 comments on commit e9228a4

Please sign in to comment.