forked from keybase/client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bserver_remote.go
629 lines (557 loc) · 19.4 KB
/
bserver_remote.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
// Copyright 2016 Keybase Inc. All rights reserved.
// Use of this source code is governed by a BSD
// license that can be found in the LICENSE file.
package libkbfs
import (
"sync"
"time"
"github.com/keybase/backoff"
"github.com/keybase/client/go/kbfs/idutil"
"github.com/keybase/client/go/kbfs/kbfsblock"
"github.com/keybase/client/go/kbfs/kbfscrypto"
"github.com/keybase/client/go/kbfs/tlf"
"github.com/keybase/client/go/libkb"
"github.com/keybase/client/go/logger"
"github.com/keybase/client/go/protocol/keybase1"
"github.com/keybase/go-framed-msgpack-rpc/rpc"
"golang.org/x/net/context"
)
const (
// BServerDefaultPingIntervalSeconds is the default interval on which the
// client should contact the block server.
BServerDefaultPingIntervalSeconds = 10
// BServerPingTimeout is how long to wait for a ping response
// before breaking the connection and trying to reconnect.
BServerPingTimeout = 30 * time.Second
)
// blockServerRemoteAuthTokenRefresher is a helper struct for
// refreshing auth tokens and managing connections.
type blockServerRemoteClientHandler struct {
kbCtx Context
name string
log logger.Logger
deferLog logger.Logger
csg idutil.CurrentSessionGetter
authToken *kbfscrypto.AuthToken
srvRemote rpc.Remote
connOpts rpc.ConnectionOpts
rpcLogFactory rpc.LogFactory
pinger pinger
connMu sync.RWMutex
conn *rpc.Connection
client keybase1.BlockInterface
}
func newBlockServerRemoteClientHandler(kbCtx Context, name string, log logger.Logger,
signer kbfscrypto.Signer, csg idutil.CurrentSessionGetter,
srvRemote rpc.Remote,
rpcLogFactory rpc.LogFactory) *blockServerRemoteClientHandler {
deferLog := log.CloneWithAddedDepth(1)
b := &blockServerRemoteClientHandler{
name: name,
log: log,
deferLog: deferLog,
csg: csg,
srvRemote: srvRemote,
rpcLogFactory: rpcLogFactory,
kbCtx: kbCtx,
}
b.pinger = pinger{
name: name,
doPing: b.pingOnce,
timeout: BServerPingTimeout,
log: log,
}
b.authToken = kbfscrypto.NewAuthToken(
signer, kbfsblock.ServerTokenServer, kbfsblock.ServerTokenExpireIn,
"libkbfs_bserver_remote", VersionString(), b)
constBackoff := backoff.NewConstantBackOff(RPCReconnectInterval)
b.connOpts = rpc.ConnectionOpts{
DontConnectNow: true, // connect only on-demand
WrapErrorFunc: libkb.WrapError,
TagsFunc: libkb.LogTagsFromContext,
ReconnectBackoff: func() backoff.BackOff { return constBackoff },
DialerTimeout: dialerTimeout,
InitialReconnectBackoffWindow: func() time.Duration { return bserverReconnectBackoffWindow },
}
b.initNewConnection()
return b
}
func (b *blockServerRemoteClientHandler) initNewConnection() {
b.connMu.Lock()
defer b.connMu.Unlock()
if b.conn != nil {
b.conn.Shutdown()
}
b.conn = rpc.NewTLSConnectionWithDialable(
b.srvRemote, kbfscrypto.GetRootCerts(
b.srvRemote.Peek(), libkb.GetBundledCAsFromHost),
kbfsblock.ServerErrorUnwrapper{}, b, b.rpcLogFactory,
logger.LogOutputWithDepthAdder{Logger: b.log},
rpc.DefaultMaxFrameLength, b.connOpts,
libkb.NewProxyDialable(b.kbCtx.GetEnv()))
b.client = keybase1.BlockClient{Cli: b.conn.GetClient()}
}
func (b *blockServerRemoteClientHandler) reconnect() error {
b.connMu.Lock()
defer b.connMu.Unlock()
if b.conn != nil {
ctx, cancel := context.WithTimeout(
context.Background(), reconnectTimeout)
defer cancel()
return b.conn.ForceReconnect(ctx)
}
b.initNewConnection()
return nil
}
func (b *blockServerRemoteClientHandler) shutdown() {
if b.authToken != nil {
b.authToken.Shutdown()
}
b.connMu.Lock()
defer b.connMu.Unlock()
if b.conn != nil {
b.conn.Shutdown()
}
// cancel the ping ticker
b.pinger.cancelTicker()
}
func (b *blockServerRemoteClientHandler) getClient() keybase1.BlockInterface {
b.connMu.RLock()
defer b.connMu.RUnlock()
return b.client
}
type ctxBServerResetKeyType int
const (
// ctxBServerResetKey identifies whether the current context has
// already passed through `BServerRemote.resetAuth`.
ctxBServerResetKey ctxBServerResetKeyType = iota
)
// resetAuth is called to reset the authorization on a BlockServer
// connection.
func (b *blockServerRemoteClientHandler) resetAuth(
ctx context.Context, c keybase1.BlockInterface) (err error) {
ctx = context.WithValue(ctx, ctxBServerResetKey, b.name)
defer func() {
b.deferLog.CDebugf(
ctx, "BlockServerRemote: resetAuth called, err: %#v", err)
}()
session, err := b.csg.GetCurrentSession(ctx)
if err != nil {
b.log.CDebugf(
ctx, "%s: User logged out, skipping resetAuth", b.name)
return nil
}
_, hasDeadline := ctx.Deadline()
if !hasDeadline {
var cancel context.CancelFunc
ctx, cancel = context.WithTimeout(ctx, reconnectTimeout)
defer cancel()
}
// request a challenge
challenge, err := c.GetSessionChallenge(ctx)
if err != nil {
return err
}
// get a new signature
signature, err := b.authToken.Sign(ctx, session.Name,
session.UID, session.VerifyingKey, challenge)
if err != nil {
return err
}
return c.AuthenticateSession(ctx, signature)
}
// RefreshAuthToken implements the AuthTokenRefreshHandler interface.
func (b *blockServerRemoteClientHandler) RefreshAuthToken(
ctx context.Context) {
if v := ctx.Value(ctxBServerResetKey); v == b.name {
b.log.CDebugf(ctx, "Avoiding resetAuth recursion")
return
}
if err := b.resetAuth(ctx, b.client); err != nil {
b.log.CDebugf(ctx, "%s: error refreshing auth token: %v", b.name, err)
}
}
var _ kbfscrypto.AuthTokenRefreshHandler = (*blockServerRemoteClientHandler)(nil)
// HandlerName implements the ConnectionHandler interface.
func (b *blockServerRemoteClientHandler) HandlerName() string {
return b.name
}
// OnConnect implements the ConnectionHandler interface.
func (b *blockServerRemoteClientHandler) OnConnect(ctx context.Context,
conn *rpc.Connection, client rpc.GenericClient, _ *rpc.Server) error {
// reset auth -- using client here would cause problematic recursion.
c := keybase1.BlockClient{Cli: client}
err := b.resetAuth(ctx, c)
if err != nil {
return err
}
// Start pinging.
b.pinger.resetTicker(BServerDefaultPingIntervalSeconds)
return nil
}
// OnConnectError implements the ConnectionHandler interface.
func (b *blockServerRemoteClientHandler) OnConnectError(err error, wait time.Duration) {
b.log.Warning("%s: connection error: %v; retrying in %s", b.name, err, wait)
if b.authToken != nil {
b.authToken.Shutdown()
}
b.pinger.cancelTicker()
// TODO: it might make sense to show something to the user if this is
// due to authentication, for example.
}
// OnDoCommandError implements the ConnectionHandler interface.
func (b *blockServerRemoteClientHandler) OnDoCommandError(err error, wait time.Duration) {
b.log.Warning("%s: DoCommand error: %v; retrying in %s", b.name, err, wait)
}
// OnDisconnected implements the ConnectionHandler interface.
func (b *blockServerRemoteClientHandler) OnDisconnected(ctx context.Context,
status rpc.DisconnectStatus) {
if status == rpc.StartingNonFirstConnection {
b.log.CWarningf(ctx, "%s: disconnected", b.name)
}
if b.authToken != nil {
b.authToken.Shutdown()
}
b.pinger.cancelTicker()
}
// ShouldRetry implements the ConnectionHandler interface.
func (b *blockServerRemoteClientHandler) ShouldRetry(rpcName string, err error) bool {
// Do not let connection.go's DoCommand retry any batch rpcs
// since batchDowngradeReferences already handles retries.
switch rpcName {
case "keybase.1.block.delReferenceWithCount":
return false
case "keybase.1.block.archiveReferenceWithCount":
return false
}
return kbfsblock.IsThrottleError(err)
}
// ShouldRetryOnConnect implements the ConnectionHandler interface.
func (b *blockServerRemoteClientHandler) ShouldRetryOnConnect(err error) bool {
_, inputCanceled := err.(libkb.InputCanceledError)
return !inputCanceled
}
var _ rpc.ConnectionHandler = (*blockServerRemoteClientHandler)(nil)
func (b *blockServerRemoteClientHandler) pingOnce(ctx context.Context) {
_, err := b.getClient().BlockPing(ctx)
if err == context.DeadlineExceeded {
b.log.CDebugf(
ctx, "%s: Ping timeout -- reinitializing connection", b.name)
if err = b.reconnect(); err != nil {
b.log.CDebugf(ctx, "reconnect error: %v", err)
}
} else if err != nil {
b.log.CDebugf(ctx, "%s: ping error %s", b.name, err)
}
}
type blockServerRemoteConfig interface {
diskBlockCacheGetter
codecGetter
signerGetter
currentSessionGetterGetter
logMaker
}
// BlockServerRemote implements the BlockServer interface and
// represents a remote KBFS block server.
type BlockServerRemote struct {
config blockServerRemoteConfig
shutdownFn func()
log traceLogger
deferLog traceLogger
blkSrvRemote rpc.Remote
putConn *blockServerRemoteClientHandler
getConn *blockServerRemoteClientHandler
}
// Test that BlockServerRemote fully implements the BlockServer interface.
var _ BlockServer = (*BlockServerRemote)(nil)
// NewBlockServerRemote constructs a new BlockServerRemote for the
// given address.
func NewBlockServerRemote(kbCtx Context, config blockServerRemoteConfig,
blkSrvRemote rpc.Remote, rpcLogFactory rpc.LogFactory) *BlockServerRemote {
log := config.MakeLogger("BSR")
deferLog := log.CloneWithAddedDepth(1)
bs := &BlockServerRemote{
config: config,
log: traceLogger{log},
deferLog: traceLogger{deferLog},
blkSrvRemote: blkSrvRemote,
}
// Use two separate auth clients -- one for writes and one for
// reads. This allows small reads to avoid getting trapped behind
// large asynchronous writes. TODO: use some real network QoS to
// achieve better prioritization within the actual network.
bs.putConn = newBlockServerRemoteClientHandler(kbCtx,
"BlockServerRemotePut", log, config.Signer(),
config.CurrentSessionGetter(), blkSrvRemote, rpcLogFactory)
bs.getConn = newBlockServerRemoteClientHandler(kbCtx,
"BlockServerRemoteGet", log, config.Signer(),
config.CurrentSessionGetter(), blkSrvRemote, rpcLogFactory)
bs.shutdownFn = func() {
bs.putConn.shutdown()
bs.getConn.shutdown()
}
return bs
}
// For testing.
func newBlockServerRemoteWithClient(kbCtx Context, config blockServerRemoteConfig,
client keybase1.BlockInterface) *BlockServerRemote {
log := config.MakeLogger("BSR")
deferLog := log.CloneWithAddedDepth(1)
bs := &BlockServerRemote{
config: config,
log: traceLogger{log},
deferLog: traceLogger{deferLog},
putConn: &blockServerRemoteClientHandler{
log: log,
deferLog: deferLog,
client: client,
kbCtx: kbCtx,
},
getConn: &blockServerRemoteClientHandler{
log: log,
deferLog: deferLog,
client: client,
kbCtx: kbCtx,
},
}
return bs
}
// RemoteAddress returns the remote bserver this client is talking to
func (b *BlockServerRemote) RemoteAddress() string {
return b.blkSrvRemote.String()
}
// RefreshAuthToken implements the AuthTokenRefreshHandler interface.
func (b *BlockServerRemote) RefreshAuthToken(ctx context.Context) {
b.putConn.RefreshAuthToken(ctx)
b.getConn.RefreshAuthToken(ctx)
}
// Get implements the BlockServer interface for BlockServerRemote.
func (b *BlockServerRemote) Get(
ctx context.Context, tlfID tlf.ID, id kbfsblock.ID,
context kbfsblock.Context, cacheType DiskBlockCacheType) (
buf []byte, serverHalf kbfscrypto.BlockCryptKeyServerHalf, err error) {
ctx = rpc.WithFireNow(ctx)
var res keybase1.GetBlockRes
b.log.LazyTrace(ctx, "BServer: Get %s", id)
// Once the block has been retrieved, cache it.
defer func() {
b.log.LazyTrace(ctx, "BServer: Get %s done (err=%v)", id, err)
if err != nil {
b.deferLog.CWarningf(
ctx, "Get id=%s tlf=%s context=%s sz=%d err=%v",
id, tlfID, context, len(buf), err)
} else {
// But don't cache it if it's archived data.
if res.Status == keybase1.BlockStatus_ARCHIVED {
return
}
b.deferLog.CDebugf(
ctx, "Get id=%s tlf=%s context=%s sz=%d",
id, tlfID, context, len(buf))
dbc := b.config.DiskBlockCache()
if dbc != nil {
// This used to be called in a goroutine to prevent
// blocking the `Get`. But we need this cached
// synchronously so prefetch operations can work
// correctly. No need to log an error since `dbc`
// will already log it.
_ = dbc.Put(ctx, tlfID, id, buf, serverHalf, cacheType)
}
}
}()
arg := kbfsblock.MakeGetBlockArg(tlfID, id, context)
res, err = b.getConn.getClient().GetBlock(ctx, arg)
return kbfsblock.ParseGetBlockRes(res, err)
}
// GetEncodedSize implements the BlockServer interface for BlockServerRemote.
func (b *BlockServerRemote) GetEncodedSize(
ctx context.Context, tlfID tlf.ID, id kbfsblock.ID,
context kbfsblock.Context) (
size uint32, status keybase1.BlockStatus, err error) {
ctx = rpc.WithFireNow(ctx)
b.log.LazyTrace(ctx, "BServer: GetEncodedSize %s", id)
defer func() {
b.log.LazyTrace(
ctx, "BServer: GetEncodedSize %s done (err=%v)", id, err)
if err != nil {
b.deferLog.CWarningf(
ctx, "GetEncodedSize id=%s tlf=%s context=%s err=%v",
id, tlfID, context, err)
} else {
b.deferLog.CDebugf(
ctx, "GetEncodedSize id=%s tlf=%s context=%s sz=%d status=%s",
id, tlfID, context, size, status)
}
}()
arg := kbfsblock.MakeGetBlockArg(tlfID, id, context)
arg.SizeOnly = true
res, err := b.getConn.getClient().GetBlock(ctx, arg)
if err != nil {
return 0, 0, nil
}
return uint32(res.Size), res.Status, nil
}
// Put implements the BlockServer interface for BlockServerRemote.
func (b *BlockServerRemote) Put(
ctx context.Context, tlfID tlf.ID, id kbfsblock.ID,
bContext kbfsblock.Context, buf []byte,
serverHalf kbfscrypto.BlockCryptKeyServerHalf,
cacheType DiskBlockCacheType) (err error) {
ctx = rpc.WithFireNow(ctx)
dbc := b.config.DiskBlockCache()
if dbc != nil {
err := dbc.Put(ctx, tlfID, id, buf, serverHalf, cacheType)
if err != nil {
return err
}
}
size := len(buf)
b.log.LazyTrace(ctx, "BServer: Put %s", id)
defer func() {
b.log.LazyTrace(ctx, "BServer: Put %s done (err=%v)", id, err)
if err != nil {
b.deferLog.CWarningf(
ctx, "Put id=%s tlf=%s context=%s sz=%d err=%v",
id, tlfID, bContext, size, err)
} else {
b.deferLog.CDebugf(
ctx, "Put id=%s tlf=%s context=%s sz=%d",
id, tlfID, bContext, size)
}
}()
arg := kbfsblock.MakePutBlockArg(tlfID, id, bContext, buf, serverHalf)
// Handle OverQuota errors at the caller
return b.putConn.getClient().PutBlock(ctx, arg)
}
// PutAgain implements the BlockServer interface for BlockServerRemote
func (b *BlockServerRemote) PutAgain(
ctx context.Context, tlfID tlf.ID, id kbfsblock.ID,
bContext kbfsblock.Context, buf []byte,
serverHalf kbfscrypto.BlockCryptKeyServerHalf,
cacheType DiskBlockCacheType) (err error) {
ctx = rpc.WithFireNow(ctx)
dbc := b.config.DiskBlockCache()
if dbc != nil {
err := dbc.Put(ctx, tlfID, id, buf, serverHalf, cacheType)
if err != nil {
return err
}
}
size := len(buf)
b.log.LazyTrace(ctx, "BServer: Put %s", id)
defer func() {
b.log.LazyTrace(ctx, "BServer: Put %s done (err=%v)", id, err)
if err != nil {
b.deferLog.CWarningf(
ctx, "Put id=%s tlf=%s context=%s sz=%d err=%v",
id, tlfID, bContext, size, err)
} else {
b.deferLog.CDebugf(
ctx, "Put id=%s tlf=%s context=%s sz=%d",
id, tlfID, bContext, size)
}
}()
arg := kbfsblock.MakePutBlockAgainArg(tlfID, id, bContext, buf, serverHalf)
// Handle OverQuota errors at the caller
return b.putConn.getClient().PutBlockAgain(ctx, arg)
}
// AddBlockReference implements the BlockServer interface for BlockServerRemote
func (b *BlockServerRemote) AddBlockReference(ctx context.Context, tlfID tlf.ID,
id kbfsblock.ID, context kbfsblock.Context) (err error) {
ctx = rpc.WithFireNow(ctx)
b.log.LazyTrace(ctx, "BServer: AddRef %s", id)
defer func() {
b.log.LazyTrace(ctx, "BServer: AddRef %s done (err=%v)", id, err)
if err != nil {
b.deferLog.CWarningf(
ctx, "AddBlockReference id=%s tlf=%s context=%s err=%v",
id, tlfID, context, err)
} else {
b.deferLog.CDebugf(
ctx, "AddBlockReference id=%s tlf=%s context=%s",
id, tlfID, context)
}
}()
arg := kbfsblock.MakeAddReferenceArg(tlfID, id, context)
// Handle OverQuota errors at the caller
return b.putConn.getClient().AddReference(ctx, arg)
}
// RemoveBlockReferences implements the BlockServer interface for
// BlockServerRemote
func (b *BlockServerRemote) RemoveBlockReferences(ctx context.Context,
tlfID tlf.ID, contexts kbfsblock.ContextMap) (liveCounts map[kbfsblock.ID]int, err error) {
ctx = rpc.WithFireNow(ctx)
// TODO: Define a more compact printout of contexts.
b.log.LazyTrace(ctx, "BServer: RemRef %v", contexts)
defer func() {
b.log.LazyTrace(ctx, "BServer: RemRef %v done (err=%v)", contexts, err)
if err != nil {
b.deferLog.CWarningf(ctx, "RemoveBlockReferences batch size=%d err=%v", len(contexts), err)
} else {
b.deferLog.CDebugf(ctx, "RemoveBlockReferences batch size=%d", len(contexts))
}
}()
doneRefs, err := kbfsblock.BatchDowngradeReferences(ctx, b.log, tlfID, contexts, false, b.putConn.getClient())
return kbfsblock.GetLiveCounts(doneRefs), err
}
// ArchiveBlockReferences implements the BlockServer interface for
// BlockServerRemote
func (b *BlockServerRemote) ArchiveBlockReferences(ctx context.Context,
tlfID tlf.ID, contexts kbfsblock.ContextMap) (err error) {
ctx = rpc.WithFireNow(ctx)
b.log.LazyTrace(ctx, "BServer: ArchiveRef %v", contexts)
defer func() {
b.log.LazyTrace(ctx, "BServer: ArchiveRef %v done (err=%v)", contexts, err)
if err != nil {
b.deferLog.CWarningf(ctx, "ArchiveBlockReferences batch size=%d err=%v", len(contexts), err)
} else {
b.deferLog.CDebugf(ctx, "ArchiveBlockReferences batch size=%d", len(contexts))
}
}()
_, err = kbfsblock.BatchDowngradeReferences(ctx, b.log, tlfID, contexts, true, b.putConn.getClient())
return err
}
// GetLiveBlockReferences implements the BlockServer interface for
// BlockServerRemote.
func (b *BlockServerRemote) GetLiveBlockReferences(
ctx context.Context, tlfID tlf.ID, contexts kbfsblock.ContextMap) (
liveCounts map[kbfsblock.ID]int, err error) {
return kbfsblock.GetReferenceCount(
ctx, tlfID, contexts, keybase1.BlockStatus_LIVE, b.getConn.getClient())
}
// IsUnflushed implements the BlockServer interface for BlockServerRemote.
func (b *BlockServerRemote) IsUnflushed(
_ context.Context, _ tlf.ID, _ kbfsblock.ID) (
bool, error) {
return false, nil
}
// GetUserQuotaInfo implements the BlockServer interface for BlockServerRemote
func (b *BlockServerRemote) GetUserQuotaInfo(ctx context.Context) (info *kbfsblock.QuotaInfo, err error) {
ctx = rpc.WithFireNow(ctx)
b.log.LazyTrace(ctx, "BServer: GetUserQuotaInfo")
defer func() {
b.log.LazyTrace(ctx, "BServer: GetUserQuotaInfo done (err=%v)", err)
}()
res, err := b.getConn.getClient().GetUserQuotaInfo(ctx)
return kbfsblock.ParseGetQuotaInfoRes(b.config.Codec(), res, err)
}
// GetTeamQuotaInfo implements the BlockServer interface for BlockServerRemote
func (b *BlockServerRemote) GetTeamQuotaInfo(
ctx context.Context, tid keybase1.TeamID) (
info *kbfsblock.QuotaInfo, err error) {
ctx = rpc.WithFireNow(ctx)
b.log.LazyTrace(ctx, "BServer: GetTeamQuotaInfo")
defer func() {
b.log.LazyTrace(ctx, "BServer: GetTeamQuotaInfo done (err=%v)", err)
}()
res, err := b.getConn.getClient().GetTeamQuotaInfo(ctx, tid)
return kbfsblock.ParseGetQuotaInfoRes(b.config.Codec(), res, err)
}
// Shutdown implements the BlockServer interface for BlockServerRemote.
func (b *BlockServerRemote) Shutdown(ctx context.Context) {
if b.shutdownFn != nil {
b.shutdownFn()
}
b.getConn.shutdown()
b.putConn.shutdown()
}