Hyper API for C++ 0.0.20746
Hyper client library for C++ applications
Loading...
Searching...
No Matches
hyperapi::HyperProcess Class Referencefinal

Defines a Hyper process. More...

#include <HyperProcess.hpp>

Public Member Functions

 HyperProcess (const std::string &hyperPath, Telemetry telemetry, const std::string &userAgent=std::string(), const std::unordered_map< std::string, std::string > &parameters=std::unordered_map< std::string, std::string >())
 Starts a Hyper process with the given parameters.
 
 HyperProcess (Telemetry telemetry, const std::string &userAgent=std::string(), const std::unordered_map< std::string, std::string > &parameters=std::unordered_map< std::string, std::string >())
 Starts a Hyper process.
 
 HyperProcess ()
 Constructs a HyperProcess object that does not represent a hyper process.
 
 ~HyperProcess () noexcept
 Stops the Hyper process.
 
 HyperProcess (HyperProcess &&other) noexcept
 Move constructor.
 
HyperProcessoperator= (HyperProcess &&other) noexcept
 Move assignment operator.
 
void shutdown (std::chrono::milliseconds timeoutMs=std::chrono::milliseconds(-1))
 Shuts down the Hyper process.
 
Endpoint getEndpoint () const
 Returns the endpoint descriptor for the given Hyper process.
 
bool isOpen () const noexcept
 Returns whether the Hyper process is open.
 
void close () noexcept
 Closes this Hyper process object.
 

Detailed Description

Defines a Hyper process.

This class starts Hyper and manages its lifetime. Only one Hyper process should be running concurrently to achieve optimal performance. Multiple Hyper instances will compete for resources (mainly CPU cores and memory). This will lead to an overall worse performance than using a single Hyper process.

Examples
create_hyper_file_from_csv.cpp, delete_data_in_existing_hyper_file.cpp, insert_data_into_multiple_tables.cpp, insert_data_into_single_table.cpp, insert_data_with_expressions.cpp, insert_spatial_data_to_a_hyper_file.cpp, read_and_print_data_from_existing_hyper_file.cpp, and update_data_in_existing_hyper_file.cpp.

Definition at line 36 of file HyperProcess.hpp.

Constructor & Destructor Documentation

◆ HyperProcess() [1/3]

hyperapi::HyperProcess::HyperProcess ( const std::string &  hyperPath,
Telemetry  telemetry,
const std::string &  userAgent = std::string(),
const std::unordered_map< std::string, std::string > &  parameters = std::unordered_map< std::string, std::string >() 
)
explicit

Starts a Hyper process with the given parameters.

Parameters
hyperPathThe path to a directory containing the Hyper binaries.
telemetryUser choice on transmitting usage data to Tableau.
userAgentThe user-agent string used by Hyper in logging and telemetry
parametersOptional parameters for starting the Hyper process. All parameter keys and values are expected to be passed in UTF-8 encoding. The available parameters are documented in the Tableau Hyper documentation, chapter "Process Settings".
Exceptions
HyperExceptionif starting the Hyper instance fails.
std::bad_allocin case of error

◆ HyperProcess() [2/3]

hyperapi::HyperProcess::HyperProcess ( Telemetry  telemetry,
const std::string &  userAgent = std::string(),
const std::unordered_map< std::string, std::string > &  parameters = std::unordered_map< std::string, std::string >() 
)
explicit

Starts a Hyper process.

Tries to locate the Hyper binaries by locating the Hyper API shared object file. The shared object is assumed to reside in a libraries directory that contains the Hyper binaries in a "hyper" subfolder.

Parameters
telemetryUser choice on transmitting usage data to Tableau.
userAgentThe user-agent string used by hyperd in logging and telemetry
parametersOptional parameters for starting the Hyper process. All parameter keys and values are expected to be passed in UTF-8 encoding. The available parameters are documented in the Tableau Hyper documentation, chapter "Process Settings".
Exceptions
HyperExceptionif starting the Hyper process fails.
std::bad_allocin case of error

◆ HyperProcess() [3/3]

hyperapi::HyperProcess::HyperProcess ( )
inline

Constructs a HyperProcess object that does not represent a hyper process.

Postcondition
!isOpen()
Exceptions
std::bad_allocin case of error

Definition at line 81 of file HyperProcess.hpp.

◆ ~HyperProcess()

hyperapi::HyperProcess::~HyperProcess ( )
noexcept

Stops the Hyper process.

This call blocks until Hyper is shut down.

Member Function Documentation

◆ close()

void hyperapi::HyperProcess::close ( )
noexcept

Closes this Hyper process object.

Postcondition
!isOpen()

◆ getEndpoint()

Endpoint hyperapi::HyperProcess::getEndpoint ( ) const

Returns the endpoint descriptor for the given Hyper process.

Precondition
isOpen()

◆ shutdown()

void hyperapi::HyperProcess::shutdown ( std::chrono::milliseconds  timeoutMs = std::chrono::milliseconds(-1))

Shuts down the Hyper process.

If timeoutMs > 0ms, wait for Hyper to shut down gracefully. If the process is still running after a timeout of timeoutMs milliseconds, forcefully terminate the process and throw an exception.

If timeoutMs < 0ms, wait indefinitely for Hyper to shut down.

If timeoutMs == 0ms, immediately terminate Hyper forcefully. Does not throw if the process already exited with a non-zero exit code.

Parameters
timeoutMsThe timeout in milliseconds
Exceptions
HyperExceptionThrown if there was an error stopping the process, if the process was forcefully killed after the timeout, or if the process already exited with a non-zero exit code.
Postcondition
!isOpen()

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