Documentation ¶
Index ¶
- type Block
- type Blockchain
- type Data
- type DataString
- type DiskStore
- type Ledger
- func (l *Ledger) Add(b string, s map[string]interface{})
- func (l *Ledger) Announce(ctx context.Context, d time.Duration, async func())
- func (l *Ledger) AnnounceDeleteBucket(ctx context.Context, interval, timeout time.Duration, bucket string)
- func (l *Ledger) AnnounceDeleteBucketKey(ctx context.Context, interval, timeout time.Duration, bucket, key string)
- func (l *Ledger) AnnounceUpdate(ctx context.Context, interval time.Duration, bucket, key string, ...)
- func (l *Ledger) CurrentData() map[string]map[string]Data
- func (l *Ledger) Delete(b string, k string)
- func (l *Ledger) DeleteBucket(b string)
- 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) Index() int
- func (l *Ledger) LastBlock() Block
- func (l *Ledger) Persist(ctx context.Context, interval, timeout time.Duration, bucket, key string, ...)
- func (l *Ledger) String() string
- func (l *Ledger) Syncronizer(ctx context.Context, t time.Duration)
- func (l *Ledger) Update(f *Ledger, h *hub.Message, c chan *hub.Message) (err error)
- type MemoryStore
- type Store
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 DataString ¶ added in v0.2.0
type DataString string
type DiskStore ¶ added in v0.3.0
type DiskStore struct {
// contains filtered or unexported fields
}
func NewDiskStore ¶ added in v0.3.0
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) AnnounceDeleteBucket ¶ added in v0.2.5
func (l *Ledger) AnnounceDeleteBucket(ctx context.Context, interval, timeout time.Duration, bucket string)
AnnounceDeleteBucket Announce a deletion of a bucket. It stops when the bucket is deleted It takes an interval time and a max timeout. It is best effort, and the timeout is necessary, or we might flood network with requests if more writers are attempting to write to the same resource
func (*Ledger) AnnounceDeleteBucketKey ¶ added in v0.2.5
func (l *Ledger) AnnounceDeleteBucketKey(ctx context.Context, interval, timeout time.Duration, bucket, key string)
AnnounceDeleteBucketKey Announce a deletion of a key from a bucket. It stops when the key is deleted
func (*Ledger) AnnounceUpdate ¶ added in v0.8.4
func (l *Ledger) AnnounceUpdate(ctx context.Context, interval time.Duration, bucket, key string, value interface{})
AnnounceUpdate Keeps announcing something into the blockchain if state is differing
func (*Ledger) CurrentData ¶ added in v0.1.0
CurrentData returns the current ledger data (locking)
func (*Ledger) DeleteBucket ¶ added in v0.2.4
DeleteBucket deletes a bucket from the ledger (locking)
func (*Ledger) Exists ¶ added in v0.1.0
Exists returns true if there is one element with a matching value
func (*Ledger) Persist ¶
func (l *Ledger) Persist(ctx context.Context, interval, timeout time.Duration, bucket, key string, value interface{})
Persist Keeps announcing something into the blockchain until it is reconciled
func (*Ledger) Syncronizer ¶
Syncronizer starts a goroutine which writes the blockchain to the periodically
type MemoryStore ¶ added in v0.3.0
func (*MemoryStore) Add ¶ added in v0.3.0
func (m *MemoryStore) Add(b Block)
func (*MemoryStore) Last ¶ added in v0.3.0
func (m *MemoryStore) Last() Block
func (*MemoryStore) Len ¶ added in v0.3.0
func (m *MemoryStore) Len() int