diff --git a/loopdb/interface.go b/loopdb/interface.go index be7db05..295c536 100644 --- a/loopdb/interface.go +++ b/loopdb/interface.go @@ -20,6 +20,10 @@ type SwapStore interface { CreateLoopOut(ctx context.Context, hash lntypes.Hash, swap *LoopOutContract) error + // BatchCreateLoopOut creates a batch of loop out swaps to the store. + BatchCreateLoopOut(ctx context.Context, + swaps map[lntypes.Hash]*LoopOutContract) error + // 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. @@ -33,12 +37,20 @@ type SwapStore interface { CreateLoopIn(ctx context.Context, hash lntypes.Hash, swap *LoopInContract) error + // BatchCreateLoopIn creates a batch of loop in swaps to the store. + BatchCreateLoopIn(ctx context.Context, + swaps map[lntypes.Hash]*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. UpdateLoopIn(ctx context.Context, hash lntypes.Hash, time time.Time, state SwapStateData) error + // BatchInsertUpdate inserts batch of swap updates to the store. + BatchInsertUpdate(ctx context.Context, + updateData map[lntypes.Hash][]BatchInsertUpdateData) error + // PutLiquidityParams writes the serialized `manager.Parameters` bytes // into the bucket. // @@ -57,4 +69,11 @@ type SwapStore interface { Close() error } +// BatchInsertUpdateData is a struct that holds the data for the +// BatchInsertUpdate function. +type BatchInsertUpdateData struct { + Time time.Time + State SwapStateData +} + // TODO(roasbeef): back up method in interface? diff --git a/loopdb/store.go b/loopdb/store.go index d7025cc..9050a2c 100644 --- a/loopdb/store.go +++ b/loopdb/store.go @@ -985,3 +985,24 @@ func (s *boltSwapStore) fetchLoopInSwap(rootBucket *bbolt.Bucket, return &loop, nil } + +// BatchCreateLoopOut creates a batch of swaps to the store. +func (b *boltSwapStore) BatchCreateLoopOut(ctx context.Context, + swaps map[lntypes.Hash]*LoopOutContract) error { + + return errors.New("not implemented") +} + +// BatchCreateLoopIn creates a batch of loop in swaps to the store. +func (b *boltSwapStore) BatchCreateLoopIn(ctx context.Context, + swaps map[lntypes.Hash]*LoopInContract) error { + + return errors.New("not implemented") +} + +// BatchInsertUpdate inserts batch of swap updates to the store. +func (b *boltSwapStore) BatchInsertUpdate(ctx context.Context, + updateData map[lntypes.Hash][]BatchInsertUpdateData) error { + + return errors.New("not implemented") +} diff --git a/store_mock_test.go b/store_mock_test.go index 1b9b483..06c134d 100644 --- a/store_mock_test.go +++ b/store_mock_test.go @@ -303,3 +303,20 @@ func (s *storeMock) assertStoreFinished(expectedResult loopdb.SwapState) { s.t.Fatalf("expected swap to be finished") } } +func (b *storeMock) BatchCreateLoopOut(ctx context.Context, + swaps map[lntypes.Hash]*loopdb.LoopOutContract) error { + + return errors.New("not implemented") +} + +func (b *storeMock) BatchCreateLoopIn(ctx context.Context, + swaps map[lntypes.Hash]*loopdb.LoopInContract) error { + + return errors.New("not implemented") +} + +func (b *storeMock) BatchInsertUpdate(ctx context.Context, + updateData map[lntypes.Hash][]loopdb.BatchInsertUpdateData) error { + + return errors.New("not implemented") +}