Documentation
¶
Index ¶
- Constants
- Variables
- func RunGenesis(ctx context.Context, cancel context.CancelFunc, config Config) error
- func RunPublisher(ctx context.Context, cancel context.CancelFunc, config Config, data []byte) error
- func RunSubscriber(ctx context.Context, cancel context.CancelFunc, config Config, data []byte) error
- type Config
- type Measurement
- type Message
Constants ¶
View Source
const ( WebHookEndpointTransaction = "/hook/transaction" MessageEndpoint = "/message" )
Variables ¶
View Source
var ErrFailedHook = errors.New("failed to create web hook")
Functions ¶
func RunGenesis ¶
func RunPublisher ¶
RunPublisher runs publisher emulator that emulates data in a buffer. Running emulator is stopped by canceling context.
func RunSubscriber ¶
func RunSubscriber(ctx context.Context, cancel context.CancelFunc, config Config, data []byte) error
RunSubscriber runs subscriber emulator. To stop the subscriber cancel the context.
Types ¶
type Config ¶
type Config struct {
ClientURL string `yaml:"client_url"`
Port string `yaml:"port"`
PublicURL string `yaml:"public_url"`
ReceiverPublicAddr string `yaml:"receiver_public_address"`
NotaryNodes []string `yaml:"notary_nodes"`
TickMillisecond int64 `yaml:"tick_millisecond"`
Random bool `yaml:"random"`
SpicePerTransaction int `yaml:"spice_per_transaction"`
SleepInSecBeforeStart int `yaml:"sleep_in_seconds_before_start"`
}
Config contains configuration for the emulator Publisher and Subscriber.
type Measurement ¶
type Measurement struct {
Volts int64 `json:"volts"`
Mamps int64 `json:"m_amps"`
Power int64 `json:"power"`
}
Measurement is data structure containing measurements received in a single transaction.
type Message ¶
type Message struct {
Status string `json:"status"`
Transaction transaction.Transaction `json:"transaction"`
Timestamp int64 `json:"timestamp"`
Volts int64 `json:"volts"`
MiliAmps int64 `json:"mili_amps"`
Power int64 `json:"power"`
}
Message holds timestamp info.
Click to show internal directories.
Click to hide internal directories.