mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-06 21:36:26 +00:00
lint: add markdown linter (#5254)
This commit is contained in:
@@ -1,31 +1,32 @@
|
||||
|
||||
|
||||
# events
|
||||
|
||||
`import "github.com/tendermint/tendermint/libs/events"`
|
||||
|
||||
* [Overview](#pkg-overview)
|
||||
* [Index](#pkg-index)
|
||||
|
||||
## <a name="pkg-overview">Overview</a>
|
||||
## Overview
|
||||
|
||||
Pub-Sub in go with event caching
|
||||
|
||||
## Index
|
||||
|
||||
|
||||
|
||||
## <a name="pkg-index">Index</a>
|
||||
* [type EventCache](#EventCache)
|
||||
* [func NewEventCache(evsw Fireable) *EventCache](#NewEventCache)
|
||||
* [func (evc *EventCache) FireEvent(event string, data EventData)](#EventCache.FireEvent)
|
||||
* [func (evc *EventCache) Flush()](#EventCache.Flush)
|
||||
* [func NewEventCache(evsw Fireable) *EventCache](#NewEventCache)
|
||||
* [func (evc *EventCache) FireEvent(event string, data EventData)](#EventCache.FireEvent)
|
||||
* [func (evc *EventCache) Flush()](#EventCache.Flush)
|
||||
* [type EventCallback](#EventCallback)
|
||||
* [type EventData](#EventData)
|
||||
* [type EventSwitch](#EventSwitch)
|
||||
* [func NewEventSwitch() EventSwitch](#NewEventSwitch)
|
||||
* [func NewEventSwitch() EventSwitch](#NewEventSwitch)
|
||||
* [type Eventable](#Eventable)
|
||||
* [type Fireable](#Fireable)
|
||||
|
||||
|
||||
#### <a name="pkg-files">Package files</a>
|
||||
### Package files
|
||||
|
||||
[event_cache.go](/src/github.com/tendermint/tendermint/libs/events/event_cache.go) [events.go](/src/github.com/tendermint/tendermint/libs/events/events.go)
|
||||
|
||||
|
||||
@@ -33,12 +34,14 @@ Pub-Sub in go with event caching
|
||||
|
||||
|
||||
|
||||
## <a name="EventCache">type</a> [EventCache](/src/target/event_cache.go?s=116:179#L5)
|
||||
## Type [EventCache](/src/target/event_cache.go?s=116:179#L5)
|
||||
|
||||
``` go
|
||||
type EventCache struct {
|
||||
// contains filtered or unexported fields
|
||||
}
|
||||
```
|
||||
|
||||
An EventCache buffers events for a Fireable
|
||||
All events are cached. Filtering happens on Flush
|
||||
|
||||
@@ -48,36 +51,43 @@ All events are cached. Filtering happens on Flush
|
||||
|
||||
|
||||
|
||||
### <a name="NewEventCache">func</a> [NewEventCache](/src/target/event_cache.go?s=239:284#L11)
|
||||
### func [NewEventCache](/src/target/event_cache.go?s=239:284#L11)
|
||||
|
||||
``` go
|
||||
func NewEventCache(evsw Fireable) *EventCache
|
||||
```
|
||||
|
||||
Create a new EventCache with an EventSwitch as backend
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
### <a name="EventCache.FireEvent">func</a> (\*EventCache) [FireEvent](/src/target/event_cache.go?s=449:511#L24)
|
||||
### func (\*EventCache) [FireEvent](/src/target/event_cache.go?s=449:511#L24)
|
||||
|
||||
``` go
|
||||
func (evc *EventCache) FireEvent(event string, data EventData)
|
||||
```
|
||||
|
||||
Cache an event to be fired upon finality.
|
||||
|
||||
|
||||
|
||||
|
||||
### <a name="EventCache.Flush">func</a> (\*EventCache) [Flush](/src/target/event_cache.go?s=735:765#L31)
|
||||
### func (\*EventCache) [Flush](/src/target/event_cache.go?s=735:765#L31)
|
||||
|
||||
``` go
|
||||
func (evc *EventCache) Flush()
|
||||
```
|
||||
|
||||
Fire events by running evsw.FireEvent on all cached events. Blocks.
|
||||
Clears cached events
|
||||
|
||||
|
||||
|
||||
|
||||
## <a name="EventCallback">type</a> [EventCallback](/src/target/events.go?s=4201:4240#L185)
|
||||
## Type [EventCallback](/src/target/events.go?s=4201:4240#L185)
|
||||
|
||||
``` go
|
||||
type EventCallback func(data EventData)
|
||||
```
|
||||
@@ -90,11 +100,13 @@ type EventCallback func(data EventData)
|
||||
|
||||
|
||||
|
||||
## <a name="EventData">type</a> [EventData](/src/target/events.go?s=243:294#L14)
|
||||
## Type [EventData](/src/target/events.go?s=243:294#L14)
|
||||
|
||||
``` go
|
||||
type EventData interface {
|
||||
}
|
||||
```
|
||||
|
||||
Generic event data can be typed and registered with tendermint/go-amino
|
||||
via concrete implementation of this interface
|
||||
|
||||
@@ -107,7 +119,8 @@ via concrete implementation of this interface
|
||||
|
||||
|
||||
|
||||
## <a name="EventSwitch">type</a> [EventSwitch](/src/target/events.go?s=560:771#L29)
|
||||
## Type [EventSwitch](/src/target/events.go?s=560:771#L29)
|
||||
|
||||
``` go
|
||||
type EventSwitch interface {
|
||||
service.Service
|
||||
@@ -124,7 +137,8 @@ type EventSwitch interface {
|
||||
|
||||
|
||||
|
||||
### <a name="NewEventSwitch">func</a> [NewEventSwitch](/src/target/events.go?s=917:950#L46)
|
||||
### func [NewEventSwitch](/src/target/events.go?s=917:950#L46)
|
||||
|
||||
``` go
|
||||
func NewEventSwitch() EventSwitch
|
||||
```
|
||||
@@ -132,12 +146,14 @@ func NewEventSwitch() EventSwitch
|
||||
|
||||
|
||||
|
||||
## <a name="Eventable">type</a> [Eventable](/src/target/events.go?s=378:440#L20)
|
||||
## Type [Eventable](/src/target/events.go?s=378:440#L20)
|
||||
|
||||
``` go
|
||||
type Eventable interface {
|
||||
SetEventSwitch(evsw EventSwitch)
|
||||
}
|
||||
```
|
||||
|
||||
reactors and other modules should export
|
||||
this interface to become eventable
|
||||
|
||||
@@ -150,12 +166,14 @@ this interface to become eventable
|
||||
|
||||
|
||||
|
||||
## <a name="Fireable">type</a> [Fireable](/src/target/events.go?s=490:558#L25)
|
||||
## Type [Fireable](/src/target/events.go?s=490:558#L25)
|
||||
|
||||
``` go
|
||||
type Fireable interface {
|
||||
FireEvent(event string, data EventData)
|
||||
}
|
||||
```
|
||||
|
||||
an event switch or cache implements fireable
|
||||
|
||||
|
||||
|
||||
@@ -7,4 +7,4 @@ go get github.com/mxk/go-flowrate/flowrate
|
||||
|
||||
The documentation is available at:
|
||||
|
||||
http://godoc.org/github.com/mxk/go-flowrate/flowrate
|
||||
<http://godoc.org/github.com/mxk/go-flowrate/flowrate>
|
||||
|
||||
Reference in New Issue
Block a user