vmware-archive / go-pmem-transaction

Golang library for using persistent memory
Other
29 stars 5 forks source link

Make Log() function in transaction package variadic #7

Closed jerrinsg closed 5 years ago

jerrinsg commented 5 years ago

Currently the Log() function only takes one argument. Pratap suggested making this variadic. This would be beneficial in cases where we log variables one after the other.

E.g.:

func main() {
    pmem.Init("database")
    var head *node
    n := pnew(node)

    head = (*node)(pmem.New(”hd", head))

    tx := transaction.NewUndoTx()
    tx.Begin()
    tx.Log(head)
    tx.Log(n)
    n.next = head.next
    head.next = n
    tx.End()
    transaction.Release(tx)
}

Here the two separate log statements could be combined as follows:

    txLog(head, n)
mohit10verma commented 5 years ago

This issue is fixed with this commit. Closing.