Documentation ¶
Overview ¶
Retrieval and processing of timestamps.
Includes a few simple implementations of the TimestampService interface, so that not every test needs the full setup work of, say, the BitcoinTimestampService (not yet implemented).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DummyTimestampService ¶
type DummyTimestampService struct{}
Always successfully returns an empty timestamp list.
func (DummyTimestampService) GetTimestamps ¶
func (tss DummyTimestampService) GetTimestamps() ([]string, error)
type PeerTimestampService ¶
A timestamp service that includes a Document pointer, and always returns the doc.Timestamps list.
Bandaid implementation for timestamps accumulated from peers.
func NewPeerTimestampService ¶
func NewPeerTimestampService(doc *document.Document) PeerTimestampService
func (PeerTimestampService) GetTimestamps ¶
func (sts PeerTimestampService) GetTimestamps() ([]string, error)
type SortingTimestampService ¶
A timestamp service that includes a Document pointer, and always returns the sorted list of event hashes when you call GetTimestamps.
This is a useful approximation of real behavior for network-free testing, because the number of events will be small, and real timestamp services use hash sorting in any situation where the exact timing between two timestamps is ambiguous (multiple timestamps in the same block).
func NewSortingTimestampService ¶
func NewSortingTimestampService(doc document.Document) SortingTimestampService
func (SortingTimestampService) GetTimestamps ¶
func (sts SortingTimestampService) GetTimestamps() ([]string, error)
type TimestampService ¶
Different types of TimestampServices can be used, but the default implemetation makes use of the Bitcoin blockchain, given a bitcoind JSON-RPC location. Alternative timestamping services can simply be alternative blockchains, such as Litecoin, or something more exotic (if it can be made to fit the TimestampService interface).
See https://en.bitcoin.it/wiki/API_reference_%28JSON-RPC%29 for more information about this API.
type TimestampTracker ¶
type TimestampTracker struct { Doc *document.Document Service TimestampService // contains filtered or unexported fields }
func NewTimestampTracker ¶
func NewTimestampTracker(doc *document.Document, service TimestampService) TimestampTracker
func (*TimestampTracker) CompatibleWithTip ¶
func (tt *TimestampTracker) CompatibleWithTip(event *document.Event) bool
func (*TimestampTracker) FindLatest ¶
func (tt *TimestampTracker) FindLatest() (*document.Event, error)
Iterate until tip is found. Returns tip