Class BaseViewOperations
- java.lang.Object
-
- org.apache.iceberg.view.BaseViewOperations
-
- All Implemented Interfaces:
ViewOperations
- Direct Known Subclasses:
JdbcViewOperations,NessieViewOperations
public abstract class BaseViewOperations extends java.lang.Object implements ViewOperations
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedBaseViewOperations()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcommit(ViewMetadata base, ViewMetadata metadata)Replace the base view metadata with a new version.ViewMetadatacurrent()Return the currently loaded view metadata, without checking for updates.protected java.lang.StringcurrentMetadataLocation()protected intcurrentVersion()protected voiddisableRefresh()protected abstract voiddoCommit(ViewMetadata base, ViewMetadata metadata)protected abstract voiddoRefresh()protected abstract FileIOio()ViewMetadatarefresh()Return the current view metadata after checking for updates.protected voidrefreshFromMetadataLocation(java.lang.String newLocation)protected voidrefreshFromMetadataLocation(java.lang.String newLocation, java.util.function.Predicate<java.lang.Exception> shouldRetry, int numRetries)protected voidrefreshFromMetadataLocation(java.lang.String newLocation, java.util.function.Predicate<java.lang.Exception> shouldRetry, int numRetries, java.util.function.Function<java.lang.String,ViewMetadata> metadataLoader)protected voidrequestRefresh()protected abstract java.lang.StringviewName()protected java.lang.StringwriteNewMetadataIfRequired(ViewMetadata metadata)
-
-
-
Method Detail
-
requestRefresh
protected void requestRefresh()
-
disableRefresh
protected void disableRefresh()
-
doRefresh
protected abstract void doRefresh()
-
doCommit
protected abstract void doCommit(ViewMetadata base, ViewMetadata metadata)
-
viewName
protected abstract java.lang.String viewName()
-
io
protected abstract FileIO io()
-
currentMetadataLocation
protected java.lang.String currentMetadataLocation()
-
currentVersion
protected int currentVersion()
-
current
public ViewMetadata current()
Description copied from interface:ViewOperationsReturn the currently loaded view metadata, without checking for updates.- Specified by:
currentin interfaceViewOperations- Returns:
- view metadata
-
refresh
public ViewMetadata refresh()
Description copied from interface:ViewOperationsReturn the current view metadata after checking for updates.- Specified by:
refreshin interfaceViewOperations- Returns:
- view metadata
-
commit
public void commit(ViewMetadata base, ViewMetadata metadata)
Description copied from interface:ViewOperationsReplace the base view 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 should throw a
CommitStateUnknownExceptionin 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. An unknown state indicates to downstream users of this API that it is not safe to perform clean up and remove any files. In general, strict metadata cleanup will only trigger cleanups when the commit fails with an exception implementing the marker interfaceCleanableFailure. All other exceptions will be treated as if the commit has failed.- Specified by:
commitin interfaceViewOperations- Parameters:
base- view metadata on which changes were basedmetadata- new view metadata with updates
-
writeNewMetadataIfRequired
protected java.lang.String writeNewMetadataIfRequired(ViewMetadata metadata)
-
refreshFromMetadataLocation
protected void refreshFromMetadataLocation(java.lang.String newLocation)
-
refreshFromMetadataLocation
protected void refreshFromMetadataLocation(java.lang.String newLocation, java.util.function.Predicate<java.lang.Exception> shouldRetry, int numRetries)
-
refreshFromMetadataLocation
protected void refreshFromMetadataLocation(java.lang.String newLocation, java.util.function.Predicate<java.lang.Exception> shouldRetry, int numRetries, java.util.function.Function<java.lang.String,ViewMetadata> metadataLoader)
-
-