@@ -78,16 +78,16 @@ const (
7878 DefaultSessionDBTimeout = 5 * time .Second
7979)
8080
81- // DB is a bolt-backed persistent store.
82- type DB struct {
81+ // BoltStore is a bolt-backed persistent store.
82+ type BoltStore struct {
8383 * bbolt.DB
8484}
8585
86- // A compile-time check to ensure that DB implements the Store interface.
87- var _ Store = (* DB )(nil )
86+ // A compile-time check to ensure that BoltStore implements the Store interface.
87+ var _ Store = (* BoltStore )(nil )
8888
8989// NewDB creates a new bolt database that can be found at the given directory.
90- func NewDB (dir , fileName string ) (* DB , error ) {
90+ func NewDB (dir , fileName string ) (* BoltStore , error ) {
9191 firstInit := false
9292 path := filepath .Join (dir , fileName )
9393
@@ -110,7 +110,7 @@ func NewDB(dir, fileName string) (*DB, error) {
110110 return nil , err
111111 }
112112
113- return & DB {DB : db }, nil
113+ return & BoltStore {DB : db }, nil
114114}
115115
116116// fileExists reports whether the named file or directory exists.
@@ -181,7 +181,7 @@ func getSessionKey(session *Session) []byte {
181181// local public key already exists an error is returned.
182182//
183183// NOTE: this is part of the Store interface.
184- func (db * DB ) CreateSession (session * Session ) error {
184+ func (db * BoltStore ) CreateSession (session * Session ) error {
185185 var buf bytes.Buffer
186186 if err := SerializeSession (& buf , session ); err != nil {
187187 return err
@@ -275,7 +275,7 @@ func (db *DB) CreateSession(session *Session) error {
275275// to the session with the given local pub key.
276276//
277277// NOTE: this is part of the Store interface.
278- func (db * DB ) UpdateSessionRemotePubKey (localPubKey ,
278+ func (db * BoltStore ) UpdateSessionRemotePubKey (localPubKey ,
279279 remotePubKey * btcec.PublicKey ) error {
280280
281281 key := localPubKey .SerializeCompressed ()
@@ -313,7 +313,7 @@ func (db *DB) UpdateSessionRemotePubKey(localPubKey,
313313// GetSession fetches the session with the given key.
314314//
315315// NOTE: this is part of the Store interface.
316- func (db * DB ) GetSession (key * btcec.PublicKey ) (* Session , error ) {
316+ func (db * BoltStore ) GetSession (key * btcec.PublicKey ) (* Session , error ) {
317317 var session * Session
318318 err := db .View (func (tx * bbolt.Tx ) error {
319319 sessionBucket , err := getBucket (tx , sessionBucketKey )
@@ -343,7 +343,7 @@ func (db *DB) GetSession(key *btcec.PublicKey) (*Session, error) {
343343// ListSessions returns all sessions currently known to the store.
344344//
345345// NOTE: this is part of the Store interface.
346- func (db * DB ) ListSessions (filterFn func (s * Session ) bool ) ([]* Session , error ) {
346+ func (db * BoltStore ) ListSessions (filterFn func (s * Session ) bool ) ([]* Session , error ) {
347347 var sessions []* Session
348348 err := db .View (func (tx * bbolt.Tx ) error {
349349 sessionBucket , err := getBucket (tx , sessionBucketKey )
@@ -383,7 +383,7 @@ func (db *DB) ListSessions(filterFn func(s *Session) bool) ([]*Session, error) {
383383// public key to be revoked.
384384//
385385// NOTE: this is part of the Store interface.
386- func (db * DB ) RevokeSession (key * btcec.PublicKey ) error {
386+ func (db * BoltStore ) RevokeSession (key * btcec.PublicKey ) error {
387387 var session * Session
388388 return db .Update (func (tx * bbolt.Tx ) error {
389389 sessionBucket , err := getBucket (tx , sessionBucketKey )
@@ -416,7 +416,7 @@ func (db *DB) RevokeSession(key *btcec.PublicKey) error {
416416// GetSessionByID fetches the session with the given ID.
417417//
418418// NOTE: this is part of the Store interface.
419- func (db * DB ) GetSessionByID (id ID ) (* Session , error ) {
419+ func (db * BoltStore ) GetSessionByID (id ID ) (* Session , error ) {
420420 var session * Session
421421 err := db .View (func (tx * bbolt.Tx ) error {
422422 sessionBucket , err := getBucket (tx , sessionBucketKey )
@@ -454,7 +454,7 @@ func (db *DB) GetSessionByID(id ID) (*Session, error) {
454454// used or discarded.
455455//
456456// NOTE: this is part of the Store interface.
457- func (db * DB ) GetUnusedIDAndKeyPair () (ID , * btcec.PrivateKey , error ) {
457+ func (db * BoltStore ) GetUnusedIDAndKeyPair () (ID , * btcec.PrivateKey , error ) {
458458 var (
459459 id ID
460460 privKey * btcec.PrivateKey
@@ -500,7 +500,7 @@ func (db *DB) GetUnusedIDAndKeyPair() (ID, *btcec.PrivateKey, error) {
500500// GetGroupID will return the group ID for the given session ID.
501501//
502502// NOTE: this is part of the IDToGroupIndex interface.
503- func (db * DB ) GetGroupID (sessionID ID ) (ID , error ) {
503+ func (db * BoltStore ) GetGroupID (sessionID ID ) (ID , error ) {
504504 var groupID ID
505505 err := db .View (func (tx * bbolt.Tx ) error {
506506 sessionBkt , err := getBucket (tx , sessionBucketKey )
@@ -540,7 +540,7 @@ func (db *DB) GetGroupID(sessionID ID) (ID, error) {
540540// group with the given ID.
541541//
542542// NOTE: this is part of the IDToGroupIndex interface.
543- func (db * DB ) GetSessionIDs (groupID ID ) ([]ID , error ) {
543+ func (db * BoltStore ) GetSessionIDs (groupID ID ) ([]ID , error ) {
544544 var (
545545 sessionIDs []ID
546546 err error
@@ -567,7 +567,7 @@ func (db *DB) GetSessionIDs(groupID ID) ([]ID, error) {
567567// each session passes.
568568//
569569// NOTE: this is part of the Store interface.
570- func (db * DB ) CheckSessionGroupPredicate (groupID ID ,
570+ func (db * BoltStore ) CheckSessionGroupPredicate (groupID ID ,
571571 fn func (s * Session ) bool ) (bool , error ) {
572572
573573 var (
0 commit comments