C++ SDK Documentation  12.0.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)
 
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
 
void std::string formatWithName (sqlName)
 
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

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

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

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

Describe a function

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

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

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

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

Describe a type

const std::string& Vertica::ServerInterface::getCurrentNodeName ( ) const
inline
Returns
the name of the vertica node on which this code is executed.
const std::string& Vertica::ServerInterface::getDatabaseName ( ) const
inline
Returns
the name of the database in which this code is executed.
const std::map<std::string, std::string>& Vertica::ServerInterface::getDependencies ( ) const
inline
Returns
a list of paths to rhe dependencies
virtual const UDFileSystem* Vertica::ServerInterface::getFileSystem ( const char *  path)
pure virtual

Get the file system corresponding to the provided path.

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

Returns the ParamReader that allows accessing parameter values using their names

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

Get the sessionParamReader

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

Get the UDSessionParamReader for a namespace

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

Get the UDSessionParamReader for the default namespace

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

Get the UDSessionParamReaderMap

const std::string& Vertica::ServerInterface::getUserName ( ) const
inline
Returns
the name of the vertica user of the current session.
virtual std::vector<BlobDescription> Vertica::ServerInterface::listBlobs ( BlobIdentifier::Namespace  nsp = BlobIdentifier::NSP_LIBRARY)
pure virtual

List the blobs in the given namespace

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

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

List projections given projection name

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.)

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

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

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.
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.

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

Report the provided ClientMessage as an error

Parameters
msgThe message to be reported
virtual void Vertica::ServerInterface::reportInfo ( ClientMessage  msg)
pure virtual

Report the provided ClientMessage as info

Parameters
msgThe message to be reported
virtual void Vertica::ServerInterface::reportNotice ( ClientMessage  msg)
pure virtual

Report the provided ClientMessage as a notice

Parameters
msgThe message to be reported
virtual void Vertica::ServerInterface::reportWarning ( ClientMessage  msg)
pure virtual

Report the provided ClientMessage as a warning

Parameters
msgThe message to be reported
void Vertica::ServerInterface::setDependencies ( const std::map< std::string, std::string >  dependencies)
inline
Returns
set the paths to the dependencies
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

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

Set the sessionParamReader

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

Set the UDSessionParamReaderMap

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

VTAllocator* Vertica::ServerInterface::allocator

Memory source which is managed and freed by the server.

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

Store the name of the current database

Referenced by getDatabaseName().

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

The list of all dependencies

Referenced by getDependencies(), and setDependencies().

FileManager* Vertica::ServerInterface::fileManager

File manager of the session context

Oid Vertica::ServerInterface::funcOid
protected

The Oid of the function

Oid Vertica::ServerInterface::libOid
protected

The Oid of the library

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

The locale of the current session

Referenced by getLocale().

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

Store the name of the current node

Referenced by getCurrentNodeName().

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().

Oid Vertica::ServerInterface::publicOid
protected

The Oid for public user-defined session parameters and blobs

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().

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

Store the name for error logging

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().

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.

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

The username of the current session

Referenced by getUserName().

LoggingFunc Vertica::ServerInterface::vlogPtr
protected

Callback for logging, set by the server

Referenced by vlog().