clock

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2023 License: Apache-2.0, BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewEvents = event.CreateGroupConstructor(func() (newEvents *Events) {
	return &Events{
		AcceptedTimeUpdated:  event.New1[time.Time](),
		ConfirmedTimeUpdated: event.New1[time.Time](),
	}
})

NewEvents is the constructor of the Events object.

Functions

This section is empty.

Types

type Clock

type Clock interface {
	// Accepted returns a notion of time that is anchored to the latest accepted block.
	Accepted() RelativeTime

	// Confirmed returns a notion of time that is anchored to the latest confirmed block.
	Confirmed() RelativeTime

	// Interface embeds the required methods of the module.Interface.
	module.Interface
}

Clock is an engine module that provides different notions of time according to the different levels of finality.

type Events

type Events struct {
	// AcceptedTimeUpdated is triggered when the accepted time is updated.
	AcceptedTimeUpdated *event.Event1[time.Time]

	// ConfirmedTimeUpdated is triggered when the confirmed time is updated.
	ConfirmedTimeUpdated *event.Event1[time.Time]

	// Group is trait that makes the dictionary linkable.
	event.Group[Events, *Events]
}

Events contains a dictionary of events that are triggered by the Clock.

type RelativeTime

type RelativeTime interface {
	// Time returns the original time value.
	Time() time.Time

	// RelativeTime returns the time value after it has advanced with the system clock.
	RelativeTime() time.Time
}

RelativeTime is a time value that monotonically advances with the system clock.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL