configuration

package
v1.13.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 2 Imported by: 15

README

Configuration

Configuration components provide a way for your applications to receive configuration values, dynamically.

Learn more about the Configuration building block in Dapr

Implementing a new configuration store

A compliant configuration store needs to implement the Store inteface included in the store.go file.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetRequest

type GetRequest struct {
	Keys     []string          `json:"keys"`
	Metadata map[string]string `json:"metadata"`
}

GetRequest is the object describing a request to get configuration.

type GetResponse

type GetResponse struct {
	Items map[string]*Item `json:"items"`
}

GetResponse is the request object for getting configuration.

type Item

type Item struct {
	Value    string            `json:"value,omitempty"`
	Version  string            `json:"version,omitempty"`
	Metadata map[string]string `json:"metadata,omitempty"`
}

Item represents a configuration item with name, content and other information.

type Metadata

type Metadata struct {
	metadata.Base `json:",inline"`
}

Metadata contains a configuration store specific set of metadata property.

type Store

type Store interface {
	metadata.ComponentWithMetadata

	// Init configuration store.
	Init(ctx context.Context, metadata Metadata) error

	// Get configuration.
	Get(ctx context.Context, req *GetRequest) (*GetResponse, error)

	// Subscribe configuration by update event.
	Subscribe(ctx context.Context, req *SubscribeRequest, handler UpdateHandler) (string, error)

	// Unsubscribe configuration with keys
	Unsubscribe(ctx context.Context, req *UnsubscribeRequest) error
}

Store is an interface to perform operations on store.

type SubscribeRequest

type SubscribeRequest struct {
	Keys     []string          `json:"keys"`
	Metadata map[string]string `json:"metadata"`
}

SubscribeRequest is the object describing a request to subscribe configuration.

type UnsubscribeRequest added in v1.7.0

type UnsubscribeRequest struct {
	ID string `json:"id"`
}

UnsubscribeRequest is the object describing a request to unsubscribe configuration.

type UpdateEvent

type UpdateEvent struct {
	ID    string           `json:"id"`
	Items map[string]*Item `json:"items"`
}

UpdateEvent is the object describing a configuration update event.

type UpdateHandler

type UpdateHandler func(ctx context.Context, e *UpdateEvent) error

UpdateHandler is the handler used to send event to daprd.

Directories

Path Synopsis
azure

Jump to

Keyboard shortcuts

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