seq

package
v0.0.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Seq

type Seq struct {
	sync.Mutex
	Root string
}

func NewSeq

func NewSeq(root string) *Seq

func (*Seq) CurrentSeqState

func (s *Seq) CurrentSeqState() (*State, error)

CurrentSeqState returns the current sequence state without incrementing.

func (*Seq) NextCommit

func (s *Seq) NextCommit() (int64, error)

NextCommit atomically increments and returns the next commit count.

func (*Seq) NextCommitLocked

func (s *Seq) NextCommitLocked() (int64, error)

func (*Seq) NextTxSeq

func (s *Seq) NextTxSeq() (int64, error)

NextTxSeq atomically increments and returns the next transaction sequence number.

func (*Seq) ReadStateLocked

func (s *Seq) ReadStateLocked() (*State, error)

readSeqState reads the sequence state from disk. Caller must hold seqMu lock.

func (*Seq) WriteStateLocked

func (s *Seq) WriteStateLocked(state *State) error

WriteStateLocked writes the sequence state to disk atomically. Caller must hold seqMu lock.

type State

type State struct {
	Commit int64 // Monotonic commit count
	TxSeq  int64 // Transaction sequence number
}

State represents the sequence number state.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL