Documentation ¶
Index ¶
- type WalGuardedFile
- type WalManager
- func (w *WalManager) AppendToFile(fileName string, content string, tx *transaction.EventstoreTransaction) (int, error)
- func (w *WalManager) ApplySideEffects(tx *transaction.EventstoreTransaction) error
- func (w *WalManager) BorrowFileForReading(fileName string) (*os.File, error)
- func (w *WalManager) Close(tx *transaction.EventstoreTransaction)
- func (w *WalManager) CloseActiveFile(fileName string, tx *transaction.EventstoreTransaction) (string, error)
- func (w *WalManager) GetCurrentFileLength(fileName string) (int, error)
- func (w *WalManager) OpenNewFile(fileName string, tx *transaction.EventstoreTransaction) error
- func (w *WalManager) RecoverAndOpenFile(fileName string, tx *transaction.EventstoreTransaction) error
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 NewWalManager ¶
func NewWalManager(tx *transaction.EventstoreTransaction) *WalManager
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 (w *WalManager) Close(tx *transaction.EventstoreTransaction)
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