Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrClosed = fmt.Errorf("transaction: transaction closed")
var ErrOutOfBounds = fmt.Errorf("transaction: out of bounds")
Functions ¶
This section is empty.
Types ¶
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
Tx is a transaction on the raw byte data.
func Begin ¶
Begin starts and returns a new transaction. The given raw byte data starting from the given offset and ends after the given length copies to the snapshot which is allocated into the heap.
func (*Tx) Commit ¶
Commit flushes the snapshot to the original, closes this transaction and frees all resources associated with it.
func (*Tx) ReadAt ¶
ReadAt reads len(buf) bytes at given offset from start of the original from the snapshot. If the given offset is out of the available bounds or there are not enough bytes to read the ErrOutOfBounds error will be returned. Otherwise len(buf) will be returned with no errors. ReadAt implements the io.ReaderAt interface.
func (*Tx) WriteAt ¶
WriteAt writes len(buf) bytes at given offset from start of the original into the snapshot. If the given offset is out of the available bounds or there are not enough space to write all given bytes the ErrOutOfBounds error will be returned. Otherwise len(buf) will be returned with no errors. WriteAt implements the io.WriterAt interface.