Record Class JournalEntry

java.lang.Object
java.lang.Record
io.leandev.appfuse.file.tx.JournalEntry
Record Components:
timestamp - 事件發生時間
op - 操作類型
state - 交易生命週期狀態
partition - 儲存分區鍵(同 FileStorage 的 partition 參數)
fileId - 永久區檔案 ID(操作對象)
tempId - persist 的來源暫存 ID;store/delete 為 null
txName - 交易名稱(除錯關聯用,可為 null)

public record JournalEntry(Instant timestamp, JournalOp op, JournalState state, String partition, String fileId, String tempId, String txName) extends Record

檔案交易日誌的單筆事件(不可變值物件)

TransactionAwareFileStorage 在各交易 hook 點產生,交由 FileJournal 持久化。

  • Constructor Details

    • JournalEntry

      public JournalEntry(Instant timestamp, JournalOp op, JournalState state, String partition, String fileId, String tempId, String txName)
      Creates an instance of a JournalEntry record class.
      Parameters:
      timestamp - the value for the timestamp record component
      op - the value for the op record component
      state - the value for the state record component
      partition - the value for the partition record component
      fileId - the value for the fileId record component
      tempId - the value for the tempId record component
      txName - the value for the txName record component
  • Method Details

    • of

      public static JournalEntry of(JournalOp op, JournalState state, String partition, String fileId, String tempId, String txName)
      以當下時間建立一筆事件
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • timestamp

      public Instant timestamp()
      Returns the value of the timestamp record component.
      Returns:
      the value of the timestamp record component
    • op

      public JournalOp op()
      Returns the value of the op record component.
      Returns:
      the value of the op record component
    • state

      public JournalState state()
      Returns the value of the state record component.
      Returns:
      the value of the state record component
    • partition

      public String partition()
      Returns the value of the partition record component.
      Returns:
      the value of the partition record component
    • fileId

      public String fileId()
      Returns the value of the fileId record component.
      Returns:
      the value of the fileId record component
    • tempId

      public String tempId()
      Returns the value of the tempId record component.
      Returns:
      the value of the tempId record component
    • txName

      public String txName()
      Returns the value of the txName record component.
      Returns:
      the value of the txName record component