Documentation ¶
Index ¶
- func Move(oldFP, newFP string) error
- func Read(fp *os.File, buffer []byte) (result []byte, newOffset int64, err error)
- func ReadStatus(filePtr *os.File) (fileStatus FileStatusEnum, replayStatus ReplayStateEnum, ...)
- type FileStatusEnum
- type Finder
- type OffsetIndexBuffer
- type ReplayError
- type ReplayStateEnum
- type ShortReadError
- type WTSet
- type WriteCommand
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Read ¶
Read reads the WAL file from current position. At end of file, Read returns io.EOF error.
func ReadStatus ¶
func ReadStatus(filePtr *os.File, ) (fileStatus FileStatusEnum, replayStatus ReplayStateEnum, owningInstanceID int64, err error)
Types ¶
type Finder ¶ added in v4.1.7
type Finder struct {
// contains filtered or unexported fields
}
type OffsetIndexBuffer ¶
type OffsetIndexBuffer []byte
func (OffsetIndexBuffer) Index ¶
func (b OffsetIndexBuffer) Index() int64
Index indicates the number of timeframes before this data from Jan 1st, 00:00:00 of the year. Note that Index starts from 1 (unless the timeframe is 1D). e.g. if timeframe=1Min and the time of the record = Jan 2nd, 03:04:05, then its index is 1625 because it's 1day 3hour 4min (=1624min) from Jan 1st, 00:00:00.
func (OffsetIndexBuffer) IndexAndPayload ¶
func (b OffsetIndexBuffer) IndexAndPayload() []byte
func (OffsetIndexBuffer) Offset ¶
func (b OffsetIndexBuffer) Offset() int64
Offset is the byte offset from the head of the file to write the record. offset = (index-1)*int64(recordSize) + FileHeadersSize. used to seek the point to write the record to the file.
func (OffsetIndexBuffer) Payload ¶
func (b OffsetIndexBuffer) Payload() []byte
Payload can be multiple rows data that have the same index, in case of VariableLength record type.
type ReplayError ¶ added in v4.1.7
ReplayError is used when the WALfile Replay process fails. If Cont:true, it will give up the Replay process, move the walfile to a temporary file, and continue with other marketstore processing.
func (ReplayError) Error ¶ added in v4.1.7
func (e ReplayError) Error() string
type ReplayStateEnum ¶
type ReplayStateEnum int8
const ( Invalid2 ReplayStateEnum = iota NOTREPLAYED REPLAYED REPLAYINPROCESS )
type ShortReadError ¶
type ShortReadError string
func (ShortReadError) Error ¶
func (msg ShortReadError) Error() string
type WTSet ¶
type WTSet struct { // Direct or Indirect IO (for variable or fixed length records) RecordType io.EnumRecordType // FilePath is an absolute path of the WAL file. The string is ASCII encoded without a trailing null FilePath string // Length of each data element in this set in bytes, excluding the index // In case of VARIABLE recordType, this value is always 24. // (=Index(8byte), Offset(8byte), DataLen of the the variable length records(8byte)) DataLen int // Used only in case of VARIABLE recordType. // (The sum of field lengths in elementTypes without Epoch column) + 4 bytes(for intervalTicks) VarRecLen int // Data bytes Buffer OffsetIndexBuffer // Data Shape with Epoch Column DataShapes []io.DataShape }
func NewWTSet ¶
func NewWTSet(recordType io.EnumRecordType, filePath string, dataLen, varRecLen int, data OffsetIndexBuffer, dataShapes []io.DataShape, ) WTSet
type WriteCommand ¶
type WriteCommand struct { RecordType io.EnumRecordType // WALKeyPath is the relative path from the root directory. // e.g. "WALFile.1621901771897875000.walfile" WALKeyPath string // VarRecLen is used only in case of VARIABLE recordType. // (The sum of field lengths in elementTypes without Epoch column) + 4 bytes(for intervalTicks) VarRecLen int Offset, Index int64 // Data can be for multiple row records. // If the record type is FIXED, one row data is the series of columns without Epoch column. // If it's VARIABLE, one row data is the series of columns without Epoch Column, but with IntervalTick(4byte). Data []byte // DataShapes with Epoch column DataShapes []io.DataShape }
WriteCommand is a write request for WriteAheadLog (WAL). One WriteCommand can have multiple row records that have the same index, in case of VariableLength record type.
func (*WriteCommand) String ¶ added in v4.1.6
func (wc *WriteCommand) String() string
Convert WriteCommand to string for debuging/presentation.