Couchbase C++ SDK 1.4.0 (rev. 59aa900)
Loading...
Searching...
No Matches
node_id Class Reference

Identifies a cluster node. More...

#include <couchbase/node_id.hxx>

Public Member Functions

 node_id ()=default
 Creates an empty (invalid) node_id.
 node_id (const node_id &)=default
 node_id (node_id &&) noexcept=default
auto operator= (const node_id &) -> node_id &=default
auto operator= (node_id &&) noexcept -> node_id &=default
 ~node_id ()=default
auto id () const noexcept -> const std::string &
 User-facing identifier string.
auto node_uuid () const noexcept -> const std::string &
 The server-assigned node UUID (empty on servers before 8.0.1).
auto hostname () const noexcept -> const std::string &
 The hostname of the node.
auto port () const noexcept -> std::uint16_t
 The port of the node's key-value service.
 operator bool () const noexcept
 Returns true when the node_id was properly initialized (not default-constructed).
auto operator== (const node_id &other) const noexcept -> bool
auto operator!= (const node_id &other) const noexcept -> bool
auto operator< (const node_id &other) const noexcept -> bool
auto operator<= (const node_id &other) const noexcept -> bool
auto operator> (const node_id &other) const noexcept -> bool
auto operator>= (const node_id &other) const noexcept -> bool

Friends

class internal_node_id

Detailed Description

Identifies a cluster node.

On Couchbase Server 8.0.1+ the identifier is the server-assigned node UUID. On older releases, a stable opaque token is derived from the node's hostname and KV port.

The type is equality-comparable, totally ordered, and hashable.

Since
1.3.2
Uncommitted
Might be changed in the future, and eventually promoted to committed

Constructor & Destructor Documentation

◆ node_id() [1/3]

node_id ( )
default

Creates an empty (invalid) node_id.

See also
operator bool()
Since
1.3.2
Uncommitted
Might be changed in the future, and eventually promoted to committed

◆ node_id() [2/3]

node_id ( const node_id & )
default

◆ node_id() [3/3]

node_id ( node_id && )
defaultnoexcept

◆ ~node_id()

~node_id ( )
default

Member Function Documentation

◆ hostname()

auto hostname ( ) const -> const std::string &
nodiscardnoexcept

The hostname of the node.

Since
1.3.2
Uncommitted
Might be changed in the future, and eventually promoted to committed

◆ id()

auto id ( ) const -> const std::string &
nodiscardnoexcept

User-facing identifier string.

Returns node_uuid when the server provides one, otherwise a stable hex-encoded hash derived from hostname and KV port.

Returns
opaque identifier string (empty for default-constructed instances)
Since
1.3.2
Uncommitted
Might be changed in the future, and eventually promoted to committed

◆ node_uuid()

auto node_uuid ( ) const -> const std::string &
nodiscardnoexcept

The server-assigned node UUID (empty on servers before 8.0.1).

Since
1.3.2
Uncommitted
Might be changed in the future, and eventually promoted to committed

◆ operator bool()

operator bool ( ) const
explicitnodiscardnoexcept

Returns true when the node_id was properly initialized (not default-constructed).

Since
1.3.2
Uncommitted
Might be changed in the future, and eventually promoted to committed

◆ operator!=()

auto operator!= ( const node_id & other) const -> bool
nodiscardnoexcept
Since
1.3.2
Uncommitted
Might be changed in the future, and eventually promoted to committed

◆ operator<()

auto operator< ( const node_id & other) const -> bool
nodiscardnoexcept
Since
1.3.2
Uncommitted
Might be changed in the future, and eventually promoted to committed

◆ operator<=()

auto operator<= ( const node_id & other) const -> bool
nodiscardnoexcept
Since
1.3.2
Uncommitted
Might be changed in the future, and eventually promoted to committed

◆ operator=() [1/2]

auto operator= ( const node_id & ) -> node_id &=default
default

◆ operator=() [2/2]

auto operator= ( node_id && ) -> node_id &=default
defaultnoexcept

◆ operator==()

auto operator== ( const node_id & other) const -> bool
nodiscardnoexcept
Since
1.3.2
Uncommitted
Might be changed in the future, and eventually promoted to committed

◆ operator>()

auto operator> ( const node_id & other) const -> bool
nodiscardnoexcept
Since
1.3.2
Uncommitted
Might be changed in the future, and eventually promoted to committed

◆ operator>=()

auto operator>= ( const node_id & other) const -> bool
nodiscardnoexcept
Since
1.3.2
Uncommitted
Might be changed in the future, and eventually promoted to committed

◆ port()

auto port ( ) const -> std::uint16_t
nodiscardnoexcept

The port of the node's key-value service.

This reflects the port actually used by the client: the TLS port when the cluster connection is TLS-enabled, otherwise the plain port. A value of 0 indicates the port is unknown or the node is not bound; in that case operator bool() also returns false.

Since
1.3.2
Uncommitted
Might be changed in the future, and eventually promoted to committed

◆ internal_node_id

friend class internal_node_id
friend

The documentation for this class was generated from the following file: