wal

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2017 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WalGuardedFile

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

func WalGuardedFileOpen

func WalGuardedFileOpen(fileName string) *WalGuardedFile

func (*WalGuardedFile) Close

func (w *WalGuardedFile) Close() error

func (*WalGuardedFile) GetInternalRealPath

func (w *WalGuardedFile) GetInternalRealPath() string

Returns the internal path by which the file actually resides in the filesystem.

TODO: have Writer dictate a safe internal path for WAL usage and not do this

ourselves.

type WalManager

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

func (*WalManager) AppendToFile

func (w *WalManager) AppendToFile(fileName string, content string, tx *transaction.EventstoreTransaction) (int, error)

WARNING: do only call once per file per transaction

func (*WalManager) ApplySideEffects

func (w *WalManager) ApplySideEffects(tx *transaction.EventstoreTransaction) error

func (*WalManager) BorrowFileForReading

func (w *WalManager) BorrowFileForReading(fileName string) (*os.File, error)

- the file is actually open in write mode. you are responsible for not writing to it. - and you are responsible for abandoning the use of the descriptor once you release the Writer's guarding mutex. - seeks are OK as we'll seek at the correct position on every write.

func (*WalManager) Close

func (*WalManager) CloseActiveFile

func (w *WalManager) CloseActiveFile(fileName string, tx *transaction.EventstoreTransaction) (string, error)

this file will never be written into again. returns the internal file path to the finished file, but it is only usable after WAL's ApplySideEffects() closes the file handle.

func (*WalManager) GetCurrentFileLength

func (w *WalManager) GetCurrentFileLength(fileName string) (int, error)

func (*WalManager) OpenNewFile

func (w *WalManager) OpenNewFile(fileName string, tx *transaction.EventstoreTransaction) error

func (*WalManager) RecoverAndOpenFile

func (w *WalManager) RecoverAndOpenFile(fileName string, tx *transaction.EventstoreTransaction) error

use this after restart to recover and re-open a file that was previously open. you cannot re-open file that was CloseActiveFile()'d, because that's final

Jump to

Keyboard shortcuts

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