Documentation ¶
Index ¶
- type Block
- type Blockchain
- type Ledger
- func (l *Ledger) Add(s map[string]string)
- func (l *Ledger) ExistsValue(v string) (exists bool)
- func (l *Ledger) GetKey(s string) (value string, exists bool)
- func (l *Ledger) Persist(ctx context.Context, t time.Duration, key string, async func() string)
- func (l *Ledger) String() string
- func (l *Ledger) Syncronizer(ctx context.Context, t time.Duration)
- func (l *Ledger) Update(h *hub.Message) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct { Index int Timestamp string AddressMap map[string]string Hash string PrevHash string }
Block represents each 'item' in the blockchain
type Blockchain ¶
type Blockchain []Block
Blockchain is a series of validated Blocks
func (Blockchain) IsMoreRecent ¶
func (b Blockchain) IsMoreRecent(bb Blockchain) bool
type Ledger ¶
type Ledger struct { sync.Mutex Blockchain Blockchain // contains filtered or unexported fields }
func (*Ledger) ExistsValue ¶
ExistsValue returns true if there is one element with a matching value
func (*Ledger) Persist ¶
Persist an async data to the blockchain. Sends a broadcast at the specified interval by making sure the async retrieved value is written to the blockchain
func (*Ledger) Syncronizer ¶
Syncronizer starts a goroutine which writes the blockchain to the periodically
Click to show internal directories.
Click to hide internal directories.