Documentation
¶
Index ¶
- Constants
- type ActorHostedRequest
- type BulkStateResponse
- type CreateReminderRequest
- type CreateTimerRequest
- type DeleteReminderRequest
- type DeleteStateRequest
- type DeleteTimerRequest
- type EntityConfig
- type GetBulkStateRequest
- type GetReminderRequest
- type GetStateRequest
- type ListRemindersRequest
- type LookupActorRequest
- type LookupActorResponse
- type OperationType
- type Reminder
- func (r Reminder) ActorKey() string
- func (r Reminder) HasRepeats() bool
- func (r Reminder) Key() string
- func (r *Reminder) MarshalBSON() ([]byte, error)
- func (r *Reminder) MarshalJSON() ([]byte, error)
- func (r Reminder) NextTick() (time.Time, bool)
- func (r Reminder) RepeatsLeft() int
- func (r *Reminder) RequiresUpdating(new *Reminder) bool
- func (r Reminder) ScheduledTime() time.Time
- func (r Reminder) String() string
- func (r *Reminder) TickExecuted() (done bool)
- func (r *Reminder) UnmarshalJSON(data []byte) error
- func (r *Reminder) UpdateFromTrack(track *ReminderTrack)
- type ReminderPeriod
- type ReminderResponse
- type ReminderTrack
- type SaveStateRequest
- type StateOperationOpts
- type StateResponse
- type TimerResponse
- type TransactionalDelete
- type TransactionalOperation
- type TransactionalRequest
- type TransactionalUpsert
Constants ¶
const ( DefaultIdleTimeout = time.Minute * 60 DefaultOngoingCallTimeout = time.Second * 60 DefaultReentrancyStackLimit = 32 )
const (
DaprSeparator = "||"
)
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.
func (ActorHostedRequest) ActorKey ¶
func (r ActorHostedRequest) ActorKey() string
ActorKey returns the key of the actor for this request.
type BulkStateResponse ¶
BulkStateResponse is the response returned from getting an actor state in bulk. It's a map where the key is the key of the state, and the value is the value as byte slice.
type CreateReminderRequest ¶
type CreateReminderRequest struct { Name string ActorType string ActorID string Data *anypb.Any `json:"data"` DueTime string `json:"dueTime"` Period string `json:"period"` TTL string `json:"ttl"` IsOneShot bool `json:"-"` }
CreateReminderRequest is the request object to create a new reminder.
func (CreateReminderRequest) ActorKey ¶
func (req CreateReminderRequest) ActorKey() string
ActorKey returns the key of the actor for this reminder.
func (CreateReminderRequest) Key ¶
func (req CreateReminderRequest) Key() string
Key returns the key for this unique reminder.
func (CreateReminderRequest) NewReminder ¶
func (req CreateReminderRequest) NewReminder(now time.Time) (reminder *Reminder, err error)
NewReminder returns a new Reminder from a CreateReminderRequest object.
func (*CreateReminderRequest) UnmarshalJSON ¶
func (req *CreateReminderRequest) UnmarshalJSON(data []byte) error
type CreateTimerRequest ¶
type CreateTimerRequest struct { Name string ActorType string ActorID string DueTime string `json:"dueTime"` Period string `json:"period"` TTL string `json:"ttl"` Callback string `json:"callback"` Data *anypb.Any `json:"data"` }
CreateTimerRequest is the request object to create a new timer.
func (CreateTimerRequest) ActorKey ¶
func (req CreateTimerRequest) ActorKey() string
ActorKey returns the key of the actor for this timer.
func (CreateTimerRequest) Key ¶
func (req CreateTimerRequest) Key() string
Key returns the key for this unique timer.
func (CreateTimerRequest) NewReminder ¶
func (req CreateTimerRequest) NewReminder(now time.Time) (reminder *Reminder, err error)
NewReminder returns a new Timer from a CreateTimerRequest object.
func (*CreateTimerRequest) UnmarshalJSON ¶
func (req *CreateTimerRequest) UnmarshalJSON(data []byte) error
type DeleteReminderRequest ¶
DeleteReminderRequest is the request object for deleting a reminder.
func (DeleteReminderRequest) ActorKey ¶
func (req DeleteReminderRequest) ActorKey() string
ActorKey returns the key of the actor for this reminder.
func (DeleteReminderRequest) Key ¶
func (req DeleteReminderRequest) Key() string
Key returns the key for this unique 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.
func (DeleteStateRequest) ActorKey ¶
func (r DeleteStateRequest) ActorKey() string
ActorKey returns the key of the actor for this request.
type DeleteTimerRequest ¶
DeleteTimerRequest is a request object for deleting a timer.
func (DeleteTimerRequest) ActorKey ¶
func (req DeleteTimerRequest) ActorKey() string
ActorKey returns the key of the actor for this timer.
func (DeleteTimerRequest) Key ¶
func (req DeleteTimerRequest) Key() string
Key returns the key for this unique timer.
type EntityConfig ¶
type EntityConfig struct { Entities []string ActorIdleTimeout time.Duration DrainOngoingCallTimeout time.Duration DrainRebalancedActors bool ReentrancyConfig config.ReentrancyConfig RemindersStoragePartitions int }
Remap of config.EntityConfig.
func TranslateEntityConfig ¶
func TranslateEntityConfig(appConfig config.EntityConfig) EntityConfig
TranslateEntityConfig converts a user-defined configuration into a domain-specific EntityConfig.
type GetBulkStateRequest ¶
type GetBulkStateRequest struct { ActorID string `json:"actorId"` ActorType string `json:"actorType"` Keys []string `json:"keys"` }
GetBulkStateRequest is the request object for getting bulk actor state.
func (GetBulkStateRequest) ActorKey ¶
func (r GetBulkStateRequest) ActorKey() string
ActorKey returns the key of the actor for this request.
type GetReminderRequest ¶
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.
func (GetStateRequest) ActorKey ¶
func (r GetStateRequest) ActorKey() string
ActorKey returns the key of the actor for this request.
type ListRemindersRequest ¶
type ListRemindersRequest struct {
ActorType string
}
type LookupActorRequest ¶
LookupActorRequest is the request for LookupActor.
func (LookupActorRequest) ActorKey ¶
func (lar LookupActorRequest) ActorKey() string
ActorKey returns the key for the actor, which is "type/id".
type LookupActorResponse ¶
LookupActorResponse is the response from LookupActor.
type OperationType ¶
type OperationType string
OperationType describes a CRUD operation performed against a state store.
const ( // Upsert is an update or create operation. Upsert OperationType = "upsert" // Delete is a delete operation. Delete OperationType = "delete" )
type Reminder ¶
type Reminder struct { ActorID string `json:"actorID,omitempty"` ActorType string `json:"actorType,omitempty"` Name string `json:"name,omitempty"` Data *anypb.Any `json:"data,omitempty"` Period ReminderPeriod `json:"period,omitempty"` RegisteredTime time.Time `json:"registeredTime,omitempty"` DueTime string `json:"dueTime,omitempty"` // Exact input value from user ExpirationTime time.Time `json:"expirationTime,omitempty"` Callback string `json:"callback,omitempty"` // Used by timers only IsTimer bool `json:"-"` IsRemote bool `json:"-"` }
Reminder represents a reminder or timer for a unique actor.
func (Reminder) HasRepeats ¶
HasRepeats returns true if the reminder has repeats left.
func (*Reminder) MarshalBSON ¶
MarshalBSON implements bson.Marshaler. It encodes the message into a map[string]any before calling bson.Marshal.
func (*Reminder) MarshalJSON ¶
func (Reminder) NextTick ¶
NextTick returns the time the reminder should tick again next. If the reminder has a TTL and the next tick is beyond the TTL, the second returned value will be false.
func (Reminder) RepeatsLeft ¶
RepeatsLeft returns the number of repeats left.
func (*Reminder) RequiresUpdating ¶
func (Reminder) ScheduledTime ¶
ScheduledTime returns the time the reminder is scheduled to be executed at. This is implemented to comply with the queueable interface.
func (*Reminder) TickExecuted ¶
TickExecuted should be called after a reminder has been executed. "done" will be true if the reminder is done, i.e. no more executions should happen. If the reminder is not done, call "NextTick" to get the time it should tick next. Note: this method is not concurrency-safe.
func (*Reminder) UnmarshalJSON ¶
func (*Reminder) UpdateFromTrack ¶
func (r *Reminder) UpdateFromTrack(track *ReminderTrack)
UpdateFromTrack updates the reminder with data from the track object.
type ReminderPeriod ¶
type ReminderPeriod struct {
// contains filtered or unexported fields
}
ReminderPeriod contains the parsed period for a reminder.
func NewEmptyReminderPeriod ¶
func NewEmptyReminderPeriod() ReminderPeriod
NewEmptyReminderPeriod returns an empty ReminderPeriod, which has unlimited repeats.
func NewReminderPeriod ¶
func NewReminderPeriod(val string) (p ReminderPeriod, err error)
NewReminderPeriod parses a reminder period from a string and validates it.
func NewSchedulerReminderPeriod ¶
func NewSchedulerReminderPeriod(val string, repeats uint32) ReminderPeriod
NewSchedulerReminderPeriod returns a new reminder period from the Scheduler service job schedule.
func (ReminderPeriod) GetFollowing ¶
func (p ReminderPeriod) GetFollowing(t time.Time) time.Time
GetFollowing returns the next time the periodic reminder should fire after a given time.
func (ReminderPeriod) HasRepeats ¶
func (p ReminderPeriod) HasRepeats() bool
HasRepeats returns true if the period will repeat.
func (ReminderPeriod) MarshalJSON ¶
func (p ReminderPeriod) MarshalJSON() ([]byte, error)
func (ReminderPeriod) String ¶
func (p ReminderPeriod) String() string
String implements fmt.Stringer. It returns the value.
func (*ReminderPeriod) UnmarshalJSON ¶
func (p *ReminderPeriod) UnmarshalJSON(data []byte) error
type ReminderResponse ¶
type ReminderResponse struct { Data *anypb.Any `json:"data"` DueTime string `json:"dueTime"` Period string `json:"period"` }
ReminderResponse is the payload that is sent to an Actor SDK API for execution.
func (*ReminderResponse) MarshalJSON ¶
func (r *ReminderResponse) MarshalJSON() ([]byte, error)
MarshalJSON is a custom JSON marshaler that encodes the data as JSON. Actor SDKs expect "data" to be a base64-encoded message with the JSON representation of the data, so this makes sure that happens. This method implements the json.Marshaler interface.
type ReminderTrack ¶
type ReminderTrack struct { LastFiredTime time.Time `json:"lastFiredTime"` RepetitionLeft int `json:"repetitionLeft"` Etag *string `json:",omitempty"` }
ReminderTrack is a persisted object that keeps track of the last time a reminder fired.
func (*ReminderTrack) MarshalJSON ¶
func (r *ReminderTrack) MarshalJSON() ([]byte, error)
func (*ReminderTrack) UnmarshalJSON ¶
func (r *ReminderTrack) UnmarshalJSON(data []byte) error
type SaveStateRequest ¶
type SaveStateRequest struct { ActorID string `json:"actorId"` ActorType string `json:"actorType"` Key string `json:"key"` Value any `json:"value"` }
SaveStateRequest is the request object for saving an actor state.
type StateOperationOpts ¶
type StateOperationOpts struct { Metadata map[string]string ContentType *string // TODO: @joshvanl Remove in Dapr 1.12 when ActorStateTTL is finalized. StateTTLEnabled bool }
Options for the StateOperation method
type StateResponse ¶
type StateResponse struct { Data []byte `json:"data"` Metadata map[string]string `json:"metadata"` }
StateResponse is the response returned from getting an actor state.
type TimerResponse ¶
type TimerResponse struct { Callback string `json:"callback"` Data *anypb.Any `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.
func (*TimerResponse) MarshalJSON ¶
func (t *TimerResponse) MarshalJSON() ([]byte, error)
MarshalJSON is a custom JSON marshaler that encodes the data as JSON. Actor SDKs expect "data" to be a base64-encoded message with the JSON representation of the data, so this makes sure that happens. This method implements the json.Marshaler interface.
type TransactionalDelete ¶
TransactionalDelete defined a delete operation.
func (TransactionalDelete) StateOperation ¶
func (t TransactionalDelete) StateOperation(baseKey string, opts StateOperationOpts) (op state.TransactionalStateOperation, err error)
StateOperation returns the state.TransactionalStateOperation object.
type TransactionalOperation ¶
type TransactionalOperation struct { Operation OperationType `json:"operation"` Request any `json:"request"` }
TransactionalOperation is the request object for a state operation participating in a transaction.
func (TransactionalOperation) StateOperation ¶
func (t TransactionalOperation) StateOperation(baseKey string, opts StateOperationOpts) (op state.TransactionalStateOperation, err error)
StateOperation returns the state.TransactionalStateOperation object.
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.
func (TransactionalRequest) ActorKey ¶
func (r TransactionalRequest) ActorKey() string
ActorKey returns the key of the actor for this request.
type TransactionalUpsert ¶
type TransactionalUpsert struct { Key string `json:"key"` Value any `json:"value"` ETag *string `json:"etag,omitempty"` Metadata map[string]string `json:"metadata,omitempty"` }
TransactionalUpsert defines a key/value pair for an upsert operation.
func (TransactionalUpsert) StateOperation ¶
func (t TransactionalUpsert) StateOperation(baseKey string, opts StateOperationOpts) (op state.TransactionalStateOperation, err error)
StateOperation returns the state.TransactionalStateOperation object.