Documentation
¶
Index ¶
- Constants
- Variables
- func AllInstanceMetaPattern(namespace string) string
- func ConnInfo(c Component) string
- func InstanceKeyPattern(namespace, appID, instanceID string) string
- func InstanceMetaPattern(namespace, appID string) string
- func InstancePrefix(namespace, appID, instanceID string) string
- func ParseAppID(key string) (string, bool)
- func ParseInstanceID(key string) (string, bool)
- func ResolveSecrets(c Component, stores []SecretStore) (resolved map[string]string, unresolved []string)
- func SeedForTest(ctx context.Context, s Store, key string, value []byte) error
- func SetVerbose(v bool)
- func WorkflowActorType(namespace, appID string) string
- type Component
- type HostLookup
- type PathLookup
- type SecretRef
- type SecretStore
- type Store
Constants ¶
const ( KeyDelimiter = "||" SuffixMetadata = "metadata" SuffixCustomStatus = "customStatus" HistoryPrefix = "history-" )
Variables ¶
var ErrUnsupported = errors.New("unsupported state store type")
ErrUnsupported is returned by New when the component type is not one of the four supported backends (state.redis, state.sqlite, state.postgresql/postgres, state.mongodb).
Functions ¶
func AllInstanceMetaPattern ¶
AllInstanceMetaPattern is a KeysLike LIKE pattern matching every instance's metadata key across ALL app-ids in the namespace ("%" matches both the leading app-id segment and the app-id inside the actor type).
func ConnInfo ¶
ConnInfo returns a short, human-readable connection summary for a component, suitable for display in the UI. It NEVER includes credentials (passwords or user info). Returns "" when no usable, non-secret metadata is present.
func InstanceKeyPattern ¶
InstanceKeyPattern matches every state key belonging to one instance.
func InstanceMetaPattern ¶
InstanceMetaPattern is a KeysLike LIKE pattern matching every instance's metadata key for an app ("%" matches the instance-id segment).
func InstancePrefix ¶
InstancePrefix is the "<appId>||<actorType>||<instanceID>||" prefix.
func ParseAppID ¶
ParseAppID returns the app-id segment (segment[0]) of a "||"-joined workflow key. Returns ok=false for a malformed key (fewer than three segments or an empty app-id segment).
func ParseInstanceID ¶
ParseInstanceID returns the instance-id segment of a "||"-joined workflow key.
func ResolveSecrets ¶
func ResolveSecrets(c Component, stores []SecretStore) (resolved map[string]string, unresolved []string)
ResolveSecrets returns a copy of c.Metadata with each secretKeyRef entry resolved using the secret store named by c.SecretStore. Metadata keys that cannot be resolved are returned in unresolved and left out of the map.
func SeedForTest ¶
SeedForTest is a helper for integration tests that upserts a raw byte value through the public Store interface.
func SetVerbose ¶ added in v0.0.8
func SetVerbose(v bool)
SetVerbose lets the backend state stores emit informational logs; wire it to the dashboard's --verbose flag.
func WorkflowActorType ¶
WorkflowActorType builds the Dapr workflow actor type for an app.
Types ¶
type Component ¶
type Component struct {
Name string // metadata.name
Type string // spec.type, e.g. "state.redis"
Version string // spec.version
Metadata map[string]string // spec.metadata name->value (inline only)
SecretRefs map[string]SecretRef // spec.metadata name->secretKeyRef (no inline value)
SecretStore string // auth.secretStore
Path string // source file path (for display / disambiguation)
}
Component is the parsed subset of a Dapr state-store component YAML we need.
func Translate ¶
func Translate(c Component, hosts HostLookup, paths PathLookup) Component
Translate rewrites c's connection metadata for access from the host: state.redis redisHost, state.postgresql/postgres connection strings (URL or key=value DSN), and state.sqlite file paths. Only exact lookup hits are rewritten — foreign hostnames pass through so a connection failure stays honest. Copy-on-write: c is never mutated; the returned Component carries a fresh Metadata map only when something changed.
type HostLookup ¶
HostLookup resolves a compose-network hostname + port to a host-reachable "host:port". ok=false leaves the original address untouched.
type PathLookup ¶
PathLookup resolves a container-internal file path to a host path.
type SecretRef ¶
type SecretRef struct {
Name string // secretKeyRef.name (the secret's name)
Key string // secretKeyRef.key (the key within that secret)
}
SecretRef is a Dapr secretKeyRef: the secret name and the key within it.
type SecretStore ¶
type SecretStore struct {
Name string
Type string // "secretstores.local.file" | "secretstores.local.env"
SecretsFile string // local.file only: resolved absolute path to the JSON file
NestedSeparator string // local.file only: default ":"
}
SecretStore is a detected local Dapr secret-store component. Only the two local dev types are represented: secretstores.local.file and secretstores.local.env.
func DetectSecretStores ¶
func DetectSecretStores(paths []string) ([]SecretStore, error)
DetectSecretStores finds local secret-store components (local.file / local.env) under the given files or directories. Other secret-store types are ignored.
type Store ¶
type Store interface {
// Keys lists keys matching a LIKE pattern, with opaque cursor paging.
Keys(ctx context.Context, pattern string, token string, pageSize int) (keys []string, next string, err error)
Get(ctx context.Context, key string) ([]byte, error)
BulkGet(ctx context.Context, keys []string) (map[string][]byte, error)
Delete(ctx context.Context, key string) error
// Set upserts a raw byte value at key. Used by integration tests to seed state.
Set(ctx context.Context, key string, value []byte) error
Close() error
}
Store is the read + write + delete surface the workflow service needs.