Class BaseTransaction.TransactionTableOperations
- java.lang.Object
-
- org.apache.iceberg.BaseTransaction.TransactionTableOperations
-
- All Implemented Interfaces:
TableOperations
- Enclosing class:
- BaseTransaction
public class BaseTransaction.TransactionTableOperations extends java.lang.Object implements TableOperations
-
-
Constructor Summary
Constructors Constructor Description TransactionTableOperations()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
commit(TableMetadata underlyingBase, TableMetadata metadata)
Replace the base table metadata with a new version.TableMetadata
current()
Return the currently loaded table metadata, without checking for updates.EncryptionManager
encryption()
Returns aEncryptionManager
to encrypt and decrypt data files.FileIO
io()
Returns aFileIO
to read and write table data and metadata files.LocationProvider
locationProvider()
Returns aLocationProvider
that supplies locations for new new data files.java.lang.String
metadataFileLocation(java.lang.String fileName)
Given the name of a metadata file, obtain the full path of that file using an appropriate base location of the implementation's choosing.long
newSnapshotId()
Create a new ID for a SnapshotTableMetadata
refresh()
Return the current table metadata after checking for updates.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.iceberg.TableOperations
temp
-
-
-
-
Method Detail
-
current
public TableMetadata current()
Description copied from interface:TableOperations
Return the currently loaded table metadata, without checking for updates.- Specified by:
current
in interfaceTableOperations
- Returns:
- table metadata
-
refresh
public TableMetadata refresh()
Description copied from interface:TableOperations
Return the current table metadata after checking for updates.- Specified by:
refresh
in interfaceTableOperations
- Returns:
- table metadata
-
commit
public void commit(TableMetadata underlyingBase, TableMetadata metadata)
Description copied from interface:TableOperations
Replace the base table metadata with a new version.This method should implement and document atomicity guarantees.
Implementations must check that the base metadata is current to avoid overwriting updates. Once the atomic commit operation succeeds, implementations must not perform any operations that may fail because failure in this method cannot be distinguished from commit failure.
Implementations must throw a
CommitStateUnknownException
in cases where it cannot be determined if the commit succeeded or failed. For example if a network partition causes the confirmation of the commit to be lost, the implementation should throw a CommitStateUnknownException. This is important because downstream users of this API need to know whether they can clean up the commit or not, if the state is unknown then it is not safe to remove any files. All other exceptions will be treated as if the commit has failed.- Specified by:
commit
in interfaceTableOperations
- Parameters:
underlyingBase
- table metadata on which changes were basedmetadata
- new table metadata with updates
-
io
public FileIO io()
Description copied from interface:TableOperations
Returns aFileIO
to read and write table data and metadata files.- Specified by:
io
in interfaceTableOperations
-
encryption
public EncryptionManager encryption()
Description copied from interface:TableOperations
Returns aEncryptionManager
to encrypt and decrypt data files.- Specified by:
encryption
in interfaceTableOperations
-
metadataFileLocation
public java.lang.String metadataFileLocation(java.lang.String fileName)
Description copied from interface:TableOperations
Given the name of a metadata file, obtain the full path of that file using an appropriate base location of the implementation's choosing.The file may not exist yet, in which case the path should be returned as if it were to be created by e.g.
FileIO.newOutputFile(String)
.- Specified by:
metadataFileLocation
in interfaceTableOperations
-
locationProvider
public LocationProvider locationProvider()
Description copied from interface:TableOperations
Returns aLocationProvider
that supplies locations for new new data files.- Specified by:
locationProvider
in interfaceTableOperations
- Returns:
- a location provider configured for the current table state
-
newSnapshotId
public long newSnapshotId()
Description copied from interface:TableOperations
Create a new ID for a Snapshot- Specified by:
newSnapshotId
in interfaceTableOperations
- Returns:
- a long snapshot ID
-
-