actor

package
v1.7.1-1.0-alpha Latest Latest
Warning

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

Go to latest
Published: May 31, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// Type defines the type of the actor server to be invoke
	Type() string
	// ID should be unique, the actor server with target ID would be created before server processing the invocation.
	ID() string
}

Client is the interface that should be impl by user's actor client.

type Factory

type Factory func() Server

type ReminderCallee

type ReminderCallee interface {
	ReminderCall(string, []byte, string, string)
}

type Server

type Server interface {
	// ID is impl by ServerImplBase. It can be called by user defined actor function to get the actor ID of it's instance.
	ID() string
	// SetID is impl by ServerImplBase. It is called by actor container to inject actor ID of the instance, and should
	// not called by user
	SetID(string)
	// Type is defined by user
	Type() string
	// SetStateManager is impl by ServerImplBase to inject StateManager to this actor instance
	SetStateManager(StateManager)
	// SaveState is impl by ServerImplBase, It saves the state cache of this actor instance to state store component by calling api of daprd.
	// Save state is called at two places: 1. On invocation of this actor instance. 2. When new actor starts.
	SaveState() error
}

Server is the interface that would be impl by user's actor server with ServerImplBase

Actor user should only impls func Type() string, and his user-defined-method, Other function could be impl by combining ServerImplBase.

type ServerImplBase

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

func (*ServerImplBase) GetStateManager

func (b *ServerImplBase) GetStateManager() StateManager

GetStateManager can be called by user-defined-method, to get state manager of this actor instance.

func (*ServerImplBase) ID

func (b *ServerImplBase) ID() string

func (*ServerImplBase) SaveState

func (b *ServerImplBase) SaveState() error

SaveState is to saves the state cache of this actor instance to state store component by calling api of daprd.

func (*ServerImplBase) SetID

func (b *ServerImplBase) SetID(id string)

func (*ServerImplBase) SetStateManager

func (b *ServerImplBase) SetStateManager(stateManager StateManager)

type StateManager

type StateManager interface {
	// Add is to add new state store with @stateName and @value
	Add(stateName string, value interface{}) error
	// Get is to get state store of @stateName with type @reply
	Get(stateName string, reply interface{}) error
	// Set is to set new state store with @stateName and @value
	Set(stateName string, value interface{}) error
	// Remove is to remove state store with @stateName
	Remove(stateName string) error
	// Contains is to check if state store contains @stateName
	Contains(stateName string) (bool, error)
	// Save is to saves the state cache of this actor instance to state store component by calling api of daprd.
	Save() error
	// Flush is called by stateManager after Save
	Flush()
}

Directories

Path Synopsis
Package actor is a generated GoMock package.
Package actor is a generated GoMock package.

Jump to

Keyboard shortcuts

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