-
Notifications
You must be signed in to change notification settings - Fork 0
/
session.go
55 lines (44 loc) · 1.1 KB
/
session.go
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
47
48
49
50
51
52
53
54
55
package riaken_struct
import (
core "github.com/riaken/riaken-core"
"github.com/riaken/riaken-core/rpb"
)
type Session struct {
client *Client
coreSession *core.Session
marshaller *StructMarshal
}
// CoreSession returns the underlying riaken-core Session.
func (s *Session) CoreSession() *core.Session {
return s.coreSession
}
func (s *Session) Release() {
s.coreSession.Release()
}
func (s *Session) GetBucket(name string) *Bucket {
b := new(Bucket)
b.session = s
b.coreBucket = s.coreSession.GetBucket(name)
return b
}
func (s *Session) Query() *Query {
q := new(Query)
q.session = s
q.coreQuery = s.coreSession.Query()
return q
}
func (s *Session) ListBuckets() ([]*core.Bucket, error) {
return s.coreSession.ListBuckets()
}
func (s *Session) Ping() bool {
return s.coreSession.Ping()
}
func (s *Session) GetClientId() (*rpb.RpbGetClientIdResp, error) {
return s.coreSession.GetClientId()
}
func (s *Session) SetClientId(id []byte) (bool, error) {
return s.coreSession.SetClientId(id)
}
func (s *Session) ServerInfo() (*rpb.RpbGetServerInfoResp, error) {
return s.coreSession.ServerInfo()
}