mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-06 17:47:01 +02:00
watchtower/wtdb: add bolt db impl of Queue
This commit adds a new generic DiskQueueDB type which is an bbolt implementation of the Queue interface.
This commit is contained in:
@@ -94,6 +94,10 @@ var (
|
||||
// db-session-id -> last-channel-close-height
|
||||
cClosableSessionsBkt = []byte("client-closable-sessions-bucket")
|
||||
|
||||
// cTaskQueue is a top-level bucket where the disk queue may store its
|
||||
// content.
|
||||
cTaskQueue = []byte("client-task-queue")
|
||||
|
||||
// ErrTowerNotFound signals that the target tower was not found in the
|
||||
// database.
|
||||
ErrTowerNotFound = errors.New("tower not found")
|
||||
@@ -2060,6 +2064,15 @@ func (c *ClientDB) AckUpdate(id *SessionID, seqNum uint16,
|
||||
}, func() {})
|
||||
}
|
||||
|
||||
// GetDBQueue returns a BackupID Queue instance under the given namespace.
|
||||
func (c *ClientDB) GetDBQueue(namespace []byte) Queue[*BackupID] {
|
||||
return NewQueueDB[*BackupID](
|
||||
c.db, namespace, func() *BackupID {
|
||||
return &BackupID{}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
// putChannelToSessionMapping adds the given session ID to a channel's
|
||||
// cChanSessions bucket.
|
||||
func putChannelToSessionMapping(chanDetails kvdb.RwBucket,
|
||||
|
Reference in New Issue
Block a user