metadata

package
v1.12.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: Apache-2.0 Imports: 13 Imported by: 157

Documentation

Index

Constants

View Source
const (
	// TTLMetadataKey defines the metadata key for setting a time to live (in seconds).
	TTLMetadataKey = "ttlInSeconds"

	// RawPayloadKey defines the metadata key for forcing raw payload in pubsub.
	RawPayloadKey = "rawPayload"

	// PriorityMetadataKey defines the metadata key for setting a priority.
	PriorityMetadataKey = "priority"

	// ContentType defines the metadata key for the content type.
	ContentType = "contentType"

	// QueryIndexName defines the metadata key for the name of query indexing schema (for redis).
	QueryIndexName = "queryIndexName"

	// MaxBulkPubBytesKey defines the maximum bytes to publish in a bulk publish request metadata.
	MaxBulkPubBytesKey string = "maxBulkPubBytes"
)

Variables

This section is empty.

Functions

func DecodeMetadata added in v1.9.0

func DecodeMetadata(input any, result any) error

DecodeMetadata decodes metadata into a struct This is an extension of mitchellh/mapstructure which also supports decoding durations

func GetMetadataInfoFromStructType added in v1.10.1

func GetMetadataInfoFromStructType(t reflect.Type, metadataMap *MetadataMap, componentType ComponentType) error

GetMetadataInfoFromStructType converts a struct to a map of field name (or struct tag) to field type. This is used to generate metadata documentation for components.

func GetMetadataProperty added in v1.9.0

func GetMetadataProperty(props map[string]string, keys ...string) (val string, ok bool)

GetMetadataProperty returns a property from the metadata map, with support for aliases

func IsRawPayload added in v1.2.0

func IsRawPayload(props map[string]string) (bool, error)

IsRawPayload determines if payload should be used as-is.

func TryGetContentType added in v1.5.0

func TryGetContentType(props map[string]string) (string, bool)

func TryGetPriority

func TryGetPriority(props map[string]string) (uint8, bool, error)

TryGetPriority tries to get the priority for binding and any other building block.

func TryGetQueryIndexName added in v1.7.0

func TryGetQueryIndexName(props map[string]string) (string, bool)

func TryGetTTL

func TryGetTTL(props map[string]string) (time.Duration, bool, error)

TryGetTTL tries to get the ttl as a time.Duration value for pubsub, binding and any other building block.

Types

type Base added in v1.9.0

type Base struct {
	// Name is the name of the component that's being used.
	Name string
	// Properties is the metadata properties.
	Properties map[string]string `json:"properties,omitempty"`
}

Base is the common metadata across components. All components-specific metadata should embed this.

type ByteSize added in v1.12.0

type ByteSize struct {
	resource.Quantity
}

ByteSize contains a quantity for a resource that is measured in bytes. This extends the resource.Quantity struct from k8s.io/apimachinery to add some utility methods specific for Dapr. Although the library from K8s supports other kinds of resource quantities, our focus is on sizes in bytes.

func NewByteSize added in v1.12.0

func NewByteSize(defaultValue int64) ByteSize

NewByteSize returns a new ByteSize with a default value in bytes.

func (*ByteSize) GetBytes added in v1.12.0

func (q *ByteSize) GetBytes() (int64, error)

GetBytes returns the number of bytes in the quantity. Note: this operation is expensive, so it's recommended to cache the returned value.

type ComponentType added in v1.11.0

type ComponentType string
const (
	BindingType            ComponentType = "bindings"
	StateStoreType         ComponentType = "state"
	SecretStoreType        ComponentType = "secretstores"
	PubSubType             ComponentType = "pubsub"
	LockStoreType          ComponentType = "lock"
	ConfigurationStoreType ComponentType = "configuration"
	MiddlewareType         ComponentType = "middleware"
	CryptoType             ComponentType = "crypto"
	NameResolutionType     ComponentType = "nameresolution"
	WorkflowType           ComponentType = "workflows"
)

func (ComponentType) BuiltInMetadataProperties added in v1.11.0

func (t ComponentType) BuiltInMetadataProperties() []string

BuiltInMetadataProperties returns the built-in metadata properties for the given component type. These are normally parsed by the runtime.

func (ComponentType) IsValid added in v1.11.0

func (t ComponentType) IsValid() bool

IsValid returns true if the component type is valid.

type ComponentWithMetadata added in v1.12.0

type ComponentWithMetadata interface {
}

ComponentWithMetadata is empty when the `metadata` build tag is not present. The build tag is present when running the linter.

type Duration added in v1.2.0

type Duration struct {
	time.Duration
}

func (Duration) MarshalJSON added in v1.2.0

func (d Duration) MarshalJSON() ([]byte, error)

func (Duration) ToISOString added in v1.8.0

func (d Duration) ToISOString() string

ToISOString returns the duration formatted as a ISO-8601 duration string (-ish). This methods supports days, hours, minutes, and seconds. It assumes all durations are in UTC time and are not impacted by DST (so all days are 24-hours long). This method does not support fractions of seconds, and durations are truncated to seconds. See https://en.wikipedia.org/wiki/ISO_8601#Durations for referece.

func (*Duration) UnmarshalJSON added in v1.2.0

func (d *Duration) UnmarshalJSON(b []byte) error

type MetadataField added in v1.12.0

type MetadataField struct {
	// Field type
	Type string
	// True if the field should be ignored by the metadata analyzer
	Ignored bool
	// True if the field is deprecated
	Deprecated bool
	// Aliases used for old, deprecated names
	Aliases []string
}

type MetadataMap added in v1.12.0

type MetadataMap map[string]MetadataField

Jump to

Keyboard shortcuts

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