multi: rename: ReadBucket to RBucket

This commit is contained in:
Conner Fromknecht
2020-05-06 15:48:00 -07:00
parent d0d2ca403d
commit 455ddfebdb
18 changed files with 63 additions and 63 deletions

View File

@@ -577,7 +577,7 @@ func (c *ClientDB) ListClientSessions(id *TowerID) (map[SessionID]*ClientSession
// listClientSessions returns the set of all client sessions known to the db. An
// optional tower ID can be used to filter out any client sessions in the
// response that do not correspond to this tower.
func listClientSessions(sessions kvdb.ReadBucket,
func listClientSessions(sessions kvdb.RBucket,
id *TowerID) (map[SessionID]*ClientSession, error) {
clientSessions := make(map[SessionID]*ClientSession)
@@ -894,7 +894,7 @@ func (c *ClientDB) AckUpdate(id *SessionID, seqNum uint16,
// bucket corresponding to the serialized session id. This does not deserialize
// the CommittedUpdates or AckUpdates associated with the session. If the caller
// requires this info, use getClientSession.
func getClientSessionBody(sessions kvdb.ReadBucket,
func getClientSessionBody(sessions kvdb.RBucket,
idBytes []byte) (*ClientSession, error) {
sessionBkt := sessions.NestedReadBucket(idBytes)
@@ -922,7 +922,7 @@ func getClientSessionBody(sessions kvdb.ReadBucket,
// getClientSession loads the full ClientSession associated with the serialized
// session id. This method populates the CommittedUpdates and AckUpdates in
// addition to the ClientSession's body.
func getClientSession(sessions kvdb.ReadBucket,
func getClientSession(sessions kvdb.RBucket,
idBytes []byte) (*ClientSession, error) {
session, err := getClientSessionBody(sessions, idBytes)
@@ -950,7 +950,7 @@ func getClientSession(sessions kvdb.ReadBucket,
// getClientSessionCommits retrieves all committed updates for the session
// identified by the serialized session id.
func getClientSessionCommits(sessions kvdb.ReadBucket,
func getClientSessionCommits(sessions kvdb.RBucket,
idBytes []byte) ([]CommittedUpdate, error) {
// Can't fail because client session body has already been read.
@@ -986,7 +986,7 @@ func getClientSessionCommits(sessions kvdb.ReadBucket,
// getClientSessionAcks retrieves all acked updates for the session identified
// by the serialized session id.
func getClientSessionAcks(sessions kvdb.ReadBucket,
func getClientSessionAcks(sessions kvdb.RBucket,
idBytes []byte) (map[uint16]BackupID, error) {
// Can't fail because client session body has already been read.
@@ -1050,7 +1050,7 @@ func markSessionStatus(sessions kvdb.RwBucket, session *ClientSession,
}
// getChanSummary loads a ClientChanSummary for the passed chanID.
func getChanSummary(chanSummaries kvdb.ReadBucket,
func getChanSummary(chanSummaries kvdb.RBucket,
chanID lnwire.ChannelID) (*ClientChanSummary, error) {
chanSummaryBytes := chanSummaries.Get(chanID[:])
@@ -1081,7 +1081,7 @@ func putChanSummary(chanSummaries kvdb.RwBucket, chanID lnwire.ChannelID,
}
// getTower loads a Tower identified by its serialized tower id.
func getTower(towers kvdb.ReadBucket, id []byte) (*Tower, error) {
func getTower(towers kvdb.RBucket, id []byte) (*Tower, error) {
towerBytes := towers.Get(id)
if towerBytes == nil {
return nil, ErrTowerNotFound

View File

@@ -505,7 +505,7 @@ func (t *TowerDB) GetLookoutTip() (*chainntnfs.BlockEpoch, error) {
// getSession retrieves the session info from the sessions bucket identified by
// its session id. An error is returned if the session is not found or a
// deserialization error occurs.
func getSession(sessions kvdb.ReadBucket, id []byte) (*SessionInfo, error) {
func getSession(sessions kvdb.RBucket, id []byte) (*SessionInfo, error) {
sessionBytes := sessions.Get(id)
if sessionBytes == nil {
return nil, ErrSessionNotFound
@@ -551,7 +551,7 @@ func removeSessionHintBkt(updateIndex kvdb.RwBucket, id *SessionID) error {
// getHintsForSession returns all known hints belonging to the given session id.
// If the index for the session has not been initialized, this method returns
// ErrNoSessionHintIndex.
func getHintsForSession(updateIndex kvdb.ReadBucket,
func getHintsForSession(updateIndex kvdb.RBucket,
id *SessionID) ([]blob.BreachHint, error) {
sessionHints := updateIndex.NestedReadBucket(id[:])
@@ -604,7 +604,7 @@ func putLookoutEpoch(bkt kvdb.RwBucket, epoch *chainntnfs.BlockEpoch) error {
// getLookoutEpoch retrieves the lookout tip block epoch from the given bucket.
// A nil epoch is returned if no update exists.
func getLookoutEpoch(bkt kvdb.ReadBucket) *chainntnfs.BlockEpoch {
func getLookoutEpoch(bkt kvdb.RBucket) *chainntnfs.BlockEpoch {
epochBytes := bkt.Get(lookoutTipKey)
if len(epochBytes) != 36 {
return nil
@@ -625,7 +625,7 @@ func getLookoutEpoch(bkt kvdb.ReadBucket) *chainntnfs.BlockEpoch {
var errBucketNotEmpty = errors.New("bucket not empty")
// isBucketEmpty returns errBucketNotEmpty if the bucket is not empty.
func isBucketEmpty(bkt kvdb.ReadBucket) error {
func isBucketEmpty(bkt kvdb.RBucket) error {
return bkt.ForEach(func(_, _ []byte) error {
return errBucketNotEmpty
})