client

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2020 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// DefaultHTTPTimeout is the default HTTP client timeout
	DefaultHTTPTimeout = time.Second * 30

	// DefaultConsistency is the state store consistency option setting
	DefaultConsistency = "eventual" // override defaults (eventual)

	// DefaultConcurrency is the state store concurrency option setting
	DefaultConcurrency = "last-write" // override defaults (first-write)

	// DefaultRetryPolicyInterval is the state store retry policy interval setting
	DefaultRetryPolicyInterval = 100

	// DefaultRetryPolicyThreshold is the state store retry policy threshold setting
	DefaultRetryPolicyThreshold = 3

	// DefaultRetryPolicyPattern is the state store retry policy pattern setting
	DefaultRetryPolicyPattern = "exponential"

	// DefaultStateOptions is made of DefaultConsistency and DefaultConcurrency
	DefaultStateOptions = &StateOptions{
		Concurrency: DefaultConcurrency,
		Consistency: DefaultConsistency,
	}
)

Functions

This section is empty.

Types

type BindingData added in v0.7.2

type BindingData struct {
	Operation string            `json:"operation,omitempty"`
	Data      interface{}       `json:"data,omitempty"`
	Metadata  map[string]string `json:"metadata,omitempty"`
}

BindingData represents the BindingEventEnvelope

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a simple HTTP Dapr client abstraction

func NewClient

func NewClient() (client *Client)

NewClient creates instance of dapr Client using http://localhost:PORT where PORT is the value of DAPR_HTTP_PORT env var defaulted to 3500

func NewClientWithURL

func NewClientWithURL(url string) (client *Client)

NewClientWithURL creates valid instance of Client using provided url

func (*Client) DeleteState

func (c *Client) DeleteState(ctx trace.SpanContext, store, key string) error

DeleteState deletes existing state from specified store

func (*Client) DeleteStateWithOptions

func (c *Client) DeleteStateWithOptions(ctx trace.SpanContext, store, key string, opt *StateOptions) error

DeleteStateWithOptions deletes existing state from specified store

func (*Client) GetState

func (c *Client) GetState(ctx trace.SpanContext, store, key string) (data []byte, err error)

GetState gets content for specific key in state store

func (*Client) GetStateWithOptions

func (c *Client) GetStateWithOptions(ctx trace.SpanContext, store, key string, opt *StateOptions) (data []byte, err error)

GetStateWithOptions gets content for specific key in state store

func (*Client) Health added in v0.8.0

func (c *Client) Health() (ok bool, err error)

Health checks the Dapr client connection status and Dapr API

func (*Client) InvokeBinding

func (c *Client) InvokeBinding(ctx trace.SpanContext, binding, operation string) (out []byte, err error)

InvokeBinding invokes InvokeBindingWithData with just the operation

func (*Client) InvokeBindingWithData

func (c *Client) InvokeBindingWithData(ctx trace.SpanContext, binding string, data *BindingData) (out []byte, err error)

InvokeBindingWithData posts the in content to specified binding

func (*Client) InvokeBindingWithIdentity added in v0.8.1

func (c *Client) InvokeBindingWithIdentity(ctx trace.SpanContext, binding, operation string, in interface{}) (out []byte, err error)

InvokeBindingWithIdentity invokes InvokeBindingWithData with operation and data

func (*Client) InvokeService

func (c *Client) InvokeService(ctx trace.SpanContext, service, method string) (out []byte, err error)

InvokeService and invokes InvokeServiceWithData without any payload

func (*Client) InvokeServiceWithData

func (c *Client) InvokeServiceWithData(ctx trace.SpanContext, service, method string, in []byte) (out []byte, err error)

InvokeServiceWithData invokes the remote service method

func (*Client) InvokeServiceWithIdentity added in v0.8.1

func (c *Client) InvokeServiceWithIdentity(ctx trace.SpanContext, service, method string, in interface{}) (out []byte, err error)

InvokeServiceWithIdentity serializes input data to JSON and invokes InvokeServiceWithData

func (*Client) Publish

func (c *Client) Publish(ctx trace.SpanContext, topic string, in interface{}) error

Publish serializes data to JSON and invokes PublishWithData

func (*Client) PublishWithData

func (c *Client) PublishWithData(ctx trace.SpanContext, topic string, in []byte) error

PublishWithData invokes to specific topic with the passed in content

func (*Client) SaveState

func (c *Client) SaveState(ctx trace.SpanContext, store, key string, data interface{}) error

SaveState saves data into state store for specific key

func (*Client) SaveStateWithData

func (c *Client) SaveStateWithData(ctx trace.SpanContext, store string, data *StateData) error

SaveStateWithData saves state data into state store

type RetryPolicy

type RetryPolicy struct {
	Threshold int32  `json:"threshold,omitempty"`
	Pattern   string `json:"pattern,omitempty"`
	Interval  int64  `json:"interval,omitempty"`
}

RetryPolicy holds the StateOptions retry policy

type StateData

type StateData struct {
	Key      string            `json:"key"`
	Value    interface{}       `json:"value"`
	Etag     string            `json:"etag,omitempty"`
	Metadata map[string]string `json:"metadata,omitempty"`
	Options  *StateOptions     `json:"options,omitempty"`
}

StateData represents simplified dapr state item

type StateOptions

type StateOptions struct {
	Concurrency string       `json:"concurrency,omitempty"`
	Consistency string       `json:"consistency,omitempty"`
	RetryPolicy *RetryPolicy `json:"retryPolicy,omitempty"`
}

StateOptions is the dapr state data option for StateData

type Subscription added in v0.8.1

type Subscription struct {
	Topic string `json:"topic"`
	Route string `json:"route"`
}

Subscription defines the result of /dapr/subscribe

Jump to

Keyboard shortcuts

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