Documentation ¶
Index ¶
- type Block
- type Blockchain
- type Data
- type DataString
- type Ledger
- func (l *Ledger) Add(b string, s map[string]interface{})
- func (l *Ledger) Announce(ctx context.Context, t time.Duration, async func())
- func (l *Ledger) BlockChain() Blockchain
- func (l *Ledger) CurrentData() map[string]map[string]Data
- func (l *Ledger) Exists(b string, f func(Data) bool) (exists bool)
- func (l *Ledger) GetKey(b, s string) (value Data, exists bool)
- 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 Storage map[string]map[string]Data 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 DataString ¶ added in v0.2.0
type DataString string
type Ledger ¶
func (*Ledger) Announce ¶ added in v0.1.0
Announce keeps updating 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) BlockChain ¶ added in v0.1.0
func (l *Ledger) BlockChain() Blockchain
func (*Ledger) CurrentData ¶ added in v0.1.0
func (*Ledger) Exists ¶ added in v0.1.0
ExistsValue returns true if there is one element with a matching value
func (*Ledger) Syncronizer ¶
Syncronizer starts a goroutine which writes the blockchain to the periodically
Click to show internal directories.
Click to hide internal directories.