| 1 | package rethinkdbscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ |
| 2 | |
| 3 | import ( |
| 4 | "crypto/tlsscip-go gomod github.com/golang/go/src go1.14 `crypto/tls`/" |
| 5 | "encoding/binaryscip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/" |
| 6 | "encoding/jsonscip-go gomod github.com/golang/go/src go1.14 `encoding/json`/" |
| 7 | "fmtscip-go gomod github.com/golang/go/src go1.14 fmt/" |
| 8 | "netscip-go gomod github.com/golang/go/src go1.14 net/" |
| 9 | "sync/atomicscip-go gomod github.com/golang/go/src go1.14 `sync/atomic`/" |
| 10 | "timescip-go gomod github.com/golang/go/src go1.14 time/" |
| 11 | |
| 12 | "bytesscip-go gomod github.com/golang/go/src go1.14 bytes/" |
| 13 | "github.com/opentracing/opentracing-goscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go`/" |
| 14 | "github.com/opentracing/opentracing-go/extscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go/ext`/" |
| 15 | "github.com/opentracing/opentracing-go/logscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go/log`/" |
| 16 | "golang.org/x/net/contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/" |
| 17 | pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/ "gopkg.in/rethinkdb/rethinkdb-go.v6/ql2scip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/" |
| 18 | "syncscip-go gomod github.com/golang/go/src go1.14 sync/" |
| 19 | ) |
| 20 | |
| 21 | const ( |
| 22 | respHeaderLenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/respHeaderLen. = 12 |
| 23 | defaultKeepAlivePeriodscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/defaultKeepAlivePeriod. = timescip-go gomod github.com/golang/go/src go1.14 time/.Secondscip-go gomod github.com/golang/go/src go1.14 time/Second. * 30 |
| 24 | |
| 25 | connNotBadscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connNotBad. = 0 |
| 26 | connBadscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connBad. = 1 |
| 27 | |
| 28 | connWorkingscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connWorking. = 0 |
| 29 | connClosedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connClosed. = 1 |
| 30 | ) |
| 31 | |
| 32 | // Response represents the raw response from a query, most of the time you |
| 33 | // should instead use a Cursor when reading from the database. |
| 34 | type Responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response# struct { |
| 35 | Tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Token. int64 |
| 36 | Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Type. pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Response_ResponseTypescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Response_ResponseType# `json:"t"` |
| 37 | ErrorTypescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#ErrorType. pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Response_ErrorTypescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Response_ErrorType# `json:"e"` |
| 38 | Notesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Notes. []pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Response_ResponseNotescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Response_ResponseNote# `json:"n"` |
| 39 | Responsesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Responses. []jsonscip-go gomod github.com/golang/go/src go1.14 `encoding/json`/.RawMessagescip-go gomod github.com/golang/go/src go1.14 `encoding/json`/RawMessage# `json:"r"` |
| 40 | Backtracescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Backtrace. []interface{} `json:"b"` |
| 41 | Profilescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Profile. interface{} `json:"p"` |
| 42 | } |
| 43 | |
| 44 | // Connection is a connection to a rethinkdb database. Connection is not thread |
| 45 | // safe and should only be accessed be a single goroutine |
| 46 | type Connectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection# struct { |
| 47 | netscip-go gomod github.com/golang/go/src go1.14 net/.Connscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#Conn. |
| 48 | |
| 49 | addressscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#address. string |
| 50 | optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#opts. *ConnectOptsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts# |
| 51 | |
| 52 | _ [4]byte |
| 53 | tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#token. int64 |
| 54 | cursorsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#cursors. map[int64]*Cursorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor# |
| 55 | badscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#bad. int32 // 0 - not bad, 1 - bad |
| 56 | closedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#closed. int32 // 0 - working, 1 - closed |
| 57 | stopReadChanscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#stopReadChan. chan bool |
| 58 | readRequestsChanscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#readRequestsChan. chan tokenAndPromisescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise# |
| 59 | responseChanscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#responseChan. chan responseAndErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/responseAndError# |
| 60 | stopProcessingChanscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#stopProcessingChan. chan struct{} |
| 61 | muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#mu. syncscip-go gomod github.com/golang/go/src go1.14 sync/.Mutexscip-go gomod github.com/golang/go/src go1.14 sync/Mutex# |
| 62 | } |
| 63 | |
| 64 | type responseAndErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/responseAndError# struct { |
| 65 | responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/responseAndError#response. *Responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response# |
| 66 | errscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/responseAndError#err. error |
| 67 | } |
| 68 | |
| 69 | type responseAndCursorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/responseAndCursor# struct { |
| 70 | responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/responseAndCursor#response. *Responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response# |
| 71 | cursorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/responseAndCursor#cursor. *Cursorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor# |
| 72 | errscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/responseAndCursor#err. error |
| 73 | } |
| 74 | |
| 75 | type tokenAndPromisescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise# struct { |
| 76 | ctxscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#ctx. contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/.Contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/Context# |
| 77 | queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#query. *Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query# |
| 78 | promisescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#promise. chan responseAndCursorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/responseAndCursor# |
| 79 | spanscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#span. opentracingscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go`/.Spanscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go`/Span# |
| 80 | } |
| 81 | |
| 82 | // NewConnection creates a new connection to the database server |
| 83 | func NewConnectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/NewConnection().(address string, opts *ConnectOptsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#) (*Connectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#, error) { |
| 84 | keepAlivePeriod := defaultKeepAlivePeriodscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/defaultKeepAlivePeriod. |
| 85 | if opts.KeepAlivePeriodscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#KeepAlivePeriod. > 0 { |
| 86 | keepAlivePeriod = opts.KeepAlivePeriodscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#KeepAlivePeriod. |
| 87 | } |
| 88 | |
| 89 | // Connect to Server |
| 90 | var err error |
| 91 | var conn netscip-go gomod github.com/golang/go/src go1.14 net/.Connscip-go gomod github.com/golang/go/src go1.14 net/Conn# |
| 92 | nd := netscip-go gomod github.com/golang/go/src go1.14 net/.Dialerscip-go gomod github.com/golang/go/src go1.14 net/Dialer#{Timeoutscip-go gomod github.com/golang/go/src go1.14 net/Dialer#Timeout.: opts.Timeoutscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#Timeout., KeepAlivescip-go gomod github.com/golang/go/src go1.14 net/Dialer#KeepAlive.: keepAlivePeriod} |
| 93 | if opts.TLSConfigscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#TLSConfig. == nil { |
| 94 | conn, err = nd.Dialscip-go gomod github.com/golang/go/src go1.14 net/Dialer#Dial().("tcp", address) |
| 95 | } else { |
| 96 | conn, err = tlsscip-go gomod github.com/golang/go/src go1.14 `crypto/tls`/.DialWithDialerscip-go gomod github.com/golang/go/src go1.14 `crypto/tls`/DialWithDialer().(&nd, "tcp", address, opts.TLSConfigscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#TLSConfig.) |
| 97 | } |
| 98 | if err != nil { |
| 99 | return nil, RQLConnectionErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RQLConnectionError#{rqlErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/rqlError#(err.Error())} |
| 100 | } |
| 101 | |
| 102 | c := newConnectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/newConnection().(conn, address, opts) |
| 103 | |
| 104 | // Send handshake |
| 105 | handshake, err := c.handshakescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#handshake().(opts.HandshakeVersionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#HandshakeVersion.) |
| 106 | if err != nil { |
| 107 | return nil, err |
| 108 | } |
| 109 | |
| 110 | if err = handshake.Sendscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connectionHandshake#Send.(); err != nil { |
| 111 | return nil, err |
| 112 | } |
| 113 | |
| 114 | // NOTE: mock.go: Mock.Query() |
| 115 | // NOTE: connection_test.go: runConnection() |
| 116 | go c.readSocketscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#readSocket().() |
| 117 | go c.processResponsesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#processResponses().() |
| 118 | |
| 119 | return c, nil |
| 120 | } |
| 121 | |
| 122 | func newConnectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/newConnection().(conn netscip-go gomod github.com/golang/go/src go1.14 net/.Connscip-go gomod github.com/golang/go/src go1.14 net/Conn#, address string, opts *ConnectOptsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#) *Connectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection# { |
| 123 | c := &Connectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#{ |
| 124 | Connscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#Conn.: conn, |
| 125 | addressscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#address.: address, |
| 126 | optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#opts.: opts, |
| 127 | cursorsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#cursors.: make(map[int64]*Cursorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#), |
| 128 | stopReadChanscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#stopReadChan.: make(chan bool, 1), |
| 129 | badscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#bad.: connNotBadscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connNotBad., |
| 130 | closedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#closed.: connWorkingscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connWorking., |
| 131 | readRequestsChanscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#readRequestsChan.: make(chan tokenAndPromisescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#, 16), |
| 132 | responseChanscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#responseChan.: make(chan responseAndErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/responseAndError#, 16), |
| 133 | stopProcessingChanscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#stopProcessingChan.: make(chan struct{}), |
| 134 | } |
| 135 | return c |
| 136 | } |
| 137 | |
| 138 | // Close closes the underlying net.Conn |
| 139 | func (c *Connectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#) Closescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#Close().() error { |
| 140 | var err error |
| 141 | |
| 142 | c.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#mu..Lockscip-go gomod github.com/golang/go/src go1.14 sync/Mutex#Lock().() |
| 143 | defer c.muscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#mu..Unlockscip-go gomod github.com/golang/go/src go1.14 sync/Mutex#Unlock().() |
| 144 | |
| 145 | if !c.isClosedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#isClosed().() { |
| 146 | c.setClosedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#setClosed().() |
| 147 | close(c.stopReadChanscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#stopReadChan.) |
| 148 | err = c.Connscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#Conn..Closescip-go gomod github.com/golang/go/src go1.14 net/Conn#Close().() |
| 149 | } |
| 150 | |
| 151 | return err |
| 152 | } |
| 153 | |
| 154 | // Query sends a Query to the database, returning both the raw Response and a |
| 155 | // Cursor which should be used to view the query's response. |
| 156 | // |
| 157 | // This function is used internally by Run which should be used for most queries. |
| 158 | func (c *Connectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#) Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#Query().(ctx contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/.Contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/Context#, q Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#) (*Responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#, *Cursorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#, error) { |
| 159 | if c == nil { |
| 160 | return nil, nil, ErrConnectionClosedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ErrConnectionClosed. |
| 161 | } |
| 162 | if c.Connscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#Conn. == nil || c.isClosedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#isClosed().() { |
| 163 | c.setBadscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#setBad().() |
| 164 | return nil, nil, ErrConnectionClosedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ErrConnectionClosed. |
| 165 | } |
| 166 | if ctx == nil { |
| 167 | ctx = c.contextFromConnectionOptsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#contextFromConnectionOpts().() |
| 168 | } |
| 169 | |
| 170 | // Add token if query is a START/NOREPLY_WAIT |
| 171 | if q.Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Type. == pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Query_STARTscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Query_START. || q.Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Type. == pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Query_NOREPLY_WAITscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Query_NOREPLY_WAIT. || q.Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Type. == pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Query_SERVER_INFOscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Query_SERVER_INFO. { |
| 172 | q.Tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Token. = c.nextTokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#nextToken().() |
| 173 | } |
| 174 | if q.Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Type. == pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Query_STARTscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Query_START. || q.Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Type. == pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Query_NOREPLY_WAITscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Query_NOREPLY_WAIT. { |
| 175 | if c.optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#opts..Databasescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#Database. != "" { |
| 176 | var err error |
| 177 | q.Optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Opts.["db"], err = DBscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/DB().(c.optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#opts..Databasescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#Database.).Buildscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#Build().() |
| 178 | if err != nil { |
| 179 | return nil, nil, RQLDriverErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RQLDriverError#{rqlErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/rqlError#(err.Error())} |
| 180 | } |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | var fetchingSpan opentracingscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go`/.Spanscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go`/Span# |
| 185 | if c.optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#opts..UseOpentracingscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ConnectOpts#UseOpentracing. { |
| 186 | parentSpan := opentracingscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go`/.SpanFromContextscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go`/SpanFromContext().(ctx) |
| 187 | if parentSpan != nil { |
| 188 | if q.Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Type. == pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Query_STARTscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Query_START. { |
| 189 | querySpan := c.startTracingSpanscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#startTracingSpan().(parentSpan, &q) // will be Finished when cursor connClosed |
| 190 | parentSpan = querySpan |
| 191 | ctx = opentracingscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go`/.ContextWithSpanscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go`/ContextWithSpan().(ctx, querySpan) |
| 192 | } |
| 193 | |
| 194 | fetchingSpan = c.startTracingSpanscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#startTracingSpan().(parentSpan, &q) // will be Finished when response arrived |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | err := c.sendQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#sendQuery().(q) |
| 199 | if err != nil { |
| 200 | if fetchingSpan != nil { |
| 201 | extscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go/ext`/.Errorscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go/ext`/Error..Setscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go/ext`/boolTagName#Set().(fetchingSpan, true) |
| 202 | fetchingSpan.LogFieldsscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go`/Span#LogFields().(logscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go/log`/.Errorscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go/log`/Error().(err)) |
| 203 | fetchingSpan.Finishscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go`/Span#Finish().() |
| 204 | if q.Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Type. == pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Query_STARTscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Query_START. { |
| 205 | opentracingscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go`/.SpanFromContextscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go`/SpanFromContext().(ctx).Finishscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go`/Span#Finish().() |
| 206 | } |
| 207 | } |
| 208 | return nil, nil, err |
| 209 | } |
| 210 | |
| 211 | if noreply, ok := q.Optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Opts.["noreply"]; ok && noreply.(bool) { |
| 212 | return nil, nil, nil |
| 213 | } |
| 214 | |
| 215 | promise := make(chan responseAndCursorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/responseAndCursor#, 1) |
| 216 | select { |
| 217 | case c.readRequestsChanscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#readRequestsChan. <- tokenAndPromisescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#{ctxscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#ctx.: ctx, queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#query.: &q, spanscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#span.: fetchingSpan, promisescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#promise.: promise}: |
| 218 | case <-ctx.Donescip-go gomod github.com/golang/go/src go1.14 context/Context#Done().(): |
| 219 | return c.stopQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#stopQuery().(&q) |
| 220 | } |
| 221 | |
| 222 | select { |
| 223 | case future := <-promise: |
| 224 | return future.responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/responseAndCursor#response., future.cursorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/responseAndCursor#cursor., future.errscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/responseAndCursor#err. |
| 225 | case <-ctx.Donescip-go gomod github.com/golang/go/src go1.14 context/Context#Done().(): |
| 226 | return c.stopQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#stopQuery().(&q) |
| 227 | case <-c.stopProcessingChanscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#stopProcessingChan.: // connection readRequests processing stopped, promise can be never answered |
| 228 | return nil, nil, ErrConnectionClosedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ErrConnectionClosed. |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | func (c *Connectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#) stopQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#stopQuery().(q *Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#) (*Responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#, *Cursorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#, error) { |
| 233 | if q.Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Type. != pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Query_STOPscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Query_STOP. && !c.isClosedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#isClosed().() && !c.isBadscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#isBad().() { |
| 234 | stopQuery := newStopQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/newStopQuery().(q.Tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Token.) |
| 235 | _, _, _ = c.Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#Query().(c.contextFromConnectionOptsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#contextFromConnectionOpts().(), stopQuery) |
| 236 | } |
| 237 | return nil, nil, ErrQueryTimeoutscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ErrQueryTimeout. |
| 238 | } |
| 239 | |
| 240 | func (c *Connectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#) startTracingSpanscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#startTracingSpan().(parentSpan opentracingscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go`/.Spanscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go`/Span#, q *Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#) opentracingscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go`/.Spanscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go`/Span# { |
| 241 | span := parentSpan.Tracerscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go`/Span#Tracer().().StartSpanscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go`/Tracer#StartSpan().( |
| 242 | "Query_"+q.Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Type..Stringscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Query_QueryType#String().(), |
| 243 | opentracingscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go`/.ChildOfscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go`/ChildOf().(parentSpan.Contextscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go`/Span#Context().()), |
| 244 | extscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go/ext`/.SpanKindRPCClientscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go/ext`/SpanKindRPCClient.) |
| 245 | |
| 246 | extscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go/ext`/.PeerAddressscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go/ext`/PeerAddress..Setscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go/ext`/stringTagName#Set().(span, c.addressscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#address.) |
| 247 | extscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go/ext`/.Componentscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go/ext`/Component..Setscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go/ext`/stringTagName#Set().(span, "rethinkdb-go") |
| 248 | |
| 249 | if q.Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Type. == pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Query_STARTscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Query_START. { |
| 250 | span.LogFieldsscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go`/Span#LogFields().(logscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go/log`/.Stringscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go/log`/String().("query", q.Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Term..Stringscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Term#String().())) |
| 251 | } |
| 252 | |
| 253 | return span |
| 254 | } |
| 255 | |
| 256 | func (c *Connectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#) readSocketscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#readSocket().() { |
| 257 | for { |
| 258 | response, err := c.readResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#readResponse().() |
| 259 | |
| 260 | c.responseChanscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#responseChan. <- responseAndErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/responseAndError#{ |
| 261 | responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/responseAndError#response.: response, |
| 262 | errscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/responseAndError#err.: err, |
| 263 | } |
| 264 | |
| 265 | select { |
| 266 | case <-c.stopReadChanscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#stopReadChan.: |
| 267 | close(c.responseChanscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#responseChan.) |
| 268 | return |
| 269 | default: |
| 270 | } |
| 271 | } |
| 272 | } |
| 273 | |
| 274 | func (c *Connectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#) processResponsesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#processResponses().() { |
| 275 | readRequests := make([]tokenAndPromisescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#, 0, 16) |
| 276 | responses := make([]*Responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#, 0, 16) |
| 277 | for { |
| 278 | var response *Responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response# |
| 279 | var readRequest tokenAndPromisescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise# |
| 280 | var ok bool |
| 281 | |
| 282 | select { |
| 283 | case respPair, openned := <-c.responseChanscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#responseChan.: |
| 284 | if respPair.errscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/responseAndError#err. != nil { |
| 285 | // Transport socket error, can't continue to work |
| 286 | // Don't know return to who (no token) - return to all |
| 287 | broadcastErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/broadcastError().(readRequests, respPair.errscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/responseAndError#err.) |
| 288 | readRequests = []tokenAndPromisescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#{} |
| 289 | _ = c.Closescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#Close().() // next `if` will be called indirect cascade by closing chans |
| 290 | continue |
| 291 | } |
| 292 | if !openned { // responseChan is connClosed (stopReadChan is closed too) |
| 293 | close(c.stopProcessingChanscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#stopProcessingChan.) |
| 294 | broadcastErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/broadcastError().(readRequests, ErrConnectionClosedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ErrConnectionClosed.) |
| 295 | c.cursorsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#cursors. = nil |
| 296 | |
| 297 | return |
| 298 | } |
| 299 | |
| 300 | response = respPair.responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/responseAndError#response. |
| 301 | |
| 302 | readRequest, ok = getReadRequestscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/getReadRequest().(readRequests, respPair.responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/responseAndError#response..Tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Token.) |
| 303 | if !ok { |
| 304 | responses = append(responses, respPair.responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/responseAndError#response.) |
| 305 | continue |
| 306 | } |
| 307 | readRequests = removeReadRequestscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/removeReadRequest().(readRequests, respPair.responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/responseAndError#response..Tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Token.) |
| 308 | |
| 309 | case readRequest = <-c.readRequestsChanscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#readRequestsChan.: |
| 310 | response, ok = getResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/getResponse().(responses, readRequest.queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#query..Tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Token.) |
| 311 | if !ok { |
| 312 | readRequests = append(readRequests, readRequest) |
| 313 | continue |
| 314 | } |
| 315 | responses = removeResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/removeResponse().(responses, readRequest.queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#query..Tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Token.) |
| 316 | } |
| 317 | |
| 318 | response, cursor, err := c.processResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#processResponse().(readRequest.ctxscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#ctx., *readRequest.queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#query., response, readRequest.spanscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#span.) |
| 319 | if readRequest.promisescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#promise. != nil { |
| 320 | readRequest.promisescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#promise. <- responseAndCursorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/responseAndCursor#{responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/responseAndCursor#response.: response, cursorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/responseAndCursor#cursor.: cursor, errscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/responseAndCursor#err.: err} |
| 321 | close(readRequest.promisescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#promise.) |
| 322 | } |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | func broadcastErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/broadcastError().(readRequests []tokenAndPromisescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#, err error) { |
| 327 | for _, rr := range readRequests { |
| 328 | if rr.promisescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#promise. != nil { |
| 329 | rr.promisescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#promise. <- responseAndCursorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/responseAndCursor#{errscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/responseAndCursor#err.: err} |
| 330 | close(rr.promisescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#promise.) |
| 331 | } |
| 332 | } |
| 333 | } |
| 334 | |
| 335 | type ServerResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ServerResponse# struct { |
| 336 | IDscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ServerResponse#ID. string `rethinkdb:"id"` |
| 337 | Namescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ServerResponse#Name. string `rethinkdb:"name"` |
| 338 | } |
| 339 | |
| 340 | // Server returns the server name and server UUID being used by a connection. |
| 341 | func (c *Connectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#) Serverscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#Server().() (ServerResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ServerResponse#, error) { |
| 342 | var response ServerResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/ServerResponse# |
| 343 | |
| 344 | _, cur, err := c.Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#Query().(c.contextFromConnectionOptsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#contextFromConnectionOpts().(), Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#{ |
| 345 | Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Type.: pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Query_SERVER_INFOscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Query_SERVER_INFO., |
| 346 | }) |
| 347 | if err != nil { |
| 348 | return response, err |
| 349 | } |
| 350 | |
| 351 | if err = cur.Onescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#One().(&response); err != nil { |
| 352 | return response, err |
| 353 | } |
| 354 | |
| 355 | if err = cur.Closescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#Close().(); err != nil { |
| 356 | return response, err |
| 357 | } |
| 358 | |
| 359 | return response, nil |
| 360 | } |
| 361 | |
| 362 | // sendQuery marshals the Query and sends the JSON to the server. |
| 363 | func (c *Connectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#) sendQueryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#sendQuery().(q Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#) error { |
| 364 | buf := &bytesscip-go gomod github.com/golang/go/src go1.14 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.14 bytes/Buffer#{} |
| 365 | buf.Growscip-go gomod github.com/golang/go/src go1.14 bytes/Buffer#Grow().(respHeaderLenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/respHeaderLen.) |
| 366 | buf.Writescip-go gomod github.com/golang/go/src go1.14 bytes/Buffer#Write().(buf.Bytesscip-go gomod github.com/golang/go/src go1.14 bytes/Buffer#Bytes().()[:respHeaderLenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/respHeaderLen.]) // reserve for header |
| 367 | enc := jsonscip-go gomod github.com/golang/go/src go1.14 `encoding/json`/.NewEncoderscip-go gomod github.com/golang/go/src go1.14 `encoding/json`/NewEncoder().(buf) |
| 368 | |
| 369 | // Build query |
| 370 | err := enc.Encodescip-go gomod github.com/golang/go/src go1.14 `encoding/json`/Encoder#Encode().(q.Buildscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Build().()) |
| 371 | if err != nil { |
| 372 | return RQLDriverErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RQLDriverError#{rqlErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/rqlError#(fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.14 fmt/Sprintf().("Error building query: %s", err.Error()))} |
| 373 | } |
| 374 | |
| 375 | b := buf.Bytesscip-go gomod github.com/golang/go/src go1.14 bytes/Buffer#Bytes().() |
| 376 | |
| 377 | // Write header |
| 378 | binaryscip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/.LittleEndianscip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/LittleEndian..PutUint64scip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/littleEndian#PutUint64().(b, uint64(q.Tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Token.)) |
| 379 | binaryscip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/.LittleEndianscip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/LittleEndian..PutUint32scip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/littleEndian#PutUint32().(b[8:], uint32(len(b)-respHeaderLenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/respHeaderLen.)) |
| 380 | |
| 381 | // Send the JSON encoding of the query itself. |
| 382 | if err = c.writeDatascip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#writeData().(b); err != nil { |
| 383 | c.setBadscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#setBad().() |
| 384 | return RQLConnectionErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RQLConnectionError#{rqlErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/rqlError#(err.Error())} |
| 385 | } |
| 386 | |
| 387 | return nil |
| 388 | } |
| 389 | |
| 390 | // getToken generates the next query token, used to number requests and match |
| 391 | // responses with requests. |
| 392 | func (c *Connectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#) nextTokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#nextToken().() int64 { |
| 393 | // requires c.token to be 64-bit aligned on ARM |
| 394 | return atomicscip-go gomod github.com/golang/go/src go1.14 `sync/atomic`/.AddInt64scip-go gomod github.com/golang/go/src go1.14 `sync/atomic`/AddInt64().(&c.tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#token., 1) |
| 395 | } |
| 396 | |
| 397 | // readResponse attempts to read a Response from the server, if no response |
| 398 | // could be read then an error is returned. |
| 399 | func (c *Connectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#) readResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#readResponse().() (*Responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#, error) { |
| 400 | // due to this is pooled connection, it always reads from socket even if idle |
| 401 | // timeouts should be only on query-level with context |
| 402 | |
| 403 | // Read response header (token+length) |
| 404 | headerBuf := [respHeaderLenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/respHeaderLen.]byte{} |
| 405 | if _, err := c.readscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#read().(headerBuf[:]); err != nil { |
| 406 | c.setBadscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#setBad().() |
| 407 | return nil, RQLConnectionErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RQLConnectionError#{rqlErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/rqlError#(err.Error())} |
| 408 | } |
| 409 | |
| 410 | responseToken := int64(binaryscip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/.LittleEndianscip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/LittleEndian..Uint64scip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/littleEndian#Uint64().(headerBuf[:8])) |
| 411 | messageLength := binaryscip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/.LittleEndianscip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/LittleEndian..Uint32scip-go gomod github.com/golang/go/src go1.14 `encoding/binary`/littleEndian#Uint32().(headerBuf[8:]) |
| 412 | |
| 413 | // Read the JSON encoding of the Response itself. |
| 414 | b := make([]byte, int(messageLength)) |
| 415 | |
| 416 | if _, err := c.readscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#read().(b); err != nil { |
| 417 | c.setBadscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#setBad().() |
| 418 | return nil, RQLConnectionErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RQLConnectionError#{rqlErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/rqlError#(err.Error())} |
| 419 | } |
| 420 | |
| 421 | // Decode the response |
| 422 | var response = new(Responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#) |
| 423 | if err := jsonscip-go gomod github.com/golang/go/src go1.14 `encoding/json`/.Unmarshalscip-go gomod github.com/golang/go/src go1.14 `encoding/json`/Unmarshal().(b, response); err != nil { |
| 424 | c.setBadscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#setBad().() |
| 425 | return nil, RQLDriverErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RQLDriverError#{rqlErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/rqlError#(err.Error())} |
| 426 | } |
| 427 | response.Tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Token. = responseToken |
| 428 | |
| 429 | return response, nil |
| 430 | } |
| 431 | |
| 432 | // Called to fill response for the query |
| 433 | func (c *Connectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#) processResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#processResponse().(ctx contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/.Contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/Context#, q Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#, response *Responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#, span opentracingscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go`/.Spanscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go`/Span#) (r *Responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#, cur *Cursorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#, err error) { |
| 434 | if span != nil { |
| 435 | defer func() { |
| 436 | if err != nil { |
| 437 | extscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go/ext`/.Errorscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go/ext`/Error..Setscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go/ext`/boolTagName#Set().(span, true) |
| 438 | span.LogFieldsscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go`/Span#LogFields().(logscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go/log`/.Errorscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go/log`/Error().(err)) |
| 439 | } |
| 440 | span.Finishscip-go gomod github.com/opentracing/opentracing-go v1.1.0 `github.com/opentracing/opentracing-go`/Span#Finish().() |
| 441 | }() |
| 442 | } |
| 443 | |
| 444 | switch response.Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Type. { |
| 445 | case pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Response_CLIENT_ERRORscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Response_CLIENT_ERROR.: |
| 446 | return response, c.processErrorResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#processErrorResponse().(response), createClientErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/createClientError().(response, q.Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Term.) |
| 447 | case pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Response_COMPILE_ERRORscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Response_COMPILE_ERROR.: |
| 448 | return response, c.processErrorResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#processErrorResponse().(response), createCompileErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/createCompileError().(response, q.Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Term.) |
| 449 | case pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Response_RUNTIME_ERRORscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Response_RUNTIME_ERROR.: |
| 450 | return response, c.processErrorResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#processErrorResponse().(response), createRuntimeErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/createRuntimeError().(response.ErrorTypescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#ErrorType., response, q.Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Term.) |
| 451 | case pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Response_SUCCESS_ATOMscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Response_SUCCESS_ATOM., pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Response_SERVER_INFOscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Response_SERVER_INFO.: |
| 452 | return c.processAtomResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#processAtomResponse().(ctx, q, response) |
| 453 | case pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Response_SUCCESS_PARTIALscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Response_SUCCESS_PARTIAL.: |
| 454 | return c.processPartialResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#processPartialResponse().(ctx, q, response) |
| 455 | case pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Response_SUCCESS_SEQUENCEscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Response_SUCCESS_SEQUENCE.: |
| 456 | return c.processSequenceResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#processSequenceResponse().(ctx, q, response) |
| 457 | case pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Response_WAIT_COMPLETEscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Response_WAIT_COMPLETE.: |
| 458 | return c.processWaitResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#processWaitResponse().(response) |
| 459 | default: |
| 460 | return nil, nil, RQLDriverErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/RQLDriverError#{rqlErrorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/rqlError#(fmtscip-go gomod github.com/golang/go/src go1.14 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.14 fmt/Sprintf().("Unexpected response type: %v", response.Typescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Type..Stringscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Response_ResponseType#String().()))} |
| 461 | } |
| 462 | } |
| 463 | |
| 464 | func (c *Connectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#) processErrorResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#processErrorResponse().(response *Responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#) *Cursorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor# { |
| 465 | cursor := c.cursorsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#cursors.[response.Tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Token.] |
| 466 | delete(c.cursorsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#cursors., response.Tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Token.) |
| 467 | return cursor |
| 468 | } |
| 469 | |
| 470 | func (c *Connectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#) processAtomResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#processAtomResponse().(ctx contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/.Contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/Context#, q Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#, response *Responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#) (*Responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#, *Cursorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#, error) { |
| 471 | cursor := newCursorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/newCursor().(ctx, c, "Cursor", response.Tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Token., q.Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Term., q.Optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Opts.) |
| 472 | cursor.profilescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#profile. = response.Profilescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Profile. |
| 473 | cursor.extendscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#extend().(response) |
| 474 | |
| 475 | return response, cursor, nil |
| 476 | } |
| 477 | |
| 478 | func (c *Connectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#) processPartialResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#processPartialResponse().(ctx contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/.Contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/Context#, q Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#, response *Responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#) (*Responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#, *Cursorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#, error) { |
| 479 | cursorType := "Cursor" |
| 480 | if len(response.Notesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Notes.) > 0 { |
| 481 | switch response.Notesscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Notes.[0] { |
| 482 | case pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Response_SEQUENCE_FEEDscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Response_SEQUENCE_FEED.: |
| 483 | cursorType = "Feed" |
| 484 | case pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Response_ATOM_FEEDscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Response_ATOM_FEED.: |
| 485 | cursorType = "AtomFeed" |
| 486 | case pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Response_ORDER_BY_LIMIT_FEEDscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Response_ORDER_BY_LIMIT_FEED.: |
| 487 | cursorType = "OrderByLimitFeed" |
| 488 | case pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Response_UNIONED_FEEDscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Response_UNIONED_FEED.: |
| 489 | cursorType = "UnionedFeed" |
| 490 | case pscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/.Response_INCLUDES_STATESscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6/ql2`/Response_INCLUDES_STATES.: |
| 491 | cursorType = "IncludesFeed" |
| 492 | } |
| 493 | } |
| 494 | |
| 495 | cursor, ok := c.cursorsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#cursors.[response.Tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Token.] |
| 496 | if !ok { |
| 497 | // Create a new cursor if needed |
| 498 | cursor = newCursorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/newCursor().(ctx, c, cursorType, response.Tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Token., q.Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Term., q.Optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Opts.) |
| 499 | cursor.profilescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#profile. = response.Profilescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Profile. |
| 500 | |
| 501 | c.cursorsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#cursors.[response.Tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Token.] = cursor |
| 502 | } |
| 503 | |
| 504 | cursor.extendscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#extend().(response) |
| 505 | |
| 506 | return response, cursor, nil |
| 507 | } |
| 508 | |
| 509 | func (c *Connectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#) processSequenceResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#processSequenceResponse().(ctx contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/.Contextscip-go gomod golang.org/x/net eb5bcb51f2a3 `golang.org/x/net/context`/Context#, q Queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#, response *Responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#) (*Responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#, *Cursorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#, error) { |
| 510 | cursor, ok := c.cursorsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#cursors.[response.Tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Token.] |
| 511 | if !ok { |
| 512 | // Create a new cursor if needed |
| 513 | cursor = newCursorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/newCursor().(ctx, c, "Cursor", response.Tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Token., q.Termscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Term., q.Optsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Opts.) |
| 514 | cursor.profilescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#profile. = response.Profilescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Profile. |
| 515 | } |
| 516 | delete(c.cursorsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#cursors., response.Tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Token.) |
| 517 | |
| 518 | cursor.extendscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#extend().(response) |
| 519 | |
| 520 | return response, cursor, nil |
| 521 | } |
| 522 | |
| 523 | func (c *Connectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#) processWaitResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#processWaitResponse().(response *Responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#) (*Responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#, *Cursorscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Cursor#, error) { |
| 524 | delete(c.cursorsscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#cursors., response.Tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Token.) |
| 525 | return response, nil, nil |
| 526 | } |
| 527 | |
| 528 | func (c *Connectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#) setBadscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#setBad().() { |
| 529 | atomicscip-go gomod github.com/golang/go/src go1.14 `sync/atomic`/.StoreInt32scip-go gomod github.com/golang/go/src go1.14 `sync/atomic`/StoreInt32().(&c.badscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#bad., connBadscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connBad.) |
| 530 | } |
| 531 | |
| 532 | func (c *Connectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#) isBadscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#isBad().() bool { |
| 533 | return atomicscip-go gomod github.com/golang/go/src go1.14 `sync/atomic`/.LoadInt32scip-go gomod github.com/golang/go/src go1.14 `sync/atomic`/LoadInt32().(&c.badscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#bad.) == connBadscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connBad. |
| 534 | } |
| 535 | |
| 536 | func (c *Connectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#) setClosedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#setClosed().() { |
| 537 | atomicscip-go gomod github.com/golang/go/src go1.14 `sync/atomic`/.StoreInt32scip-go gomod github.com/golang/go/src go1.14 `sync/atomic`/StoreInt32().(&c.closedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#closed., connClosedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connClosed.) |
| 538 | } |
| 539 | |
| 540 | func (c *Connectionscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#) isClosedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#isClosed().() bool { |
| 541 | return atomicscip-go gomod github.com/golang/go/src go1.14 `sync/atomic`/.LoadInt32scip-go gomod github.com/golang/go/src go1.14 `sync/atomic`/LoadInt32().(&c.closedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Connection#closed.) == connClosedscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/connClosed. |
| 542 | } |
| 543 | |
| 544 | func getReadRequestscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/getReadRequest().(list []tokenAndPromisescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#, token int64) (tokenAndPromisescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#, bool) { |
| 545 | for _, e := range list { |
| 546 | if e.queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#query..Tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Token. == token { |
| 547 | return e, true |
| 548 | } |
| 549 | } |
| 550 | return tokenAndPromisescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#{}, false |
| 551 | } |
| 552 | |
| 553 | func getResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/getResponse().(list []*Responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#, token int64) (*Responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#, bool) { |
| 554 | for _, e := range list { |
| 555 | if e.Tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Token. == token { |
| 556 | return e, true |
| 557 | } |
| 558 | } |
| 559 | return nil, false |
| 560 | } |
| 561 | |
| 562 | func removeReadRequestscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/removeReadRequest().(list []tokenAndPromisescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#, token int64) []tokenAndPromisescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise# { |
| 563 | for i := range list { |
| 564 | if list[i].queryscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/tokenAndPromise#query..Tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Query#Token. == token { |
| 565 | return append(list[:i], list[i+1:]...) |
| 566 | } |
| 567 | } |
| 568 | return list |
| 569 | } |
| 570 | |
| 571 | func removeResponsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/removeResponse().(list []*Responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#, token int64) []*Responsescip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response# { |
| 572 | for i := range list { |
| 573 | if list[i].Tokenscip-go gomod gopkg.in/rethinkdb/rethinkdb-go.v6 . `gopkg.in/rethinkdb/rethinkdb-go.v6`/Response#Token. == token { |
| 574 | return append(list[:i], list[i+1:]...) |
| 575 | } |
| 576 | } |
| 577 | return list |
| 578 | } |