Skip to content

Commit

Permalink
Merge pull request #431 from GoRethink/develop
Browse files Browse the repository at this point in the history
v4: connection refactor, some tests and opentracing.
  • Loading branch information
CMogilko authored Dec 14, 2017
2 parents 7f5bdfd + b4cac7c commit eec03bd
Show file tree
Hide file tree
Showing 124 changed files with 1,670 additions and 779 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ _testmain.go

*.exe
.wercker

cover.html
9 changes: 6 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
language: go

go:
- 1.7.5
- 1.8.1
- 1.7.x
- 1.8.x
- 1.9.x
- tip

cache: apt

go_import_path: gopkg.in/gorethink/gorethink.v3
go_import_path: gopkg.in/gorethink/gorethink.v4

install: go get -t ./...

before_script:
- source /etc/lsb-release && echo "deb http://download.rethinkdb.com/apt $DISTRIB_CODENAME main" | sudo tee /etc/apt/sources.list.d/rethinkdb.list
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## v4.0.0 - 2017-12-14

### Fixed

- `Connection` work with sockets, now only a single goroutine reads from socket.
- Optimized threadsafe operations in `Connection` with channels and atomics instead of mutex.
- All tests with real db moved to integration folder

### Added

- Added support for tracing with `opentracing-go`
- Added a brand-new unit tests for `Connection`

## v3.0.5 - 2017-09-28

- Fixed typo at http opts
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
test:
test -d ${GOPATH}/src/gopkg.in/gorethink/gorethink.v4 && mv ${GOPATH}/src/gopkg.in/gorethink/gorethink.v4 ${GOPATH}/src/gopkg.in/gorethink/gorethink.v4.bak; true
cp -R . ${GOPATH}/src/gopkg.in/gorethink/gorethink.v4
go test -coverprofile=cover.out -race gopkg.in/gorethink/gorethink.v4; true
go tool cover -html=cover.out -o cover.html; true
rm -f cover.out; true
rm -rf ${GOPATH}/src/gopkg.in/gorethink/gorethink.v4
test -d ${GOPATH}/src/gopkg.in/gorethink/gorethink.v4.bak && mv ${GOPATH}/src/gopkg.in/gorethink/gorethink.v4.bak ${GOPATH}/src/gopkg.in/gorethink/gorethink.v4; true
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

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

Current version: v3.0.5 (RethinkDB v2.3)
Current version: v4.0.0 (RethinkDB v2.3)

<!-- This project is no longer maintained, for more information see the [v3.0.0 release](https://github.com/gorethink/gorethink/releases/tag/v3.0.0)-->

Expand All @@ -20,10 +20,10 @@ If you need any help you can find me on the [RethinkDB slack](http://slack.rethi
## Installation

```
go get gopkg.in/gorethink/gorethink.v3
go get gopkg.in/gorethink/gorethink.v4
```

Replace `v3` with `v2` or `v1` to use previous versions.
Replace `v4` with `v3` or `v2` to use previous versions.

## Example

Expand All @@ -35,7 +35,7 @@ import (
"fmt"
"log"

r "gopkg.in/gorethink/gorethink.v3"
r "gopkg.in/gorethink/gorethink.v4"
)

func Example() {
Expand Down Expand Up @@ -413,6 +413,15 @@ r.Log.Out = os.Stderr
r.Log.Out = ioutil.Discard
```

## Tracing

The driver supports [opentracing-go](https://github.com/opentracing/opentracing-go/). You can enable this feature by setting `UseOpentracing` to true in the `ConnectOpts`. Then driver will expect `opentracing.Span` in the `RunOpts.Context` and will start new child spans for queries.
Also you need to configure tracer in your program by yourself.

The driver starts span for the whole query, from the first byte is sent to the cursor closed, and second-level span for each query for fetching data.

So you can trace how much time you program spends for RethinkDB queries.

## Mocking

The driver includes the ability to mock queries meaning that you can test your code without needing to talk to a real RethinkDB cluster, this is perfect for ensuring that your application has high unit test coverage.
Expand Down
Loading

0 comments on commit eec03bd

Please sign in to comment.