Class TableStorage

java.lang.Object
dev.frostlake.storage.TableStorage

public class TableStorage extends Object
  • Constructor Details

  • Method Details

    • takeSnapshot

      public void takeSnapshot()
      Force a snapshot now (called after each DML operation).
    • snapshotAt

      public TableSnapshot snapshotAt(long targetMillis)
      Return the snapshot whose timestamp is closest to (but not after) targetMillis.
    • snapshotBefore

      public TableSnapshot snapshotBefore(long targetMillis)
      Return the snapshot just BEFORE targetMillis (exclusive).
    • snapshotAtOffset

      public TableSnapshot snapshotAtOffset(long offsetSeconds)
      Return offset seconds ago from now.
    • getSnapshots

      public List<TableSnapshot> getSnapshots()
    • getCreatedMillis

      public long getCreatedMillis()
      Epoch millis of this storage's creation — the earliest reachable time-travel point.
    • insert

      public void insert(Row written)
    • update

      public void update(int rowIndex, Row written)
    • delete

      public void delete(int rowIndex)
    • deleteAll

      public void deleteAll(List<Integer> indices)
      Delete every row at indices in ONE compaction pass over rows/rowIds with a single primary-key index rebuild at the end — the per-row delete(int) path pays an O(n) shift per removal plus a full index rebuild each time. Out-of-range indices are ignored, matching delete(int); duplicates are harmless.
    • scan

      public List<Row> scan()
    • replaceRow

      public void replaceRow(int index, Row newRow)
      Install a REPLACEMENT row at index — UPDATE never mutates a stored row in place, which is what lets takeSnapshot() keep pointer copies instead of deep copies.
    • getRow

      public Row getRow(int index)
      The live row at index (used at deferred-apply time to capture pre-change values).
    • getRowByPrimaryKey

      public Row getRowByPrimaryKey(Object key)
    • primaryKeyOf

      public Object primaryKeyOf(Row row)
      The primary-key value (single value, or list for a composite key) of row; null if no PK.
    • getRowCount

      public int getRowCount()
    • getRowId

      public long getRowId(int index)
      Stable identity of the row currently at index (index-aligned with scan()).
    • getRowIds

      public List<Long> getRowIds()
      TableSnapshot of the stable row ids, index-aligned with scan().
    • clear

      public void clear()
    • getNextAutoIncrementValue

      public long getNextAutoIncrementValue()