Vertica::ServerInterface Class Reference

Provides UDxs with access to the Vertica server.

Collaboration diagram for Vertica::ServerInterface:

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 mReader, vint udxDebugLogLevel=0)
ServerInterface (VTAllocator *allocator, LoggingFunc func, const std::string &sqlName, const ParamReader mReader, 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 & getDependencies () const
virtual const UDFileSystem * getFileSystem (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 listBlobs (BlobIdentifier::Namespace nsp=BlobIdentifier::NSP_LIBRARY)=0
virtual void listDerivedTables (const RelationDescription &baseTable, std::vector &tables, bool errorIfNotFound=false)=0
virtual void listProjections (const RelationDescription &lookup, std::vector &projections, bool errorIfNotFound=false)=0
virtual void listTableProjections (const RelationDescription &baseTable, std::vector &projections, bool errorIfNotFound=false)=0
virtual void listTables (const RelationDescription &lookup, std::vector &tables, bool errorIfNotFound=false)=0
void log (const char *format,...) attribute((format(printf
virtual void logEvent (const std::map &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 dependencies)
void setFunctionOid (Oid FuncOid)
void setLibraryOid (Oid libOid_)
void setParamReader (const ParamReader mReader)
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
VTAllocator * allocator
va_list ap
FileManager * fileManager
format = formatWithName.c_str()
vint udxDebugLogLevel
Protected Attributes
std::string dbName
std::map 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& 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 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 & 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 & projections, bool errorIfNotFound = false)

pure virtual List projections given projection name

listTableProjections()

virtual void Vertica::ServerInterface::listTableProjections(const RelationDescription & baseTable, std::vector & 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 & 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

  • format: a printf-style format string specifying the log message format.

logEvent()

virtual void Vertica::ServerInterface::logEvent(const std::map & 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

  • msg: The message to be reported

reportInfo()

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

pure virtual Report the provided ClientMessage as info

Parameters

  • msg: The message to be reported

reportNotice()

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

pure virtual Report the provided ClientMessage as a notice

Parameters

  • msg: The message to be reported

reportWarning()

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

pure virtual Report the provided ClientMessage as a warning

Parameters

  • msg: The message to be reported

setDependencies()

void Vertica::ServerInterface::setDependencies(const std::map 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

  • format: a printf style format string specifying the log message format.
  • ap: va_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 Vertica::ServerInterface::dependencies

protected

The list of all dependencies

Referenced by

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

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

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

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