Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PriceTimestamp ¶
PriceTimestamp maintains a price and its last update timestamp.
func NewPriceTimestamp ¶
func NewPriceTimestamp() *PriceTimestamp
NewPriceTimestamp creates a new PriceTimestamp.
func (*PriceTimestamp) GetValidPrice ¶
func (pt *PriceTimestamp) GetValidPrice(cutoffTime time.Time) (uint64, bool)
GetValidPrice returns (price, true) if the last update time is greater than or equal to the given cutoff time. Otherwise returns (0, false).
func (*PriceTimestamp) UpdatePrice ¶
func (pt *PriceTimestamp) UpdatePrice(price uint64, newUpdateTime *time.Time) bool
UpdatePrice updates the price if the given update has a greater timestamp. Returns true if updating succeeds. Otherwise, returns false.
Click to show internal directories.
Click to hide internal directories.