mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-01-24 19:59:51 +00:00
14c5270e83
* Adds metrics to block exchange. * Adds metrics to purchasing * Adds metrics to upload and download API * Adds metrics to the repo store * Fixes exception in repostore start. * Merge managed to mess up indentation.
17 lines
455 B
Nim
17 lines
455 B
Nim
import pkg/metrics
|
|
import ../statemachine
|
|
import ./error
|
|
|
|
declareCounter(codexPurchasesFailed, "codex purchases failed")
|
|
|
|
type
|
|
PurchaseFailed* = ref object of PurchaseState
|
|
|
|
method `$`*(state: PurchaseFailed): string =
|
|
"failed"
|
|
|
|
method run*(state: PurchaseFailed, machine: Machine): Future[?State] {.async.} =
|
|
codexPurchasesFailed.inc()
|
|
let error = newException(PurchaseError, "Purchase failed")
|
|
return some State(PurchaseErrored(error: error))
|