Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // PlatformOptions provides options used when creating new RPCPlatform. PlatformOptions = options.Platform{} // ClientOptions provides options used when creating new Client. ClientOptions = options.Client{} // ServerOptions provides options used when creating new Server. ServerOptions = options.Server{} )
Functions ¶
This section is empty.
Types ¶
type Attributes ¶
type Attributes = attributes.Attributes
Attributes provides server attribute values.
func NewAttributes ¶ added in v1.5.0
func NewAttributes() *Attributes
NewAttributes returns attributes with default values.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Client ¶
func (c *Client) Client() *grpc.ClientConn
Client return the original gRPC ClientConn object.
type ClientOption ¶ added in v1.5.0
ClientOption is used to pass ClientOptions when creating a new Client
type PlatformOption ¶ added in v1.5.0
PlatformOption is used to pass PlatformOptions when creating a new RPCPlatform
type RPCPlatform ¶
type RPCPlatform struct {
// contains filtered or unexported fields
}
func New ¶
func New(etcdPrefix string, etcdClient *etcd.Client, options ...PlatformOption) (*RPCPlatform, error)
New creates an RPCPlatform object for further creation of clients and servers. All methods of this object are thread safe. You can create this object once and use it in different places in your program.
func (*RPCPlatform) Lookup ¶ added in v1.4.0
func (p *RPCPlatform) Lookup(ctx context.Context, name string, watch bool) (<-chan map[string]*ServerInfo, error)
Lookup returns information about available servers by name. If the watch is set to true, a new portion of data will be provided with each change. Otherwise the channel will be closed immediately after the first data is written. The keys of the returned map are server IDs.
func (*RPCPlatform) NewClient ¶
func (p *RPCPlatform) NewClient(target string, options ...ClientOption) (*Client, error)
NewClient creates a new client. You need to provide the target server name.
func (*RPCPlatform) NewServer ¶
func (p *RPCPlatform) NewServer(name, addr string, options ...ServerOption) (*Server, error)
NewServer creates a new server. You need to provide the server name and listening address.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
type ServerInfo ¶ added in v1.5.0
type ServerInfo struct {
Address string
Attributes *Attributes
}
ServerInfo is the state of the server in etcd.
type ServerOption ¶ added in v1.5.0
ServerOption is used to pass ServerOptions when creating a new Server