Robot Raconteur Core C++ Library
Classes | Functions
NodeDirectories.h File Reference

Go to the source code of this file.

Classes

class  RobotRaconteur::NodeDirectories
 Directories on local system used by the node. More...
 
class  RobotRaconteur::NodeDirectoriesUtil
 Utility functions for working with NodeDirectories. More...
 
class  RobotRaconteur::GetUuidForNameAndLockResult
 Structure to hold result of GetUuidForNameAndLock. More...
 
class  RobotRaconteur::NodeDirectoriesResourceAlreadyInUse
 Exception thrown by GetUuidForNameAndLockResult if the name with the specified scope is currently in use. More...
 

Functions

GetUuidForNameAndLockResult RobotRaconteur::GetUuidForNameAndLock (const NodeDirectories &node_dirs, boost::string_ref name, const std::vector< std::string > &scope)
 Get a saved UUID for a name with a specified scope. More...
 

Detailed Description

Author
John Wason, PhD
License
Software License Agreement (Apache License)
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Function Documentation

◆ GetUuidForNameAndLock()

GetUuidForNameAndLockResult RobotRaconteur::GetUuidForNameAndLock ( const NodeDirectories node_dirs,
boost::string_ref  name,
const std::vector< std::string > &  scope 
)

Get a saved UUID for a name with a specified scope.

Robot Raconteur uses "identifiers", which are a combination of a name and a UUID. For nodes, this is a NodeName and NodeID pair. For convenience, the UUIDs can be automatically generated on individual machines, and saved to the system. They can also be pre-specified by creating files in specific locations. The "scope" is a path that separates different types of identifiers. For nodes, the scope is "nodeids". For devices, it is something like ["identifiers","devices"].

The base directory is typically "user_config_dir", except for root users on Unix systems. In those cases, the search will initially look in "user_config_dir" (/etc/robotraconteur), but then fall back to "user_state_dir" (/var/lib/robotraconteur) to save the generated UUID.

The files contain the UUID in text form, and no other characters.

Throws NodeDirectoriesResourceAlreadyInUse if the name is already in use by another node.

Parameters
node_dirsNode directory structure returned by RobotRaconteurNode::GetNodeDirectories()
nameThe name to get a UUID
scopeThe scope of the type of identifier
Returns
GetUuidForNameAndLockResult The resulting UUID