32 lines
958 B
Nim
32 lines
958 B
Nim
import pkg/questionable
|
|
import pkg/questionable/results
|
|
import pkg/upraises
|
|
import ../node/batch
|
|
import ../market
|
|
import ../clock
|
|
import ./slotqueue
|
|
import ./reservations
|
|
|
|
type
|
|
SalesContext* = ref object
|
|
market*: Market
|
|
clock*: Clock
|
|
# Sales-level callbacks. Closure will be overwritten each time a slot is
|
|
# processed.
|
|
onStore*: ?OnStore
|
|
onClear*: ?OnClear
|
|
onSale*: ?OnSale
|
|
onProve*: ?OnProve
|
|
reservations*: Reservations
|
|
slotQueue*: SlotQueue
|
|
simulateProofFailures*: int
|
|
|
|
OnStore* = proc(request: StorageRequest,
|
|
slot: UInt256,
|
|
onBatch: BatchProc): Future[?!void] {.gcsafe, upraises: [].}
|
|
OnProve* = proc(slot: Slot): Future[seq[byte]] {.gcsafe, upraises: [].}
|
|
OnClear* = proc(request: StorageRequest,
|
|
slotIndex: UInt256) {.gcsafe, upraises: [].}
|
|
OnSale* = proc(request: StorageRequest,
|
|
slotIndex: UInt256) {.gcsafe, upraises: [].}
|