Java SDK Documentation  24.1.0
com.vertica.sdk.FileManager Class Referenceabstract
Collaboration diagram for com.vertica.sdk.FileManager:
Collaboration graph

Public Member Functions

abstract void closeReader (long readerID) throws UdfException, DestroyInvocation
 
abstract void closeWriter (long writerID) throws UdfException, DestroyInvocation
 
abstract int deleteIt (String fileName, boolean isRecursively) throws UdfException, DestroyInvocation
 
abstract void finalize ()
 
abstract boolean initDFSFile (DFSFile file) throws UdfException, DestroyInvocation
 
abstract List< DFSFilelistFiles (String fileName) throws UdfException, DestroyInvocation
 
abstract long openForRead (String fileName, DFSFile.DFSRootParentType parentType, String parentName) throws UdfException, DestroyInvocation
 
abstract long openForWrite (String fileName, DFSFile.DFSScope dfsScope, DFSFile.DFSDistribution dfsDistrib) throws UdfException, DestroyInvocation
 
abstract int read (long readerID, ByteBuffer buffer, int size) throws UdfException, DestroyInvocation
 
abstract long seek (long readerID, long offset, int origin) throws UdfException, DestroyInvocation
 
abstract long size (long readerID) throws UdfException, DestroyInvocation
 
abstract int write (long writerID, ByteBuffer buffer) throws UdfException, DestroyInvocation
 

Detailed Description

File Manager is a session level co-ordinator, which will be used by DFSFile, DFSFileReader and DFSFileWriter to interact with Catalog and Storage system of Vertica.

Member Function Documentation

◆ closeReader()

abstract void com.vertica.sdk.FileManager.closeReader ( long  readerID) throws UdfException, DestroyInvocation
abstract

Closes the file opened for reading, identified by 'readerID'

Parameters
readerIDid of the reader to close
Exceptions
UdfExceptionUDF problem
DestroyInvocationvertica canceling – do not catch or handle

Referenced by com.vertica.sdk.DFSFileReader.close().

◆ closeWriter()

abstract void com.vertica.sdk.FileManager.closeWriter ( long  writerID) throws UdfException, DestroyInvocation
abstract

Closes the file opened for writing, identified by 'writerID'

Parameters
writerIDid of the writer to close
Exceptions
UdfExceptionUDF problem
DestroyInvocationvertica canceling – do not catch or handle

Referenced by com.vertica.sdk.DFSFileWriter.close().

◆ deleteIt()

abstract int com.vertica.sdk.FileManager.deleteIt ( String  fileName,
boolean  isRecursively 
) throws UdfException, DestroyInvocation
abstract

Deletes a DFSFile, identified by full path 'fileName'.

Parameters
fileNamethe file or directory to delete
isRecursivelywhether to delete recursively
Returns
0 if successful, throw exceptions if there are errors
Exceptions
UdfExceptionUDF problem
DestroyInvocationvertica canceling – do not catch or handle

Referenced by com.vertica.sdk.DFSFile.deleteIt().

◆ finalize()

abstract void com.vertica.sdk.FileManager.finalize ( )
abstract

Finalizes a plan/query/statement. Should only invoke on the initiator node of a query. Complete file replication and commit metadata into the catalog. returns nothing, throws exceptions if there are errors.

◆ initDFSFile()

abstract boolean com.vertica.sdk.FileManager.initDFSFile ( DFSFile  file) throws UdfException, DestroyInvocation
abstract

Initialize a DFSFile upon constructing.

Parameters
filethe DFS file to initialize
Returns
true if file exists in the DFS, false otherwise
Exceptions
UdfExceptionUDF problem
DestroyInvocationvertica canceling – do not catch or handle

◆ listFiles()

abstract List<DFSFile> com.vertica.sdk.FileManager.listFiles ( String  fileName) throws UdfException, DestroyInvocation
abstract

Lists file under the path specified by 'fileName'

Parameters
fileNamename of file/directory to list
Returns
a list of DFSFile found under the path.
Exceptions
UdfExceptionUDF problem
DestroyInvocationvertica canceling – do not catch or handle

Referenced by com.vertica.sdk.DFSFile.listFiles().

◆ openForRead()

abstract long com.vertica.sdk.FileManager.openForRead ( String  fileName,
DFSFile.DFSRootParentType  parentType,
String  parentName 
) throws UdfException, DestroyInvocation
abstract

Opens a file for reading

Parameters
fileNamethe filename
parentTypetype of the parent
parentNamename of the parent
Returns
A unique identifier for the file opened. Return value is less than 0 if there are errors
Exceptions
UdfExceptionUDF problem
DestroyInvocationvertica canceling – do not catch or handle

◆ openForWrite()

abstract long com.vertica.sdk.FileManager.openForWrite ( String  fileName,
DFSFile.DFSScope  dfsScope,
DFSFile.DFSDistribution  dfsDistrib 
) throws UdfException, DestroyInvocation
abstract

Opens a file for writing

Parameters
fileNamename of file
dfsScopescope
dfsDistribdistribution
Returns
A unique identifier for the file opened. Return value is less tan 0 if there are errors
Exceptions
UdfExceptionUDF problem
DestroyInvocationvertica canceling – do not catch or handle

Referenced by com.vertica.sdk.DFSFileWriter.open().

◆ read()

abstract int com.vertica.sdk.FileManager.read ( long  readerID,
ByteBuffer  buffer,
int  size 
) throws UdfException, DestroyInvocation
abstract

Reads 'size' of bytes into buffer from the file identified by 'readerID'.

Parameters
readerIDid of the file reader
bufferByteBuffer to read into
sizenumber of bytes to read
Returns
number of bytes actually read, 0 if no bytes were read, indicates the EOF.
Exceptions
UdfExceptionUDF problem
DestroyInvocationvertica canceling – do not catch or handle

Referenced by com.vertica.sdk.DFSFileReader.read().

◆ seek()

abstract long com.vertica.sdk.FileManager.seek ( long  readerID,
long  offset,
int  origin 
) throws UdfException, DestroyInvocation
abstract

Reposition the read file offset

Parameters
readerIDid of the file reader
offsetoffset to seek to
originorigin from which to seek
Returns
the new file offset.
Exceptions
UdfExceptionUDF problem
DestroyInvocationvertica canceling – do not catch or handle

Referenced by com.vertica.sdk.DFSFileReader.seek().

◆ size()

abstract long com.vertica.sdk.FileManager.size ( long  readerID) throws UdfException, DestroyInvocation
abstract

Get size of file identified by 'readerID'

Parameters
readerIDid of the file reader
Returns
file size
Exceptions
UdfExceptionUDF problem
DestroyInvocationvertica canceling – do not catch or handle

◆ write()

abstract int com.vertica.sdk.FileManager.write ( long  writerID,
ByteBuffer  buffer 
) throws UdfException, DestroyInvocation
abstract

Writes bytes into the file identified by 'writerID' from the buffer.

Bytes are retrieved from buffer starting from the current position till it's limit. Current position will be advanced depending on how many bytes are written.

Parameters
writerIDid of the writer
bufferByteBuffer from which to write
Returns
number of bytes actually written, less than 0 if there are any errors.
Exceptions
UdfExceptionUDF problem
DestroyInvocationvertica canceling – do not catch or handle

Referenced by com.vertica.sdk.DFSFileWriter.write().