loop/instantout/reservation/interfaces.go
Slyghtning c75d7e3e81
reservation: bound and prune active state machines
Limit newly accepted reservation state machines, resume all persisted
reservations, remove terminal entries from memory, and make cleanup
resilient to observer-driven eviction.
2026-08-11 21:27:34 +02:00

46 lines
1.3 KiB
Go

package reservation
import (
"context"
"fmt"
"github.com/lightninglabs/loop/swapserverrpc"
)
var (
ErrReservationAlreadyExists = fmt.Errorf("reservation already exists")
ErrReservationNotFound = fmt.Errorf("reservation not found")
ErrTooManyActiveReservations = fmt.Errorf(
"too many active reservations",
)
)
const (
KeyFamily = int32(42068)
DefaultConfTarget = int32(3)
IdLength = 32
maxActiveReservations = 1000
)
// Store is the interface that stores the reservations.
type Store interface {
// CreateReservation stores the reservation in the database.
CreateReservation(ctx context.Context, reservation *Reservation) error
// UpdateReservation updates the reservation in the database.
UpdateReservation(ctx context.Context, reservation *Reservation) error
// GetReservation retrieves the reservation from the database.
GetReservation(ctx context.Context, id ID) (*Reservation, error)
// ListReservations lists all existing reservations the client has ever
// made.
ListReservations(ctx context.Context) ([]*Reservation, error)
}
// NotificationManager handles subscribing to incoming reservation
// subscriptions.
type NotificationManager interface {
SubscribeReservations(context.Context,
) <-chan *swapserverrpc.ServerReservationNotification
}