Documentation
¶
Index ¶
Constants ¶
const ( // HostAddress is the address of the instance. HostAddress string = "HOST_ADDRESS" // DaprHTTPPort is the dapr api http port. DaprHTTPPort string = "DAPR_HTTP_PORT" // DaprPort is the dapr internal grpc port (sidecar to sidecar). DaprPort string = "DAPR_PORT" // AppPort is the port of the application, http/grpc depending on mode. AppPort string = "APP_PORT" // AppID is the ID of the application. AppID string = "APP_ID" // Namespace is the namespace of the application. Namespace string = "NAMESPACE" )
These constants are used for the "legacy" way to pass instance information using a map.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddressList ¶
type AddressList []string
AddressList is a list of addresses resolved by the nameresolver
func (AddressList) Pick ¶
func (a AddressList) Pick() string
Pick returns a random address from the list
type Instance ¶
type Instance struct {
// App ID.
AppID string
// Namespace of the app.
Namespace string
// Address of the instance.
Address string
// Dapr HTTP API port.
DaprHTTPPort int
// Dapr internal gRPC port (for sidecar-to-sidecar communication).
DaprInternalPort int
// Port the application is listening on (either HTTP or gRPC).
AppPort int
}
Instance contains information about the instance.
type Metadata ¶
Metadata contains a name resolution specific set of metadata properties.
func (Metadata) GetPropertiesMap ¶
GetPropertiesMap returns a map with the instance properties. This is used by components that haven't adopted the new Instance struct to receive instance information.
type ResolveRequest ¶
ResolveRequest represents service discovery resolver request.
func (ResolveRequest) CacheKey ¶
func (r ResolveRequest) CacheKey() string
CacheKey returns a string that can be used to identify this ResolveRequest in a cache
type Resolver ¶
type Resolver interface {
// Init initializes name resolver.
Init(ctx context.Context, metadata Metadata) error
// ResolveID resolves name to address.
ResolveID(ctx context.Context, req ResolveRequest) (string, error)
io.Closer
}
Resolver is the interface of name resolver.
type ResolverMulti ¶
type ResolverMulti interface {
ResolveIDMulti(ctx context.Context, req ResolveRequest) (AddressList, error)
}
ResolverMulti is an optional interface for name resolvers that can return multiple addresses.