viam.resource.rpc_client_base

Classes

ResourceRPCClientBase

Base RPC client for a resource.

ReconfigurableResourceRPCClientBase

A base RPC client that can reset its channel.

Module Contents

class viam.resource.rpc_client_base.ResourceRPCClientBase[source]

Bases: Protocol

Base RPC client for a resource. Resource RPC clients must inherit from this class

class Metadata[source]
metadata: Dict[str, str]
enable_debug_logging(key: str = '')[source]

Enables server-side debug logging for resource methods.

Parameters:

key (str) – The key to associate debug logs with. If not provided, will default to a randomly generated string value.

disable_debug_logging()[source]

Disables server-side debug logging for resource methods.

add_metadata(key: str, value: str)[source]

Adds a key-value pair to the metadata

delete_metadata(key: str)[source]

Removes a key-value pair from the metadata by key

property proto
Returns metadata in a gRPC-appropriate form
channel: grpclib.client.Channel
client: Any
class viam.resource.rpc_client_base.ReconfigurableResourceRPCClientBase[source]

Bases: ResourceRPCClientBase

A base RPC client that can reset its channel.

Useful if connection is lost and then regained.

reset_channel(channel: grpclib.client.Channel)[source]

Called when the RPC channel was reset. Passes in the new channel.

Parameters:

channel (Channel) – The new RPC Channel