public interface DeltaLog
You can use the following code to create a DeltaLog
instance.
Configuration conf = ... // Create your own Hadoop Configuration instance
DeltaLog deltaLog = DeltaLog.forTable(conf, "/the/delta/table/path");
Modifier and Type | Method and Description |
---|---|
static DeltaLog |
forTable(org.apache.hadoop.conf.Configuration hadoopConf,
org.apache.hadoop.fs.Path path)
Create a
DeltaLog instance representing the table located at the provided
path . |
static DeltaLog |
forTable(org.apache.hadoop.conf.Configuration hadoopConf,
String path)
Create a
DeltaLog instance representing the table located at the provided
path . |
java.util.Iterator<VersionLog> |
getChanges(long startVersion,
boolean failOnDataLoss)
Get all actions starting from
startVersion (inclusive) in increasing order of
committed version. |
CommitInfo |
getCommitInfoAt(long version) |
org.apache.hadoop.fs.Path |
getPath() |
Snapshot |
getSnapshotForTimestampAsOf(long timestamp)
Travel back in time to the latest
Snapshot that was generated at or before
timestamp . |
Snapshot |
getSnapshotForVersionAsOf(long version)
Travel back in time to the
Snapshot with the provided version number. |
long |
getVersionAtOrAfterTimestamp(long timestamp)
Returns the latest version that was committed at or after
timestamp . |
long |
getVersionBeforeOrAtTimestamp(long timestamp)
Returns the latest version that was committed before or at
timestamp . |
Snapshot |
snapshot() |
OptimisticTransaction |
startTransaction()
Returns a new
OptimisticTransaction that can be used to read the current state of the
log and then commit updates. |
boolean |
tableExists() |
Snapshot |
update()
|
Snapshot snapshot()
Snapshot update()
Snapshot getSnapshotForVersionAsOf(long version)
Snapshot
with the provided version
number.version
- the snapshot version to generateversion
IllegalArgumentException
- if the version
is outside the range of available
versionsSnapshot getSnapshotForTimestampAsOf(long timestamp)
Snapshot
that was generated at or before
timestamp
.timestamp
- the number of milliseconds since midnight, January 1, 1970 UTCtimestamp
RuntimeException
- if the snapshot is unable to be recreatedIllegalArgumentException
- if the timestamp
is before the earliest possible
snapshot or after the latest possible snapshotOptimisticTransaction startTransaction()
OptimisticTransaction
that can be used to read the current state of the
log and then commit updates. The reads and updates will be checked for logical conflicts
with any concurrent writes to the log.
Note that all reads in a transaction must go through the returned transaction object, and not
directly to the DeltaLog
otherwise they will not be checked for conflicts.
OptimisticTransaction
.CommitInfo getCommitInfoAt(long version)
version
- the commit version to retrieve CommitInfo
CommitInfo
of the commit at the provided version.org.apache.hadoop.fs.Path getPath()
java.util.Iterator<VersionLog> getChanges(long startVersion, boolean failOnDataLoss)
startVersion
(inclusive) in increasing order of
committed version.
If startVersion
doesn't exist, return an empty Iterator
.
startVersion
- the table version to begin retrieving actions from (inclusive)failOnDataLoss
- whether to throw when data loss detectedIterator
of VersionLog
s starting from startVersion
IllegalArgumentException
- if startVersion
is negativeIllegalStateException
- if data loss detected and failOnDataLoss
is truelong getVersionBeforeOrAtTimestamp(long timestamp)
timestamp
. If no version
exists, returns -1.
Specifically:
timestamp
- the number of milliseconds since midnight, January 1, 1970 UTCtimestamp
.IllegalArgumentException
- if the timestamp is less than the timestamp of any committed
versionlong getVersionAtOrAfterTimestamp(long timestamp)
timestamp
. If no version
exists, returns -1.
Specifically:
timestamp
- the number of milliseconds since midnight, January 1, 1970 UTCtimestamp
.IllegalArgumentException
- if the timestamp is more than the timestamp of any committed
versionboolean tableExists()
static DeltaLog forTable(org.apache.hadoop.conf.Configuration hadoopConf, String path)
DeltaLog
instance representing the table located at the provided
path
.hadoopConf
- Hadoop Configuration
to use when accessing the Delta tablepath
- the path to the Delta tableDeltaLog
for the provided path
static DeltaLog forTable(org.apache.hadoop.conf.Configuration hadoopConf, org.apache.hadoop.fs.Path path)
DeltaLog
instance representing the table located at the provided
path
.hadoopConf
- Hadoop Configuration
to use when accessing the Delta tablepath
- the path to the Delta tableDeltaLog
for the provided path