ni_measurementlink_service
releases/1.4
  • API Reference
ni_measurementlink_service
  • ni_measurementlink_service._internal.discovery_client
  • Edit on GitHub

ni_measurementlink_service._internal.discovery_client

Redirect internal discovery client API to the public API.

Module Contents

Classes

DiscoveryClient

Client for accessing the MeasurementLink discovery service.

ServiceLocation

Represents the location of a service.

class ni_measurementlink_service._internal.discovery_client.DiscoveryClient(stub=None, *, grpc_channel_pool=None)[source]

Client for accessing the MeasurementLink discovery service.

Parameters:
  • stub (Optional[ni_measurementlink_service._internal.stubs.ni.measurementlink.discovery.v1.discovery_service_pb2_grpc.DiscoveryServiceStub]) –

  • grpc_channel_pool (Optional[ni_measurementlink_service.grpc.channelpool.GrpcChannelPool]) –

property registration_id: str

“The ID from discovery service upon successful registration.

Return type:

str

property stub: ni_measurementlink_service._internal.stubs.ni.measurementlink.discovery.v1.discovery_service_pb2_grpc.DiscoveryServiceStub

Get the gRPC stub used to interact with the discovery service.

Return type:

ni_measurementlink_service._internal.stubs.ni.measurementlink.discovery.v1.discovery_service_pb2_grpc.DiscoveryServiceStub

register_measurement_service(service_port, service_info, measurement_info)[source]

Register the measurement service with the discovery service.

Parameters:
  • service_port (str) – The port number of the service.

  • service_info (ni_measurementlink_service.measurement.info.ServiceInfo) – Information describing the service.

  • measurement_info (ni_measurementlink_service.measurement.info.MeasurementInfo) – Information describing the measurement.

Returns:

Boolean indicating whether the service was successfully registered.

Return type:

bool

register_service(service_info, service_location)[source]

Register the specified service with the discovery service.

Parameters:
  • service_info (ni_measurementlink_service.measurement.info.ServiceInfo) – Information describing the service.

  • service_location (ni_measurementlink_service.discovery._types.ServiceLocation) – The location of the service on the network.

Returns:

ID that can be used to unregister the service.

Return type:

str

unregister_service(registration_id='')[source]

Unregisters the specified service from the discovery service.

This method should be called before the service exits.

Parameters:

registration_id (str) – The registration ID returned from register_service. This argument should be omitted after calling the deprecated register_measurement_service method.

Returns:

Boolean indicating whether the service was unregistered.

Return type:

bool

resolve_service(provided_interface, service_class='')[source]

Resolve the location of a service.

Given a description of a service, returns information that can be used to establish communication with that service. If necessary, the service will be started by the discovery service if it has not already been started.

Parameters:
  • provided_interface (str) – The gRPC full name of the service.

  • service_class (str) – The service “class” that should be matched. If the value is not specified and there is more than one matching service registered, an error is returned.

Returns:

The service location.

Return type:

ni_measurementlink_service.discovery._types.ServiceLocation

class ni_measurementlink_service._internal.discovery_client.ServiceLocation[source]

Bases: NamedTuple

Represents the location of a service.

property insecure_address: str

port.

Type:

Get the service’s insecure address in the format host

Return type:

str

property ssl_authenticated_address: str

port.

Type:

Get the service’s SSL-authenticated address in the format host

Return type:

str

location: str
insecure_port: str
ssl_authenticated_port: str

© Copyright 2024, National Instruments. Revision 2ba12c60.

Built with Sphinx using a theme provided by Read the Docs.