Documentation ¶
Index ¶
- Constants
- Variables
- func OpenWithHeader(filepPath string) (wlog *WalLog, h *Header, err error)
- type Header
- type ReaderFunc
- type WalLog
- func (w *WalLog) Close() error
- func (w *WalLog) Header() (*Header, error)
- func (w *WalLog) ReadAtMost(max uint32, readerFn ReaderFunc) (bool, error)
- func (w *WalLog) ReadFull(readerFn ReaderFunc) (bool, error)
- func (w *WalLog) Write(event eventlog.Encoder) error
- func (w *WalLog) WriteHeader(h *Header) error
Constants ¶
View Source
const (
DefaultMaxRead = 110 * 1024 * 1024 // 110MB
)
Variables ¶
View Source
var ( ErrExpectHeader = fmt.Errorf("expect having header before writing data") ErrHeaderAlreadyWritten = fmt.Errorf("header is already written") )
Functions ¶
Types ¶
type Header ¶
type Header struct { EventLogVersion string `json:"log_version"` OrgID string `json:"org_id"` SessionID string `json:"session_id"` UserID string `json:"user_id"` UserName string `json:"user_name"` UserEmail string `json:"user_email"` ConnectionName string `json:"connection_name"` ConnectionType string `json:"connection_type"` Status string `json:"status"` Script string `json:"script"` Labels string `json:"labels"` // we save it as string and convert at storage layer Verb string `json:"verb"` StartDate *time.Time `json:"start_date"` }
type ReaderFunc ¶
type WalLog ¶
type WalLog struct {
// contains filtered or unexported fields
}
func OpenWriteHeader ¶
OpenWithHeader opens the wallog and write the header, it's up to the caller to close the wal file
func (*WalLog) ReadAtMost ¶
func (w *WalLog) ReadAtMost(max uint32, readerFn ReaderFunc) (bool, error)
ReadAtMost reads event logs from a write ahead log up to max bytes specified. It returns a boolean indicading if it's truncated. It's up to the caller to decode the event log properly using a decoder.
func (*WalLog) ReadFull ¶
func (w *WalLog) ReadFull(readerFn ReaderFunc) (bool, error)
ReadFull reads events from the write ahead log until it reaches it max default size.
func (*WalLog) Write ¶
Write add the event to the write ahead log file. It supports writing any object that implements the eventlog.Encoder interface
func (*WalLog) WriteHeader ¶
WriteHeader writes h in the first position of the log
Click to show internal directories.
Click to hide internal directories.