revent

package module
v0.0.0-...-6c97dad Latest Latest
Warning

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

Go to latest
Published: May 5, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregate

type Aggregate interface {
	GetState() interface{}
	SetState(s interface{}) Aggregate
	Apply(event interface{}) Aggregate
	Events() []Event
}

type AggregateBaseState

type AggregateBaseState struct {
	Created   bool
	Destroyed bool
}

type App

type App struct {
	// contains filtered or unexported fields
}

func New

func New(config *AppConfig, opts ...AppOption) *App

func (*App) Handle

func (a *App) Handle(id string, cmd Command) error

func (*App) RegisterHandlers

func (a *App) RegisterHandlers(handlers ...Handler)

func (*App) RegisterProjections

func (a *App) RegisterProjections(projects ...Projection)

func (*App) Start

func (a *App) Start()

type AppConfig

type AppConfig struct {
	Name            string
	ClusterProvider cluster.ClusterProvider
	SnapshotStore   SnapshotStore
	EventStore      EventStore
}

type AppOption

type AppOption func(config *AppConfig)

type Command

type Command interface{}

type CommandAggregateCreator

type CommandAggregateCreator interface {
	CreateAggregate()
}

type CommandAggregateDestroyer

type CommandAggregateDestroyer interface {
	DestoryAggregate()
}

type CommandHandler

type CommandHandler struct {
	// contains filtered or unexported fields
}

aggregateHandler impls ghub.com/revent-dev/revent/proto.Aggregate

func (*CommandHandler) Handle

func (*CommandHandler) Init

func (h *CommandHandler) Init(ctx cluster.GrainContext)

func (*CommandHandler) ReceiveDefault

func (h *CommandHandler) ReceiveDefault(ctx cluster.GrainContext)

func (*CommandHandler) Terminate

func (h *CommandHandler) Terminate(ctx cluster.GrainContext)

type CommandValidator

type CommandValidator interface {
	Validate() error
}

type Container

type Container struct {
	// contains filtered or unexported fields
}

func (*Container) GetEvent

func (a *Container) GetEvent(name string) Event

type Event

type Event interface{}

type EventEnvelope

type EventEnvelope struct {
	Data     Event
	Metadata EventMetadata
}

type EventMetadata

type EventMetadata struct {
	AggregateID aggregate.AggregateID
}

type EventStore

type EventStore interface {
	AppendEvent(env EventEnvelope) error
	Subscribe() (chan EventEnvelope, error)
	SetAppContainer(c *Container)
}

type Handler

type Handler interface {
	Aggregate() Aggregate
	Handle(agg Aggregate, cmd Command) (Event, error)
	Commands() []Command
}

type Handlers

type Handlers map[string]Handler

command name -> handler

type LiveProjection

type LiveProjection interface {
	Projection
	LiveEvents() []Event
}

type Projection

type Projection interface {
	Process(event EventEnvelope) error
}

type Projector

type Projector struct {
	// contains filtered or unexported fields
}

github.com/revent-dev/revent/proto.Projector

func (*Projector) Init

func (p *Projector) Init(ctx cluster.GrainContext)

func (*Projector) ReceiveDefault

func (p *Projector) ReceiveDefault(ctx cluster.GrainContext)

func (*Projector) Start

func (*Projector) Terminate

func (p *Projector) Terminate(ctx cluster.GrainContext)

type Snapshot

type Snapshot struct {
	BaseState   interface{}
	UserState   interface{}
	UniqueValue string
}

type SnapshotStore

type SnapshotStore interface {
	GetSnapshot(id aggregate.AggregateID) (Snapshot, error)
	SaveSnapshot(id aggregate.AggregateID, snapshot Snapshot) error
}

type UniqueStateValue

type UniqueStateValue interface {
	GetUniqueValue() string
}

Directories

Path Synopsis
Package proto is generated by protoactor-go/protoc-gen-gograin@0.1.0
Package proto is generated by protoactor-go/protoc-gen-gograin@0.1.0
samples
store

Jump to

Keyboard shortcuts

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