Documentation ¶
Overview ¶
whenPkg implements the chifra when command.
The chifra when tool answers one of two questions: (1) "At what date and time did a given block occur?" or (2) "What block occurred at or before a given date and time?"
In the first case, supply a block number or hash and the date and time of that block are displayed. In the later case, supply a date (and optionally a time) and the block number that occurred at or just prior to that date is displayed.
The values for date and time are specified in JSON format. hour/minute/second are optional, and if omitted, default to zero in each case. Block numbers may be specified as either integers or hexadecimal number or block hashes. You may specify any number of dates and/or blocks per invocation.
Index ¶
- func ResetOptions(testMode bool)
- func RunWhen(cmd *cobra.Command, args []string) error
- func ServeWhen(w http.ResponseWriter, r *http.Request) error
- type WhenOptions
- func (opts *WhenOptions) HandleDecache(rCtx *output.RenderCtx) error
- func (opts *WhenOptions) HandleList(rCtx *output.RenderCtx) error
- func (opts *WhenOptions) HandleShow(rCtx *output.RenderCtx) error
- func (opts *WhenOptions) HandleTimestamps(rCtx *output.RenderCtx) error
- func (opts *WhenOptions) HandleTimestampsCheck(rCtx *output.RenderCtx) error
- func (opts *WhenOptions) HandleTimestampsCount(rCtx *output.RenderCtx) error
- func (opts *WhenOptions) HandleTimestampsRepair(rCtx *output.RenderCtx) error
- func (opts *WhenOptions) HandleTimestampsShow(rCtx *output.RenderCtx) error
- func (opts *WhenOptions) HandleTimestampsTruncate(rCtx *output.RenderCtx) error
- func (opts *WhenOptions) HandleTimestampsUpdate(rCtx *output.RenderCtx) error
- func (opts *WhenOptions) String() string
- func (opts *WhenOptions) WhenInternal(rCtx *output.RenderCtx) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResetOptions ¶
func ResetOptions(testMode bool)
Types ¶
type WhenOptions ¶
type WhenOptions struct { Blocks []string `json:"blocks,omitempty"` // One or more dates, block numbers, hashes, or special named blocks (see notes) BlockIds []identifiers.Identifier `json:"blockIds,omitempty"` // Block identifiers List bool `json:"list,omitempty"` // Export a list of the 'special' blocks Timestamps bool `json:"timestamps,omitempty"` // Display or process timestamps Count bool `json:"count,omitempty"` // With --timestamps only, returns the number of timestamps in the cache Truncate base.Blknum `json:"truncate,omitempty"` // With --timestamps only, truncates the timestamp file at this block Repair bool `json:"repair,omitempty"` // With --timestamps only, repairs block(s) in the block range by re-querying from the chain Check bool `json:"check,omitempty"` // With --timestamps only, checks the validity of the timestamp data Update bool `json:"update,omitempty"` // With --timestamps only, bring the timestamp database forward to the latest block Deep bool `json:"deep,omitempty"` // With --timestamps --check only, verifies timestamps from on chain (slow) Globals globals.GlobalOptions `json:"globals,omitempty"` // The global options Conn *rpc.Connection `json:"conn,omitempty"` // The connection to the RPC server BadFlag error `json:"badFlag,omitempty"` // An error flag if needed }
WhenOptions provides all command options for the chifra when command.
func GetOptions ¶
func GetOptions() *WhenOptions
func GetWhenOptions ¶
func GetWhenOptions(args []string, g *globals.GlobalOptions) *WhenOptions
GetWhenOptions returns the options for this tool so other tools may use it.
func WhenFinishParseInternal ¶
func WhenFinishParseInternal(w io.Writer, values url.Values) *WhenOptions
func (*WhenOptions) HandleDecache ¶
func (opts *WhenOptions) HandleDecache(rCtx *output.RenderCtx) error
func (*WhenOptions) HandleList ¶
func (opts *WhenOptions) HandleList(rCtx *output.RenderCtx) error
func (*WhenOptions) HandleShow ¶
func (opts *WhenOptions) HandleShow(rCtx *output.RenderCtx) error
func (*WhenOptions) HandleTimestamps ¶
func (opts *WhenOptions) HandleTimestamps(rCtx *output.RenderCtx) error
HandleTimestampsShow handles chifra when --timestamps
func (*WhenOptions) HandleTimestampsCheck ¶
func (opts *WhenOptions) HandleTimestampsCheck(rCtx *output.RenderCtx) error
HandleTimestampsCheck handles chifra when --timestamps --check
func (*WhenOptions) HandleTimestampsCount ¶
func (opts *WhenOptions) HandleTimestampsCount(rCtx *output.RenderCtx) error
func (*WhenOptions) HandleTimestampsRepair ¶
func (opts *WhenOptions) HandleTimestampsRepair(rCtx *output.RenderCtx) error
HandleTimestampsRepair handles chifra when --timestamps --reset <bn> to reset a single block's timestamps (call repeatedly if needed)
func (*WhenOptions) HandleTimestampsShow ¶
func (opts *WhenOptions) HandleTimestampsShow(rCtx *output.RenderCtx) error
HandleTimestampsShow handles chifra when --timestamps
func (*WhenOptions) HandleTimestampsTruncate ¶
func (opts *WhenOptions) HandleTimestampsTruncate(rCtx *output.RenderCtx) error
HandleTimestampsTruncate handles chifra when --timestamps --drop <bn>
func (*WhenOptions) HandleTimestampsUpdate ¶
func (opts *WhenOptions) HandleTimestampsUpdate(rCtx *output.RenderCtx) error
HandleTimestampsUpdate update the timestamp file to the latest block
func (*WhenOptions) String ¶
func (opts *WhenOptions) String() string
String implements the Stringer interface
func (*WhenOptions) WhenInternal ¶
func (opts *WhenOptions) WhenInternal(rCtx *output.RenderCtx) error
WhenInternal handles the internal workings of the when command. Returns an error.