cardano-wallet-core-2022.7.1: The Wallet Backend for a Cardano node.
Safe Haskell None
Language Haskell2010

Cardano.Wallet.Primitive.SyncProgress

Description

Functionality for calculating SyncProgress of wallets.

Synopsis

Types

data SyncProgress Source #

Instances

Instances details
Eq SyncProgress Source #
Instance details

Defined in Cardano.Wallet.Primitive.SyncProgress

Ord SyncProgress Source #
Instance details

Defined in Cardano.Wallet.Primitive.SyncProgress

Show SyncProgress Source #
Instance details

Defined in Cardano.Wallet.Primitive.SyncProgress

Generic SyncProgress Source #
Instance details

Defined in Cardano.Wallet.Primitive.SyncProgress

NFData SyncProgress Source #
Instance details

Defined in Cardano.Wallet.Primitive.SyncProgress

Buildable SyncProgress Source #
Instance details

Defined in Cardano.Wallet.Primitive.SyncProgress

NoThunks SyncProgress Source #
Instance details

Defined in Cardano.Wallet.Primitive.SyncProgress

ToJSON ( ApiT SyncProgress ) Source #
Instance details

Defined in Cardano.Wallet.Api.Types

FromJSON ( ApiT SyncProgress ) Source #
Instance details

Defined in Cardano.Wallet.Api.Types

type Rep SyncProgress Source #
Instance details

Defined in Cardano.Wallet.Primitive.SyncProgress

type Rep SyncProgress = D1 (' MetaData "SyncProgress" "Cardano.Wallet.Primitive.SyncProgress" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' False ) ( C1 (' MetaCons "Ready" ' PrefixI ' False ) ( U1 :: Type -> Type ) :+: ( C1 (' MetaCons "Syncing" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Quantity "percent" Percentage ))) :+: C1 (' MetaCons "NotResponding" ' PrefixI ' False ) ( U1 :: Type -> Type )))

newtype SyncTolerance Source #

Instances

Instances details
Eq SyncTolerance Source #
Instance details

Defined in Cardano.Wallet.Primitive.SyncProgress

Show SyncTolerance Source #
Instance details

Defined in Cardano.Wallet.Primitive.SyncProgress

Generic SyncTolerance Source #
Instance details

Defined in Cardano.Wallet.Primitive.SyncProgress

ToText SyncTolerance Source #
Instance details

Defined in Cardano.Wallet.Primitive.SyncProgress

FromText SyncTolerance Source #
Instance details

Defined in Cardano.Wallet.Primitive.SyncProgress

type Rep SyncTolerance Source #
Instance details

Defined in Cardano.Wallet.Primitive.SyncProgress

type Rep SyncTolerance = D1 (' MetaData "SyncTolerance" "Cardano.Wallet.Primitive.SyncProgress" "cardano-wallet-core-2022.7.1-AGKhlyz9liLKN3QqZD1gj" ' True ) ( C1 (' MetaCons "SyncTolerance" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 NominalDiffTime )))

Implementations

syncProgress Source #

Arguments

:: ( HasCallStack , Monad m)
=> SyncTolerance

A time tolerance inside which we consider ourselves synced

-> TimeInterpreter m

Converts slots to actual time.

-> SlotNo

Slot of latest block consumed

-> RelativeTime

Current wall clock time

-> m SyncProgress

Estimate restoration progress based on:

  • The slot of the latest block consumed (our progress)
  • The slot corresponding to the latest wall-clock time (our target)

The estimated progress is the quotient of these two quantities.

In the Cardano consensus protocol, only a fraction of slots contains blocks. Hence, the progress percentage will often be < 100%, as the slot corresponding to the current wall-clock time may not be filled with a block. The sync tolerance should be large enough to accommodate this issue.