remoteinfo

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RefreshableInstance added in v0.7.2

type RefreshableInstance interface {
	RefreshInstanceWithAddr(addr net.Addr) (newInstance discovery.Instance)
}

RefreshableInstance declares an interface which can return an instance containing the new address.

type RemoteInfo

type RemoteInfo interface {
	rpcinfo.EndpointInfo
	SetServiceName(name string)
	SetTag(key, value string) error
	ForceSetTag(key, value string)

	// SetTagLock freezes a key of the tags and refuses further modification on its value.
	SetTagLock(key string)
	GetInstance() discovery.Instance
	SetInstance(ins discovery.Instance)

	// SetRemoteAddr tries to set the network address of the discovery.Instance hold by RemoteInfo.
	// The result indicates whether the modification is successful.
	SetRemoteAddr(addr net.Addr) (ok bool)
	ImmutableView() rpcinfo.EndpointInfo
}

RemoteInfo implements a rpcinfo.EndpointInfo with mutable address and connection. It is typically used to represent server info on client side or client info on server side.

func AsRemoteInfo

func AsRemoteInfo(r rpcinfo.EndpointInfo) RemoteInfo

AsRemoteInfo converts an rpcinfo.EndpointInfo into a RemoteInfo. Returns nil if impossible.

func NewRemoteInfo

func NewRemoteInfo(basicInfo *rpcinfo.EndpointBasicInfo, method string) RemoteInfo

NewRemoteInfo creates a remoteInfo wrapping the given endpointInfo. The return value of the created RemoteInfo's Method method will be the `method` argument instead of the Method field in `basicInfo`. If the given basicInfo is nil, this function will panic.

Jump to

Keyboard shortcuts

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