Skip to content

Commit cff081d

Browse files
committed
Merge branch 'release/v1.1.0'
2 parents 786f12a + 41ae492 commit cff081d

39 files changed

+1283
-499
lines changed

Diff for: .travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
language: go
22

3-
gobuild_args: -tags='cluster'
3+
gobuild_args: -tags='cluster' -race
44

55
go:
66
- 1.4
7-
- tip
7+
- 1.5
88

99
cache: apt
1010

Diff for: CHANGELOG.md

+27
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,33 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5+
## v1.1.0
6+
### Added
7+
- Replaced `UseOutdated` with `ReadMode`
8+
- Added `EmergencyRepair` and `NonVotingReplicaTags` to `ReconfigureOpts`
9+
- Added `Union` as a root term
10+
- Added `Branch` as a root term
11+
- Added `ReadTimeout` and `WriteTimeout` to `RunOpts` and `ExecOpts`
12+
- Exported `github.com/Sirupsen/logrus.Logger` as `Log`
13+
- Added support for encoding maps with non-string keys
14+
- Added 'Round', 'Ceil' and 'Floor' terms
15+
- Added race detector to CI
16+
17+
### Changed
18+
- Changed `Timeout` connect argument to only configure the connection timeout.
19+
- Replaced `Db` with `DB` in `RunOpts` and `ExecOpts` (`Db` still works for now)
20+
- Made `Cursor` and `Session` safe for concurrent use
21+
- Replaced `ErrClusterClosed` with `ErrConnectionClosed`
22+
23+
## Deprecated
24+
- Deprecated `UseOutdated` optional argument
25+
- Deprecated `Db` in `RunOpt`
26+
27+
### Fixed
28+
- Fixed race condition in node pool
29+
- Fixed node refresh issue with RethinkDB 2.1 due to an API change
30+
- Fixed encoding errors not being returned when running queries
31+
532
## v1.0.0 - 2015-06-27
633

734
1.0.0 is finally here, This is the first stable production ready release of GoRethink!

Diff for: README.md

+11-5
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
**Driver does not currently support RethinkDB 2.1, update coming soon!**
44

5-
[![GitHub tag](https://img.shields.io/github/tag/dancannon/gorethink.svg?style=flat)](https://github.com/dancannon/gorethink/releases/tag/v1.0.0-rc.3)
5+
[![GitHub tag](https://img.shields.io/github/tag/dancannon/gorethink.svg?style=flat)](https://github.com/dancannon/gorethink/releases)
66
[![GoDoc](https://godoc.org/github.com/dancannon/gorethink?status.png)](https://godoc.org/github.com/dancannon/gorethink)
77
[![build status](https://img.shields.io/travis/dancannon/gorethink/master.svg "build status")](https://travis-ci.org/dancannon/gorethink)
88

99
[Go](http://golang.org/) driver for [RethinkDB](http://www.rethinkdb.com/)
1010

1111
![GoRethink Logo](https://raw.github.com/wiki/dancannon/gorethink/gopher-and-thinker-s.png "Golang Gopher and RethinkDB Thinker")
1212

13-
Current version: v1.0.0 (RethinkDB v2.0)
13+
Current version: v1.1.0 (RethinkDB v2.1)
1414

1515
Please note that this version of the driver only supports versions of RethinkDB using the v0.4 protocol (any versions of the driver older than RethinkDB 2.0 will not work).
1616

@@ -109,7 +109,7 @@ r.Expr(map[string]interface{}{"a": 1, "b": 2, "c": 3}).Run(session)
109109
```
110110
Get Example
111111
```go
112-
r.Db("database").Table("table").Get("GUID").Run(session)
112+
r.DB("database").Table("table").Get("GUID").Run(session)
113113
```
114114
Map Example (Func)
115115
```go
@@ -123,7 +123,7 @@ r.Expr([]interface{}{1, 2, 3, 4, 5}).Map(r.Row.Add(1)).Run(session)
123123
```
124124
Between (Optional Args) Example
125125
```go
126-
r.Db("database").Table("table").Between(1, 10, r.BetweenOpts{
126+
r.DB("database").Table("table").Between(1, 10, r.BetweenOpts{
127127
Index: "num",
128128
RightBound: "closed",
129129
}).Run(session)
@@ -144,7 +144,7 @@ Different result types are returned depending on what function is used to execut
144144
Example:
145145

146146
```go
147-
res, err := r.Db("database").Table("tablename").Get(key).Run(session)
147+
res, err := r.DB("database").Table("tablename").Get(key).Run(session)
148148
if err != nil {
149149
// error
150150
}
@@ -251,6 +251,12 @@ BenchmarkSequentialSoftWritesParallel10 10000 263
251251

252252
Many functions have examples and are viewable in the godoc, alternatively view some more full features examples on the [wiki](https://github.com/dancannon/gorethink/wiki/Examples).
253253

254+
## Further reading
255+
256+
- [GoRethink Goes 1.0](https://www.compose.io/articles/gorethink-goes-1-0/)
257+
- [Go, RethinkDB & Changefeeds](https://www.compose.io/articles/go-rethinkdb-and-changefeeds-part-1/)
258+
- [Build an IRC bot in Go with RethinkDB changefeeds](http://rethinkdb.com/blog/go-irc-bot/)
259+
254260
## License
255261

256262
Copyright 2013 Daniel Cannon

Diff for: buffer.go

-143
This file was deleted.

Diff for: cluster.go

+22-11
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func (c *Cluster) discover() {
120120

121121
return c.listenForNodeChanges()
122122
}, b, func(err error, wait time.Duration) {
123-
log.Debugf("Error discovering hosts %s, waiting %s", err, wait)
123+
Log.Debugf("Error discovering hosts %s, waiting %s", err, wait)
124124
})
125125
}
126126
}
@@ -134,11 +134,16 @@ func (c *Cluster) listenForNodeChanges() error {
134134
return err
135135
}
136136

137-
cursor, err := node.Query(newQuery(
137+
q, err := newQuery(
138138
DB("rethinkdb").Table("server_status").Changes(),
139139
map[string]interface{}{},
140140
c.opts,
141-
))
141+
)
142+
if err != nil {
143+
return fmt.Errorf("Error building query %s", err)
144+
}
145+
146+
cursor, err := node.Query(q)
142147
if err != nil {
143148
return err
144149
}
@@ -165,7 +170,7 @@ func (c *Cluster) listenForNodeChanges() error {
165170
if !c.nodeExists(node) {
166171
c.addNode(node)
167172

168-
log.WithFields(logrus.Fields{
173+
Log.WithFields(logrus.Fields{
169174
"id": node.ID,
170175
"host": node.Host.String(),
171176
}).Debug("Connected to node")
@@ -191,18 +196,24 @@ func (c *Cluster) connectNodes(hosts []Host) {
191196
for _, host := range hosts {
192197
conn, err := NewConnection(host.String(), c.opts)
193198
if err != nil {
194-
log.Warnf("Error creating connection %s", err.Error())
199+
Log.Warnf("Error creating connection %s", err.Error())
195200
continue
196201
}
197202
defer conn.Close()
198203

199-
_, cursor, err := conn.Query(newQuery(
204+
q, err := newQuery(
200205
DB("rethinkdb").Table("server_status"),
201206
map[string]interface{}{},
202207
c.opts,
203-
))
208+
)
209+
if err != nil {
210+
Log.Warnf("Error building query %s", err)
211+
continue
212+
}
213+
214+
_, cursor, err := conn.Query(q)
204215
if err != nil {
205-
log.Warnf("Error fetching cluster status %s", err)
216+
Log.Warnf("Error fetching cluster status %s", err)
206217
continue
207218
}
208219

@@ -217,7 +228,7 @@ func (c *Cluster) connectNodes(hosts []Host) {
217228
node, err := c.connectNodeWithStatus(result)
218229
if err == nil {
219230
if _, ok := nodeSet[node.ID]; !ok {
220-
log.WithFields(logrus.Fields{
231+
Log.WithFields(logrus.Fields{
221232
"id": node.ID,
222233
"host": node.Host.String(),
223234
}).Debug("Connected to node")
@@ -229,7 +240,7 @@ func (c *Cluster) connectNodes(hosts []Host) {
229240
node, err := c.connectNode(host.String(), []Host{host})
230241
if err == nil {
231242
if _, ok := nodeSet[node.ID]; !ok {
232-
log.WithFields(logrus.Fields{
243+
Log.WithFields(logrus.Fields{
233244
"id": node.ID,
234245
"host": node.Host.String(),
235246
}).Debug("Connected to node")
@@ -315,7 +326,7 @@ func (c *Cluster) getSeeds() []Host {
315326
// TODO(dancannon) replace with hostpool
316327
func (c *Cluster) GetRandomNode() (*Node, error) {
317328
if !c.IsConnected() {
318-
return nil, ErrClusterClosed
329+
return nil, ErrNoConnections
319330
}
320331
// Must copy array reference for copy on write semantics to work.
321332
nodeArray := c.GetNodes()

0 commit comments

Comments
 (0)