transaction

package
v0.0.0-...-1613cdf Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckpointLogRecord

type CheckpointLogRecord struct {
}

func NewCheckpointLogRecord

func NewCheckpointLogRecord() CheckpointLogRecord

func (CheckpointLogRecord) String

func (r CheckpointLogRecord) String() string

func (CheckpointLogRecord) TxNum

func (r CheckpointLogRecord) TxNum() int32

func (CheckpointLogRecord) Type

func (CheckpointLogRecord) Undo

func (CheckpointLogRecord) WriteTo

type CommitLogRecord

type CommitLogRecord struct {
	// contains filtered or unexported fields
}

func NewCommitLogRecord

func NewCommitLogRecord(txNum int32) CommitLogRecord

func NewCommitLogRecordPage

func NewCommitLogRecordPage(p *file.Page) CommitLogRecord

func (CommitLogRecord) String

func (r CommitLogRecord) String() string

func (CommitLogRecord) TxNum

func (r CommitLogRecord) TxNum() int32

func (CommitLogRecord) Type

func (r CommitLogRecord) Type() LogRecordType

func (CommitLogRecord) Undo

func (r CommitLogRecord) Undo(_ *Transaction) error

func (CommitLogRecord) WriteTo

func (r CommitLogRecord) WriteTo(lm *log.Manager) (log.SequenceNumber, error)

type LogRecord

type LogRecord interface {
	fmt.Stringer
	Type() LogRecordType
	TxNum() int32
	Undo(tx *Transaction) error
	WriteTo(lm *log.Manager) (log.SequenceNumber, error)
}

func NewLogRecord

func NewLogRecord(bytes []byte) LogRecord

type LogRecordType

type LogRecordType int32
const (
	Checkpoint LogRecordType = iota
	Start
	Commit
	Rollback
	SetInt32
	SetStr
)

type RollbackLogRecord

type RollbackLogRecord struct {
	// contains filtered or unexported fields
}

func NewRollbackLogRecord

func NewRollbackLogRecord(txNum int32) RollbackLogRecord

func NewRollbackLogRecordPage

func NewRollbackLogRecordPage(p *file.Page) RollbackLogRecord

func (RollbackLogRecord) String

func (r RollbackLogRecord) String() string

func (RollbackLogRecord) TxNum

func (r RollbackLogRecord) TxNum() int32

func (RollbackLogRecord) Type

func (RollbackLogRecord) Undo

func (r RollbackLogRecord) Undo(_ *Transaction) error

func (RollbackLogRecord) WriteTo

type SetInt32LogRecord

type SetInt32LogRecord struct {
	// contains filtered or unexported fields
}

func NewSetInt32LogRecord

func NewSetInt32LogRecord(txNum int32, blockID file.BlockID, offset, val int32) SetInt32LogRecord

func NewSetInt32LogRecordPage

func NewSetInt32LogRecordPage(p *file.Page) SetInt32LogRecord

func (SetInt32LogRecord) String

func (r SetInt32LogRecord) String() string

func (SetInt32LogRecord) TxNum

func (r SetInt32LogRecord) TxNum() int32

func (SetInt32LogRecord) Type

func (SetInt32LogRecord) Undo

func (r SetInt32LogRecord) Undo(tx *Transaction) error

func (SetInt32LogRecord) WriteTo

type SetStrLogRecord

type SetStrLogRecord struct {
	// contains filtered or unexported fields
}

func NewSetStrLogRecord

func NewSetStrLogRecord(txNum int32, blockID file.BlockID, offset int32, val string) SetStrLogRecord

func NewSetStrLogRecordPage

func NewSetStrLogRecordPage(p *file.Page) SetStrLogRecord

func (SetStrLogRecord) String

func (r SetStrLogRecord) String() string

func (SetStrLogRecord) TxNum

func (r SetStrLogRecord) TxNum() int32

func (SetStrLogRecord) Type

func (r SetStrLogRecord) Type() LogRecordType

func (SetStrLogRecord) Undo

func (r SetStrLogRecord) Undo(tx *Transaction) error

func (SetStrLogRecord) WriteTo

func (r SetStrLogRecord) WriteTo(lm *log.Manager) (log.SequenceNumber, error)

type StartLogRecord

type StartLogRecord struct {
	// contains filtered or unexported fields
}

func NewStartLogRecord

func NewStartLogRecord(txNum int32) StartLogRecord

func NewStartLogRecordPage

func NewStartLogRecordPage(p *file.Page) StartLogRecord

func (StartLogRecord) String

func (r StartLogRecord) String() string

func (StartLogRecord) TxNum

func (r StartLogRecord) TxNum() int32

func (StartLogRecord) Type

func (r StartLogRecord) Type() LogRecordType

func (StartLogRecord) Undo

func (r StartLogRecord) Undo(_ *Transaction) error

func (StartLogRecord) WriteTo

func (r StartLogRecord) WriteTo(lm *log.Manager) (log.SequenceNumber, error)

type Transaction

type Transaction struct {
	// contains filtered or unexported fields
}

func NewTransaction

func NewTransaction(
	ctx context.Context,
	bm *buffer.Manager,
	fm *file.Manager,
	lm *log.Manager,
) (*Transaction, error)

func (*Transaction) Append

func (t *Transaction) Append(filename string) (file.BlockID, error)

func (*Transaction) AvailableBuffersNum

func (t *Transaction) AvailableBuffersNum() int

func (*Transaction) BlockSize

func (t *Transaction) BlockSize() int32

func (*Transaction) Commit

func (t *Transaction) Commit() error

func (*Transaction) Int32

func (t *Transaction) Int32(blockID file.BlockID, offset int32) (int32, error)

func (*Transaction) Pin

func (t *Transaction) Pin(blockID file.BlockID) (*buffer.Buffer, error)

func (*Transaction) Recover

func (t *Transaction) Recover() error

func (*Transaction) Rollback

func (t *Transaction) Rollback() error

func (*Transaction) SetInt32

func (t *Transaction) SetInt32(blockID file.BlockID, offset, val int32, okToLog bool) error

func (*Transaction) SetStr

func (t *Transaction) SetStr(blockID file.BlockID, offset int32, val string, okToLog bool) error

func (*Transaction) Size

func (t *Transaction) Size(filename string) (int32, error)

func (*Transaction) Str

func (t *Transaction) Str(blockID file.BlockID, offset int32) (string, error)

func (*Transaction) Unpin

func (t *Transaction) Unpin(blockID file.BlockID) error

Jump to

Keyboard shortcuts

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