boltdb/bolt

[RFE] change sequence number

obnoxxx opened this issue · 2 comments

For some purpuses it would be useful if boltdb had a change sequence number that would be set to 0 on creation of a new DB and bumped (+1) with every transaction (Update). It should be possible to retrieve the current sequence number with a method GetCSN or similar. (CSN - ChangeSequenceNumber. This is different from the bucket sequence, hence avoiding just "Sequence" in the example name.)

The Tx.ID() provides this functionality. It’s incremented only on write transactions.

@benbjohnson Thanks for the hint! I wasn't aware and certainly didn't think this way. If I got your proposal right, I would just open a View() and grab tx.ID() from within it. Easy enoug. Thanks!