event

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2023 License: Apache-2.0 Imports: 2 Imported by: 47

Documentation

Overview

Package event provides a basic API for app modules to emit events.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute added in v0.6.0

type Attribute struct {
	Key, Value string
}

KVEventAttribute is a kv-pair event attribute.

type Manager added in v0.6.0

type Manager interface {
	// Emit emits events represented as a protobuf message (as described in ADR 032).
	//
	// Callers SHOULD assume that these events may be included in consensus. These events
	// MUST be emitted deterministically and adding, removing or changing these events SHOULD
	// be considered state-machine breaking.
	Emit(ctx context.Context, event protoiface.MessageV1) error

	// EmitKV emits an event based on an event and kv-pair attributes.
	//
	// These events will not be part of consensus and adding, removing or changing these events is
	// not a state-machine breaking change.
	EmitKV(ctx context.Context, eventType string, attrs ...Attribute) error

	// EmitNonConsensus emits events represented as a protobuf message (as described in ADR 032), without
	// including it in blockchain consensus.
	//
	// These events will not be part of consensus and adding, removing or changing events is
	// not a state-machine breaking change.
	EmitNonConsensus(ctx context.Context, event protoiface.MessageV1) error
}

Manager represents an event manager which can emit events.

type Service

type Service interface {
	EventManager(context.Context) Manager
}

Service represents an event service which can retrieve and set an event manager in a context. event.Service is a core API type that should be provided by the runtime module being used to build an app via depinject.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL