C++ SDK Documentation  24.2.0
Vertica::ServerInterface Class Referenceabstract

Provides UDxs with access to the Vertica server. More...

Collaboration diagram for Vertica::ServerInterface:
Collaboration graph

Classes

struct  BlobDescription
 
struct  BlobIdentifier
 
struct  FunctionDescription
 
struct  RelationDescription
 
struct  TypeDescription
 

Public Types

typedef void(* LoggingFunc) (ServerInterface *, const char *fmt, va_list ap)
 

Public Member Functions

 ServerInterface (VTAllocator *allocator, FileManager *fileManager, LoggingFunc func, const std::string &sqlName, const ParamReader &paramReader, vint udxDebugLogLevel=0)
 
 ServerInterface (VTAllocator *allocator, LoggingFunc func, const std::string &sqlName, const ParamReader &paramReader, vint udxDebugLogLevel=0)
 
 ServerInterface (VTAllocator *allocator, LoggingFunc func, const std::string &sqlName, vint udxDebugLogLevel=0)
 
void formatWithName append (" - ")
 
formatWithName append (format)
 
virtual bool describeBlob (const BlobIdentifier &blobId, BlobDescription &blobDescription, bool errorIfNotFound=true)=0
 
virtual bool describeFunction (FunctionDescription &func, bool errorIfNotFound=true)=0
 
virtual bool describeProjection (RelationDescription &proj, bool errorIfNotFound=true)=0
 
virtual bool describeTable (RelationDescription &baseTable, bool errorIfNotFound=true)=0
 
virtual bool describeType (TypeDescription &type, bool errorIfNotFound=true)=0
 
const std::string & getCurrentNodeName () const
 
const std::string & getDatabaseName () const
 
const std::map< std::string, std::string > & getDependencies () const
 
virtual const UDFileSystemgetFileSystem (const char *path)=0
 
Oid getFunctionOid () const
 
const std::string & getLocale () const
 
ParamReader getParamReader () const
 
ParamReader getSessionParamReader () const
 
ParamReader getUDSessionParamReader (std::string nsp)
 
ParamReader getUDSessionParamReader () const
 
SessionParamReaderMap getUDSessionParamReaderMap () const
 
const std::string & getUserName () const
 
virtual std::vector< BlobDescription > listBlobs (BlobIdentifier::Namespace nsp=BlobIdentifier::NSP_LIBRARY)=0
 
virtual void listDerivedTables (const RelationDescription &baseTable, std::vector< Oid > &tables, bool errorIfNotFound=false)=0
 
virtual void listProjections (const RelationDescription &lookup, std::vector< Oid > &projections, bool errorIfNotFound=false)=0
 
virtual void listTableProjections (const RelationDescription &baseTable, std::vector< Oid > &projections, bool errorIfNotFound=false)=0
 
virtual void listTables (const RelationDescription &lookup, std::vector< Oid > &tables, bool errorIfNotFound=false)=0
 
void log (const char *format,...) __attribute__((format(printf
 
virtual void logEvent (const std::map< std::string, std::string > &details)=0
 
virtual void reportError (ClientMessage msg)=0
 
virtual void reportInfo (ClientMessage msg)=0
 
virtual void reportNotice (ClientMessage msg)=0
 
virtual void reportWarning (ClientMessage msg)=0
 
void setDependencies (const std::map< std::string, std::string > dependencies)
 
void setFunctionOid (Oid FuncOid)
 
void setLibraryOid (Oid libOid_)
 
void setParamReader (const ParamReader &paramReader)
 
void setPublicOid (Oid publicOid_)
 
void setSessionParamReader (const ParamReader &sessionParamReader)
 
void setUDSessionParameterMap (const SessionParamReaderMap &udSessionParams)
 
 va_end (ap)
 
 va_start (ap, format)
 
 vlog (format, ap)
 
void vlog (const char *format, va_list ap)
 

Public Attributes

VTAllocatorallocator
 
va_list ap
 
FileManager * fileManager
 
 format = formatWithName.c_str()
 
vint udxDebugLogLevel
 

Protected Attributes

std::string dbName
 
std::map< std::string, std::string > dependencies
 
Oid funcOid
 
Oid libOid
 
std::string locale
 
std::string nodeName
 
ParamReader paramReader
 
Oid publicOid
 
ParamReader sessionParamReader
 
std::string sqlName
 
SessionParamReaderMap udSessionParamReaderMap
 
std::string userName
 
LoggingFunc vlogPtr
 

Friends

class ::UdfSupport
 
class ::UDxExecContext
 
class EE::UserDefinedAggregate
 
class EE::UserDefinedAnalytic
 
class EE::UserDefinedTransform
 

Detailed Description

Provides UDxs with access to the Vertica server.

Vertica passes a ServerInterface instance to the setup(), destroy(), and main processing functions of each UDx. Key methods for UDx use include log() (to write to the Vertica log), getParamReader(), setParamReader(), getSessionParamReader(), and setSessionParamReader().

Constructor & Destructor Documentation

◆ ServerInterface()

Vertica::ServerInterface::ServerInterface ( VTAllocator allocator,
FileManager *  fileManager,
LoggingFunc  func,
const std::string &  sqlName,
const ParamReader paramReader,
vint  udxDebugLogLevel = 0 
)
inline

Create a new ServerInterface.

Note
that Only Vertica Server should use this method. It is not guaranteed to stay the same between releases.

Member Function Documentation

◆ describeBlob()

virtual bool Vertica::ServerInterface::describeBlob ( const BlobIdentifier &  blobId,
BlobDescription &  blobDescription,
bool  errorIfNotFound = true 
)
pure virtual

Given a blob name and namespace (to which search path will be applied), find the rest of the details

◆ describeFunction()

virtual bool Vertica::ServerInterface::describeFunction ( FunctionDescription func,
bool  errorIfNotFound = true 
)
pure virtual

Describe a function

◆ describeProjection()

virtual bool Vertica::ServerInterface::describeProjection ( RelationDescription proj,
bool  errorIfNotFound = true 
)
pure virtual

Given a projection OID or name, find the rest of the details

◆ describeTable()

virtual bool Vertica::ServerInterface::describeTable ( RelationDescription baseTable,
bool  errorIfNotFound = true 
)
pure virtual

Given a table OID or name (to which search path will be applied), find the rest of the details

◆ describeType()

virtual bool Vertica::ServerInterface::describeType ( TypeDescription type,
bool  errorIfNotFound = true 
)
pure virtual

Describe a type

◆ getCurrentNodeName()

const std::string& Vertica::ServerInterface::getCurrentNodeName ( ) const
inline
Returns
the name of the vertica node on which this code is executed.

◆ getDatabaseName()

const std::string& Vertica::ServerInterface::getDatabaseName ( ) const
inline
Returns
the name of the database in which this code is executed.

◆ getDependencies()

const std::map<std::string, std::string>& Vertica::ServerInterface::getDependencies ( ) const
inline
Returns
a list of paths to rhe dependencies

◆ getFileSystem()

virtual const UDFileSystem* Vertica::ServerInterface::getFileSystem ( const char *  path)
pure virtual

Get the file system corresponding to the provided path.

◆ getLocale()

const std::string& Vertica::ServerInterface::getLocale ( ) const
inline
Returns
the locale of the current session.

◆ getParamReader()

ParamReader Vertica::ServerInterface::getParamReader ( ) const
inline

Returns the ParamReader that allows accessing parameter values using their names

◆ getSessionParamReader()

ParamReader Vertica::ServerInterface::getSessionParamReader ( ) const
inline

Get the sessionParamReader

◆ getUDSessionParamReader() [1/2]

ParamReader Vertica::ServerInterface::getUDSessionParamReader ( std::string  nsp)
inline

Get the UDSessionParamReader for a namespace

◆ getUDSessionParamReader() [2/2]

ParamReader Vertica::ServerInterface::getUDSessionParamReader ( ) const
inline

Get the UDSessionParamReader for the default namespace

◆ getUDSessionParamReaderMap()

SessionParamReaderMap Vertica::ServerInterface::getUDSessionParamReaderMap ( ) const
inline

Get the UDSessionParamReaderMap

◆ getUserName()

const std::string& Vertica::ServerInterface::getUserName ( ) const
inline
Returns
the name of the vertica user of the current session.

◆ listBlobs()

virtual std::vector<BlobDescription> Vertica::ServerInterface::listBlobs ( BlobIdentifier::Namespace  nsp = BlobIdentifier::NSP_LIBRARY)
pure virtual

List the blobs in the given namespace

◆ listDerivedTables()

virtual void Vertica::ServerInterface::listDerivedTables ( const RelationDescription baseTable,
std::vector< Oid > &  tables,
bool  errorIfNotFound = false 
)
pure virtual

List out derived tables, such as text indexes

◆ listProjections()

virtual void Vertica::ServerInterface::listProjections ( const RelationDescription lookup,
std::vector< Oid > &  projections,
bool  errorIfNotFound = false 
)
pure virtual

List projections given projection name

◆ listTableProjections()

virtual void Vertica::ServerInterface::listTableProjections ( const RelationDescription baseTable,
std::vector< Oid > &  projections,
bool  errorIfNotFound = false 
)
pure virtual

List projections given base table properties (schema + name, OID, etc.)

◆ listTables()

virtual void Vertica::ServerInterface::listTables ( const RelationDescription lookup,
std::vector< Oid > &  tables,
bool  errorIfNotFound = false 
)
pure virtual

List tables given properties (schema, name, etc.)

◆ log()

void Vertica::ServerInterface::log ( const char *  format,
  ... 
)

Writes a message to a log file stored in the UDxLogs directory of the database's catalog directory. The SQL name of the UDx is added to the log message, along with the string [UserMessage] to mark the entry as a message added by a call to this method.

Parameters
formata printf-style format string specifying the log message format.

◆ logEvent()

virtual void Vertica::ServerInterface::logEvent ( const std::map< std::string, std::string > &  details)
pure virtual

Logs an event composed of a map of key-value pairs to dc_udx_events, which can be queried using v_monitor.udx_events view.

Events logged from a fenced UDX are logged to a file and are not query-able.

◆ reportError()

virtual void Vertica::ServerInterface::reportError ( ClientMessage  msg)
pure virtual

Report the provided ClientMessage as an error

Parameters
msgThe message to be reported

◆ reportInfo()

virtual void Vertica::ServerInterface::reportInfo ( ClientMessage  msg)
pure virtual

Report the provided ClientMessage as info

Parameters
msgThe message to be reported

◆ reportNotice()

virtual void Vertica::ServerInterface::reportNotice ( ClientMessage  msg)
pure virtual

Report the provided ClientMessage as a notice

Parameters
msgThe message to be reported

◆ reportWarning()

virtual void Vertica::ServerInterface::reportWarning ( ClientMessage  msg)
pure virtual

Report the provided ClientMessage as a warning

Parameters
msgThe message to be reported

◆ setDependencies()

void Vertica::ServerInterface::setDependencies ( const std::map< std::string, std::string >  dependencies)
inline
Returns
set the paths to the dependencies

◆ setParamReader()

void Vertica::ServerInterface::setParamReader ( const ParamReader paramReader)
inline

Set the paramReader of this ServerInterface when delayed creation is required Used by the code when delayed creation of the parameters is needed Users should not call this function

◆ setSessionParamReader()

void Vertica::ServerInterface::setSessionParamReader ( const ParamReader sessionParamReader)
inline

Set the sessionParamReader

◆ setUDSessionParameterMap()

void Vertica::ServerInterface::setUDSessionParameterMap ( const SessionParamReaderMap udSessionParams)
inline

Set the UDSessionParamReaderMap

◆ vlog()

void Vertica::ServerInterface::vlog ( const char *  format,
va_list  ap 
)
inline

Write a message to the vertica.log system log.

Parameters
formata printf style format string specifying the log message format.
apva_list for variable arguments

Member Data Documentation

◆ allocator

VTAllocator* Vertica::ServerInterface::allocator

Memory source which is managed and freed by the server.

◆ dbName

std::string Vertica::ServerInterface::dbName
protected

Store the name of the current database

Referenced by getDatabaseName().

◆ dependencies

std::map<std::string, std::string> Vertica::ServerInterface::dependencies
protected

The list of all dependencies

Referenced by getDependencies(), and setDependencies().

◆ fileManager

FileManager* Vertica::ServerInterface::fileManager

File manager of the session context

◆ funcOid

Oid Vertica::ServerInterface::funcOid
protected

The Oid of the function

◆ libOid

Oid Vertica::ServerInterface::libOid
protected

The Oid of the library

◆ locale

std::string Vertica::ServerInterface::locale
protected

The locale of the current session

Referenced by getLocale().

◆ nodeName

std::string Vertica::ServerInterface::nodeName
protected

Store the name of the current node

Referenced by getCurrentNodeName().

◆ paramReader

ParamReader Vertica::ServerInterface::paramReader
protected

A reader for paremeters that have been toknized using the following format: key1=val1,key2=val2,key3=val3. Has accessor methods like BlockReader to be able to access parameters of different data types

Referenced by getParamReader(), and setParamReader().

◆ publicOid

Oid Vertica::ServerInterface::publicOid
protected

The Oid for public user-defined session parameters and blobs

◆ sessionParamReader

ParamReader Vertica::ServerInterface::sessionParamReader
protected

A map for session paremeters UDx might specify what session parameters it wants in its "manifest" Server will try to provide, if it agrees with that request

Referenced by getSessionParamReader(), and setSessionParamReader().

◆ sqlName

std::string Vertica::ServerInterface::sqlName
protected

Store the name for error logging

◆ udSessionParamReaderMap

SessionParamReaderMap Vertica::ServerInterface::udSessionParamReaderMap
protected

A map for session UDParameters that were set in the session by a user or by a UDx

Referenced by getUDSessionParamReader(), getUDSessionParamReaderMap(), and setUDSessionParameterMap().

◆ udxDebugLogLevel

vint Vertica::ServerInterface::udxDebugLogLevel

The level of UDx debug logging which is turned on as a UDXDebugLevel set of enumeration values. Used so UDxs may forgo generating debug log messages if debug logging is off.

◆ userName

std::string Vertica::ServerInterface::userName
protected

The username of the current session

Referenced by getUserName().

◆ vlogPtr

LoggingFunc Vertica::ServerInterface::vlogPtr
protected

Callback for logging, set by the server

Referenced by vlog().