actors

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2019 License: MIT Imports: 18 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActorHostedRequest

type ActorHostedRequest struct {
	ActorID   string `json:"actorId"`
	ActorType string `json:"actorType"`
}

ActorHostedRequest is the request object for checking if an actor is hosted on this instance

type Actors

type Actors interface {
	Call(req *CallRequest) (*CallResponse, error)
	Init() error
	GetState(req *GetStateRequest) (*StateResponse, error)
	SaveState(req *SaveStateRequest) error
	DeleteState(req *DeleteStateRequest) error
	TransactionalStateOperation(req *TransactionalRequest) error
	GetReminder(req *GetReminderRequest) (*Reminder, error)
	CreateReminder(req *CreateReminderRequest) error
	DeleteReminder(req *DeleteReminderRequest) error
	CreateTimer(req *CreateTimerRequest) error
	DeleteTimer(req *DeleteTimerRequest) error
	IsActorHosted(req *ActorHostedRequest) bool
}

Actors allow calling into virtual actors as well as actor state management

func NewActors

func NewActors(stateStore state.Store, appChannel channel.AppChannel, grpcConnectionFn func(address string) (*grpc.ClientConn, error), config Config) Actors

NewActors create a new actors runtime with given config

type CallRequest

type CallRequest struct {
	ActorType string            `json:"actorType"`
	ActorID   string            `json:"actorId"`
	Method    string            `json:"method"`
	Data      []byte            `json:"data"`
	Metadata  map[string]string `json:"metadata"`
}

CallRequest is the request object to call an actor

type CallResponse

type CallResponse struct {
	Data     []byte            `json:"data"`
	Metadata map[string]string `json:"metadata"`
}

CallResponse is the response object returned by an actor call

type Config

type Config struct {
	HostAddress                   string
	DaprID                        string
	PlacementServiceAddress       string
	HostedActorTypes              []string
	Port                          int
	HeartbeatInterval             time.Duration
	ActorDeactivationScanInterval time.Duration
	ActorIdleTimeout              time.Duration
	DrainOngoingCallTimeout       time.Duration
	DrainRebalancedActors         bool
}

Config is the actor runtime configuration

func NewConfig

func NewConfig(hostAddress, daprID, placementAddress string, hostedActors []string, port int,
	actorScanInterval, actorIdleTimeout, ongoingCallTimeout string, drainRebalancedActors bool) Config

NewConfig returns the actor runtime configuration

type CreateReminderRequest

type CreateReminderRequest struct {
	Name      string
	ActorType string
	ActorID   string
	Data      interface{} `json:"data"`
	DueTime   string      `json:"dueTime"`
	Period    string      `json:"period"`
}

CreateReminderRequest is the request object to create a new reminder

type CreateTimerRequest

type CreateTimerRequest struct {
	Name      string
	ActorType string
	ActorID   string
	DueTime   string      `json:"dueTime"`
	Period    string      `json:"period"`
	Callback  string      `json:"callback"`
	Data      interface{} `json:"data"`
}

CreateTimerRequest is the request object to create a new timer

type DeleteReminderRequest

type DeleteReminderRequest struct {
	Name      string
	ActorType string
	ActorID   string
}

DeleteReminderRequest is the request object for deleting a reminder

type DeleteStateRequest

type DeleteStateRequest struct {
	ActorID   string `json:"actorId"`
	ActorType string `json:"actorType"`
	Key       string `json:"key"`
}

DeleteStateRequest is the request object for deleting an actor state

type DeleteTimerRequest

type DeleteTimerRequest struct {
	Name      string
	ActorType string
	ActorID   string
}

DeleteTimerRequest is a request object for deleting a timer

type GetReminderRequest

type GetReminderRequest struct {
	Name      string
	ActorType string
	ActorID   string
}

GetReminderRequest is the request object to get an existing reminder

type GetStateRequest

type GetStateRequest struct {
	ActorID   string `json:"actorId"`
	ActorType string `json:"actorType"`
	Key       string `json:"key"`
}

GetStateRequest is the request object for getting actor state

type OperationType

type OperationType string

OperationType describes a CRUD operation performed against a state store

const Delete OperationType = "delete"

Delete is a delete operation

const Upsert OperationType = "upsert"

Upsert is an update or create operation

type Reminder

type Reminder struct {
	ActorID        string      `json:"actorID,omitempty"`
	ActorType      string      `json:"actorType,omitempty"`
	Name           string      `json:"name,omitempty"`
	Data           interface{} `json:"data"`
	Period         string      `json:"period"`
	DueTime        string      `json:"dueTime"`
	RegisteredTime string      `json:"registeredTime,omitempty"`
}

Reminder represents a persisted reminder for a unique actor

type ReminderResponse

type ReminderResponse struct {
	Data    interface{} `json:"data"`
	DueTime string      `json:"dueTime"`
	Period  string      `json:"period"`
}

ReminderResponse is the payload that is sent to an Actor SDK API for execution

type ReminderTrack

type ReminderTrack struct {
	LastFiredTime string `json:"lastFiredTime"`
}

ReminderTrack is a persisted object that keeps track of the last time a reminder fired

type SaveStateRequest

type SaveStateRequest struct {
	ActorID   string      `json:"actorId"`
	ActorType string      `json:"actorType"`
	Key       string      `json:"key"`
	Value     interface{} `json:"value"`
}

SaveStateRequest is the request object for saving an actor state

type StateResponse

type StateResponse struct {
	Data []byte `json:"data"`
}

StateResponse is the response returned from getting an actor state

type TimerResponse

type TimerResponse struct {
	Callback string      `json:"callback"`
	Data     interface{} `json:"data"`
	DueTime  string      `json:"dueTime"`
	Period   string      `json:"period"`
}

TimerResponse is the response object send to an Actor SDK API when a timer fires

type TransactionalDelete

type TransactionalDelete struct {
	Key string `json:"key"`
}

TransactionalDelete defined a delete operation

type TransactionalOperation

type TransactionalOperation struct {
	Operation OperationType `json:"operation"`
	Request   interface{}   `json:"request"`
}

TransactionalOperation is the request object for a state operation participating in a transaction

type TransactionalRequest

type TransactionalRequest struct {
	Operations []TransactionalOperation `json:"operations"`
	ActorType  string
	ActorID    string
}

TransactionalRequest describes a set of stateful operations for a given actor that are performed in a transactional manner

type TransactionalUpsert

type TransactionalUpsert struct {
	Key   string      `json:"key"`
	Value interface{} `json:"value"`
}

TransactionalUpsert defines a key/value pair for an upsert operation

Jump to

Keyboard shortcuts

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