Skip to content

Adding an Optional DeleteWithPrefix Method for State Stores to Allow Deletion of Actor State #3262

@RyanLettieri

Description

@RyanLettieri

Describe the proposal

This proposal stems from the following feature request inside dapr runimte: dapr/dapr#6992
After a discussion with various members of the project, the following solution was proposed: dapr/dapr#6992 (comment)

By adding in an optional interface called 'DeleteWithPrefix', we will allow users to delete an actor's state. The interface is optional since some databases will not be able to implement it as highlighted by ItalyPaleAle, an active contributor for dapr here: dapr/dapr#7223 (comment)

Looking at sqlite as an example, a second migration will be added in order to generate a virtual "prefix" column. This column will contain all the information from the actor state entry up to but not including the key. For example, if the key entry is as follows: app-id||actor-type||actor-id||key the new virtual prefix column will contain app-id||actor-type||actor-id

New request that would be included in state/requests.go:

type DeleteWithPrefixRequest struct {
	Prefix string `json:"prefix"`
}

New interface that would be included in state/store.go:

type DeleteWithPrefix interface {
	DeleteWithPrefix(ctx context.Context, req DeleteWithPrefixRequest) (DeleteWithPrefixResponse, error)
}

List of components that are compatible with this optional method:

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1pinnedIssue does not get stale

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions