Interface Connector
public interface Connector
-
Method Summary
Modifier and TypeMethodDescriptiondefault ConnectorTransactionHandle
beginTransaction
(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) Start a new transaction and return a handle for it.default void
commit
(ConnectorTransactionHandle transactionHandle) Commit the transaction.default ConnectorAccessControl
default List
<PropertyMetadata<?>> default Set
<ConnectorCapabilities> default List
<PropertyMetadata<?>> default Iterable
<EventListener> default Optional
<FunctionProvider> default ConnectorIndexProvider
default long
Retrieves the initial memory requirement for the connector.default List
<PropertyMetadata<?>> default ConnectorMetadata
getMetadata
(ConnectorSession session, ConnectorTransactionHandle transactionHandle) Guaranteed to be called at most once per transaction.default ConnectorPageSinkProvider
default ConnectorPageSourceProvider
Provide a pageSourceProviderFactory to create stateful instances of PageSourceProvider per query.default Set
<io.trino.spi.procedure.Procedure> default ConnectorRecordSetProvider
default List
<PropertyMetadata<?>> default List
<PropertyMetadata<?>> default ConnectorSplitManager
default Set
<SystemTable> default Set
<ConnectorTableFunction> default Set
<TableProcedureMetadata> default List
<PropertyMetadata<?>> default List
<PropertyMetadata<?>> default boolean
True if the connector only supports write statements in independent transactions.default void
rollback
(ConnectorTransactionHandle transactionHandle) Rollback the transaction.default void
shutdown()
Shutdown the connector by releasing any held resources such as threads, sockets, etc.
-
Method Details
-
beginTransaction
default ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) Start a new transaction and return a handle for it. The engine will callgetMetadata(io.trino.spi.connector.ConnectorSession, io.trino.spi.connector.ConnectorTransactionHandle)
to fetch the metadata instance for the transaction. The engine will later call exactly one ofcommit(io.trino.spi.connector.ConnectorTransactionHandle)
orrollback(io.trino.spi.connector.ConnectorTransactionHandle)
to end the transaction, even in auto-commit mode.If
true
is returned fromisSingleStatementWritesOnly()
, then the engine will enforce that auto-commit mode is used for writes, allowing connectors to execute writes immediately, rather than needing to wait until the transaction is committed.- Parameters:
isolationLevel
- minimum isolation level for the transactionreadOnly
- if the transaction is guaranteed to only read data (not write)autoCommit
- if the transaction uses auto-commit mode
-
getMetadata
default ConnectorMetadata getMetadata(ConnectorSession session, ConnectorTransactionHandle transactionHandle) Guaranteed to be called at most once per transaction. The returned metadata will only be accessed in a single threaded context. -
getSplitManager
- Throws:
UnsupportedOperationException
- if this connector does not support tables with splits
-
getPageSourceProvider
- Throws:
UnsupportedOperationException
- if this connector does not support reading tables page at a time
-
getPageSourceProviderFactory
Provide a pageSourceProviderFactory to create stateful instances of PageSourceProvider per query. If not implemented a singleton instance returned by getPageSourceProvider will be used for all queries. -
getRecordSetProvider
- Throws:
UnsupportedOperationException
- if this connector does not support reading tables record at a time
-
getPageSinkProvider
- Throws:
UnsupportedOperationException
- if this connector does not support writing tables page at a time
-
getIndexProvider
- Throws:
UnsupportedOperationException
- if this connector does not support indexes
-
getNodePartitioningProvider
- Throws:
UnsupportedOperationException
- if this connector does not support partitioned table layouts
-
getSystemTables
- Returns:
- the set of system tables provided by this connector
-
getFunctionProvider
- Returns:
- the set of procedures provided by this connector
-
getProcedures
- Returns:
- the set of procedures provided by this connector
-
getTableProcedures
-
getInitialMemoryRequirement
default long getInitialMemoryRequirement()Retrieves the initial memory requirement for the connector.The memory allocation is per catalog and is freed when the catalog is shut down.
- Returns:
- the initial memory requirement in bytes.
-
getTableFunctions
- Returns:
- the set of table functions provided by this connector
-
getSessionProperties
- Returns:
- the system properties for this connector
-
getSchemaProperties
- Returns:
- the schema properties for this connector
-
getAnalyzeProperties
- Returns:
- the analyze properties for this connector
-
getTableProperties
- Returns:
- the table properties for this connector
-
getViewProperties
- Returns:
- the view properties for this connector
-
getMaterializedViewProperties
- Returns:
- the materialized view properties for this connector
-
getColumnProperties
- Returns:
- the column properties for this connector
-
getAccessControl
- Throws:
UnsupportedOperationException
- if this connector does not have an access control
-
getEventListeners
- Returns:
- the event listeners provided by this connector
-
commit
Commit the transaction. Will be called at most once and will not be called ifrollback(io.trino.spi.connector.ConnectorTransactionHandle)
is called. -
rollback
Rollback the transaction. Will be called at most once and will not be called ifcommit(io.trino.spi.connector.ConnectorTransactionHandle)
is called.Note: calls to this method may race with calls to the ConnectorMetadata.
-
isSingleStatementWritesOnly
default boolean isSingleStatementWritesOnly()True if the connector only supports write statements in independent transactions. The engine will enforce this for the connector by requiring auto-commit mode for writes. -
shutdown
default void shutdown()Shutdown the connector by releasing any held resources such as threads, sockets, etc. This method will only be called when no queries are using the connector. After this method is called, no methods will be called on the connector or any objects that have been returned from the connector. -
getCapabilities
-