34 lines
1.1 KiB
Nim
34 lines
1.1 KiB
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
|
|
onExpiryUpdate*: ?OnExpiryUpdate
|
|
reservations*: Reservations
|
|
slotQueue*: SlotQueue
|
|
simulateProofFailures*: int
|
|
|
|
OnStore* = proc(request: StorageRequest,
|
|
slot: UInt256,
|
|
onBatch: BatchProc): Future[?!void] {.gcsafe, upraises: [].}
|
|
OnProve* = proc(slot: Slot, challenge: ProofChallenge): Future[seq[byte]] {.gcsafe, upraises: [].}
|
|
OnExpiryUpdate* = proc(rootCid: string, expiry: SecondsSince1970): Future[?!void] {.gcsafe, upraises: [].}
|
|
OnClear* = proc(request: StorageRequest,
|
|
slotIndex: UInt256) {.gcsafe, upraises: [].}
|
|
OnSale* = proc(request: StorageRequest,
|
|
slotIndex: UInt256) {.gcsafe, upraises: [].}
|