-
Notifications
You must be signed in to change notification settings - Fork 218
Expand file tree
/
Copy pathsession.go
More file actions
46 lines (38 loc) · 838 Bytes
/
session.go
File metadata and controls
46 lines (38 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* Radon
*
* Copyright 2018 The Radon Authors.
* Code is licensed under the GPLv3.
*
*/
package proxy
import (
"sync"
"backend"
"github.com/xelabs/go-mysqlstack/driver"
"github.com/xelabs/go-mysqlstack/sqlparser"
)
type bitmask uint32
// session variables capabilities.
const (
cap_streaming_fetch bitmask = 1 << iota // streaming fetch for this session
)
type session struct {
mu sync.Mutex
node sqlparser.Statement
query string
session *driver.Session
timestamp int64
capabilities bitmask
transaction backend.Transaction
}
func (s *session) setStreamingFetchVar(r bool) {
if r {
s.capabilities |= cap_streaming_fetch
} else {
s.capabilities &= ^cap_streaming_fetch
}
}
func (s *session) getStreamingFetchVar() bool {
return s.capabilities&cap_streaming_fetch != 0
}