2019-03-07 02:19:57 +00:00
|
|
|
package loopdb
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/lightningnetwork/lnd/lntypes"
|
|
|
|
)
|
|
|
|
|
2019-03-07 04:32:24 +00:00
|
|
|
// SwapStore is the primary database interface used by the loopd system. It
|
|
|
|
// houses information for all pending completed/failed swaps.
|
2019-03-07 02:19:57 +00:00
|
|
|
type SwapStore interface {
|
2019-03-07 04:32:24 +00:00
|
|
|
// FetchLoopOutSwaps returns all swaps currently in the store.
|
|
|
|
FetchLoopOutSwaps() ([]*LoopOut, error)
|
2019-03-07 02:19:57 +00:00
|
|
|
|
2019-03-07 04:32:24 +00:00
|
|
|
// CreateLoopOut adds an initiated swap to the store.
|
|
|
|
CreateLoopOut(hash lntypes.Hash, swap *LoopOutContract) error
|
2019-03-07 02:19:57 +00:00
|
|
|
|
2019-03-07 04:32:24 +00:00
|
|
|
// UpdateLoopOut stores a new event for a target loop out swap. This
|
|
|
|
// appends to the event log for a particular swap as it goes through
|
|
|
|
// the various stages in its lifetime.
|
2019-05-15 11:55:41 +00:00
|
|
|
UpdateLoopOut(hash lntypes.Hash, time time.Time,
|
|
|
|
state SwapStateData) error
|
2019-03-07 02:19:57 +00:00
|
|
|
|
2019-03-12 15:09:57 +00:00
|
|
|
// FetchLoopInSwaps returns all swaps currently in the store.
|
|
|
|
FetchLoopInSwaps() ([]*LoopIn, error)
|
|
|
|
|
|
|
|
// CreateLoopIn adds an initiated swap to the store.
|
|
|
|
CreateLoopIn(hash lntypes.Hash, swap *LoopInContract) error
|
|
|
|
|
|
|
|
// UpdateLoopIn stores a new event for a target loop in swap. This
|
|
|
|
// appends to the event log for a particular swap as it goes through
|
|
|
|
// the various stages in its lifetime.
|
2019-05-15 11:55:41 +00:00
|
|
|
UpdateLoopIn(hash lntypes.Hash, time time.Time,
|
|
|
|
state SwapStateData) error
|
2019-03-12 15:09:57 +00:00
|
|
|
|
2019-03-07 02:19:57 +00:00
|
|
|
// Close closes the underlying database.
|
|
|
|
Close() error
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO(roasbeef): back up method in interface?
|