value

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandID

type CommandID int64

type Context

type Context struct {
	EntityID EntityID
	// Entity describes the instance that is used as an entity.
	Entity *Entity
	// Instance is the instance of the entity this context is for.
	Instance EntityHandler
	// contains filtered or unexported fields
}

func (*Context) Delete

func (c *Context) Delete()

func (*Context) Forward

func (c *Context) Forward(forward *protocol.Forward)

func (*Context) SideEffect

func (c *Context) SideEffect(effect *protocol.SideEffect)

func (*Context) Update

func (c *Context) Update(state *any.Any, err error) error

type Entity

type Entity struct {
	// ServiceName is the fully qualified name of the service that implements
	// this entities interface. Setting it is mandatory.
	ServiceName ServiceName
	// EntityFunc creates a new entity.
	EntityFunc    func(EntityID) EntityHandler
	PersistenceID string

	PassivationStrategy protocol.EntityPassivationStrategy
}

func (*Entity) Options

func (e *Entity) Options(options ...Option)

type EntityHandler

type EntityHandler interface {
	HandleCommand(ctx *Context, name string, msg proto.Message) (*any.Any, error)
	HandleState(ctx *Context, state *any.Any) error
}

type EntityID

type EntityID string

type Option

type Option func(s *Entity)

func WithPassivationStrategyTimeout

func WithPassivationStrategyTimeout(duration time.Duration) Option

type Server

type Server struct {
	entity.UnimplementedValueEntityServer
	// contains filtered or unexported fields
}

func NewServer

func NewServer() *Server

func (*Server) Handle

func (s *Server) Handle(stream entity.ValueEntity_HandleServer) error

func (*Server) Register

func (s *Server) Register(e *Entity) error

type ServiceName

type ServiceName string

func (ServiceName) String

func (sn ServiceName) String() string

Jump to

Keyboard shortcuts

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