github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/service/badger.go (about) 1 // Copyright 2017 Keybase, Inc. All rights reserved. Use of 2 // this source code is governed by the included BSD license. 3 4 package service 5 6 import ( 7 "github.com/keybase/client/go/badges" 8 "github.com/keybase/client/go/libkb" 9 "github.com/keybase/client/go/protocol/keybase1" 10 "github.com/keybase/go-framed-msgpack-rpc/rpc" 11 "golang.org/x/net/context" 12 ) 13 14 type badgerHandler struct { 15 *BaseHandler 16 libkb.Contextified 17 18 badger *badges.Badger 19 } 20 21 func newBadgerHandler(xp rpc.Transporter, g *libkb.GlobalContext, badger *badges.Badger) *badgerHandler { 22 return &badgerHandler{ 23 BaseHandler: NewBaseHandler(g, xp), 24 Contextified: libkb.NewContextified(g), 25 badger: badger, 26 } 27 } 28 29 func (a *badgerHandler) GetBadgeState(ctx context.Context) (res keybase1.BadgeState, err error) { 30 a.G().Trace("GetBadgeState", &err)() 31 return a.badger.State().Export(ctx) 32 }