Documentation
¶
Overview ¶
Package datamanager contains a gRPC based datamanager service server
Package datamanager contains a service type that can be used to capture data from a robot's components. For more information, see the data management service docs.
Package datamanager contains a gRPC based datamanager service server
Index ¶
- Constants
- Variables
- func ConvertImageToBytes(image image.Image, mimeType datasyncpb.MimeType) ([]byte, error)
- func CreateShouldSyncReading(toSync bool) map[string]interface{}
- func Named(name string) resource.Name
- func NamesFromRobot(r robot.Robot) []string
- func NewRPCServiceServer(coll resource.APIResourceGetter[Service], logger logging.Logger) interface{}
- type AssociatedConfig
- type CaptureConfigReading
- type DataCaptureConfig
- type Service
- func FromDependencies(deps resource.Dependencies, name string) (Service, error)deprecated
- func FromProvider(provider resource.Provider, name string) (Service, error)
- func FromRobot(r robot.Robot, name string) (Service, error)deprecated
- func NewClientFromConn(ctx context.Context, conn rpc.ClientConn, remoteName string, ...) (Service, error)
Constants ¶
const SubtypeName = "data_manager"
SubtypeName is the name of the type of service.
Variables ¶
var API = resource.APINamespaceRDK.WithServiceType(SubtypeName)
API is a variable that identifies the data manager service resource API.
var ShouldSyncKey = "should_sync"
ShouldSyncKey is a special key we use within a modular sensor to pass a boolean that indicates to the datamanager whether or not we want to sync.
Functions ¶
func ConvertImageToBytes ¶ added in v0.90.0
ConvertImageToBytes converts an image.Image to a byte slice based on the specified MIME type.
func CreateShouldSyncReading ¶ added in v0.13.0
CreateShouldSyncReading is a helper for creating the expected reading for a modular sensor that passes a bool to the datamanager to indicate whether or not we want to sync.
func NamesFromRobot ¶ added in v0.27.0
NamesFromRobot is a helper for getting all data manager services from the given Robot.
func NewRPCServiceServer ¶ added in v0.2.36
func NewRPCServiceServer(coll resource.APIResourceGetter[Service], logger logging.Logger) interface{}
NewRPCServiceServer constructs a datamanager gRPC service server. It is intentionally untyped to prevent use outside of tests.
Types ¶
type AssociatedConfig ¶ added in v0.24.0
type AssociatedConfig struct {
CaptureMethods []DataCaptureConfig `json:"capture_methods"`
}
AssociatedConfig specify a list of methods to capture on resources and implements the resource.AssociatedConfig interface.
func (*AssociatedConfig) Equals ¶ added in v0.24.0
func (ac *AssociatedConfig) Equals(other resource.AssociatedConfig) bool
Equals describes if an DataCaptureConfigs is equal to a given AssociatedConfig.
func (*AssociatedConfig) Link ¶ added in v0.24.0
func (ac *AssociatedConfig) Link(conf *resource.Config)
Link associates an AssociatedConfig to a specific resource model (e.g. builtin data capture).
func (*AssociatedConfig) UpdateResourceNames ¶ added in v0.24.0
func (ac *AssociatedConfig) UpdateResourceNames(updater func(old resource.Name) resource.Name)
UpdateResourceNames allows the caller to modify the resource names of data capture in place.
type CaptureConfigReading ¶ added in v0.116.0
type CaptureConfigReading struct {
// ResourceName is the name of the resource (e.g. "camera-1").
ResourceName string `json:"resource_name"`
// Method is the capture method name (e.g. "GetImages").
Method string `json:"method"`
// CaptureFrequencyHz, when non-nil, overrides the capture frequency for this resource/method pair.
// A value of 0 disables capture.
CaptureFrequencyHz *float32 `json:"capture_frequency_hz,omitempty"`
// Tags, when non-nil, overrides the data manager's tags for this resource/method pair.
Tags []string `json:"tags"`
}
CaptureConfigReading defines a capture config reading for a specific resource/method pair, as emitted by the capture_control_sensor. Resource/method pairs should correspond with a configured data manager service.
type DataCaptureConfig ¶ added in v0.2.36
type DataCaptureConfig struct {
Name resource.Name `json:"name"`
Method string `json:"method"`
CaptureFrequencyHz float32 `json:"capture_frequency_hz"`
CaptureQueueSize int `json:"capture_queue_size"`
CaptureBufferSize int `json:"capture_buffer_size"`
AdditionalParams map[string]interface{} `json:"additional_params"`
Disabled bool `json:"disabled"`
Tags []string `json:"tags,omitempty"`
CaptureDirectory string `json:"capture_directory"`
}
DataCaptureConfig is used to initialize a collector for a component or remote.
func (*DataCaptureConfig) Equals ¶ added in v0.2.36
func (c *DataCaptureConfig) Equals(other *DataCaptureConfig) bool
Equals checks if one capture config is equal to another.
type Service ¶
type Service interface {
resource.Resource
// Sync will sync data stored on the machine to the cloud.
Sync(ctx context.Context, extra map[string]interface{}) error
UploadBinaryDataToDatasets(ctx context.Context, binaryData []byte, datasetIDs, tags []string,
mimeType datasyncpb.MimeType, extra map[string]interface{}) error
UploadImageToDatasets(ctx context.Context, image image.Image, datasetIDs, tags []string,
mimeType datasyncpb.MimeType, extra map[string]interface{}) error
}
Service defines what a Data Manager Service should expose to the users. For more information, see the data management service docs.
Sync example:
data, err := datamanager.FromProvider(machine, "my_data_manager") // Sync data stored on the machine to the cloud. err := data.Sync(context.Background(), nil)
For more information, see the Sync method docs.
func FromDependencies
deprecated
added in
v0.12.0
func FromDependencies(deps resource.Dependencies, name string) (Service, error)
Deprecated: FromDependencies is a helper for getting the named data manager service from a collection of dependencies. Use FromProvider instead.
func FromProvider ¶ added in v0.98.0
FromProvider is a helper for getting the named Data Manager service from a resource Provider (collection of Dependencies or a Robot).
Directories
¶
| Path | Synopsis |
|---|---|
|
Package builtin captures data from a robot's components, persists the captured data to disk and sync it to the cloud when possible.
|
Package builtin captures data from a robot's components, persists the captured data to disk and sync it to the cloud when possible. |
|
capture
Package capture implements datacapture for the builtin datamanger
|
Package capture implements datacapture for the builtin datamanger |
|
cmd
command
package main prints a disk summary of the builtin data manager's capture directory or additional sync paths It exists purely as a convenience utilty for viam developers & solutions engineers.
|
package main prints a disk summary of the builtin data manager's capture directory or additional sync paths It exists purely as a convenience utilty for viam developers & solutions engineers. |
|
shared
Package shared is for any variables/functions shared amongst the datamanager builtin package and its subpackages.
|
Package shared is for any variables/functions shared amongst the datamanager builtin package and its subpackages. |
|
sync
Package sync implements datasync for the builtin datamanger
|
Package sync implements datasync for the builtin datamanger |
|
Package register registers all relevant datamanager models and also API specific functions
|
Package register registers all relevant datamanager models and also API specific functions |