Documentation ¶
Index ¶
- Constants
- func NewBufPool() *sync.Pool
- func NewRowDataPool() *sync.Pool
- func ReadFromBuffer(buffer []byte, res *RowData) error
- func RowToStruct(dst interface{}, row *RowData, table Table) error
- func RowsDataToJSON(rowsData []*RowData, table Table, bufferPool *sync.Pool) (*wutils.Buffer, error)
- func SqliteDbPathForTableName(conf config.Config, tableName string) string
- func StructToRow(s interface{}, row *RowData, table Table) error
- type ColumnData
- type ColumnDescriptor
- type DataType
- type Driver
- func (d *Driver) AppendRowData(cf config.ContainerFile, rows []*RowData) error
- func (d *Driver) Archive(cf config.ContainerFile) error
- func (d *Driver) Close() error
- func (d *Driver) ExecRsyncCommand(params map[string][]string) ([]byte, error)
- func (d *Driver) Flush() (errOpsCount int, err error)
- func (d *Driver) FreeTable(t TableDataSlice)
- func (d *Driver) GetReplicator() *wal.Replicator
- func (d *Driver) ReadAllRowData(cf config.ContainerFile) (TableDataSlice, error)
- func (d *Driver) RemoveContent(cf config.ContainerFile) error
- type ErrBadEndingCRC
- type RowData
- type Table
- type TableData
- func ReadAllRowDataFromFile(cf config.ContainerFile, wal *wal.WAL, rowDataPool *sync.Pool, ...) (*TableData, error)
- func ReadAllRowDataFromFileBuffer(fileBuf *wutils.Buffer, rowDataPool *sync.Pool) (*TableData, error)
- func ReadAllRowDataFromFileCorruptSafe(cf config.ContainerFile, wal *wal.WAL, rowDataPool *sync.Pool, ...) (*TableData, error)
- type TableDataSlice
Constants ¶
const ( // Tuint uint type Tuint DataType = 0 // Tenum enum type Tenum = 1 // Tstring string type Tstring = 2 )
Variables ¶
This section is empty.
Functions ¶
func NewRowDataPool ¶ added in v0.0.13
NewRowDataPool init row data pool
func ReadFromBuffer ¶
ReadFromBuffer read row data from buffer
func RowToStruct ¶ added in v0.0.13
RowToStruct take a row and fill the struct with info
func RowsDataToJSON ¶
func RowsDataToJSON(rowsData []*RowData, table Table, bufferPool *sync.Pool) (*wutils.Buffer, error)
RowsDataToJSON rows data to JSON
func SqliteDbPathForTableName ¶ added in v0.0.13
SqliteDbPathForTableName return the path to the sqlite folder
func StructToRow ¶ added in v0.0.13
StructToRow take a struct and fill the row data equivalent
Types ¶
type ColumnData ¶
type ColumnData struct { // if buffer is not nil, EncodedRawValue is the buffer lenght // else the value can be used for value encoding (uint, int, bool, enum, float) EncodedRawValue uint64 Buffer []byte }
ColumnData is the lowest level representation of a column in binary format
func NewNullColumnData ¶ added in v0.0.13
func NewNullColumnData() ColumnData
NewNullColumnData create null ColumnData
func (ColumnData) AppendColumnData ¶
func (cd ColumnData) AppendColumnData(buffer []byte) []byte
AppendColumnData to buffer
func (ColumnData) DebugString ¶ added in v0.0.13
func (cd ColumnData) DebugString(d ColumnDescriptor) string
DebugString create a debug string
func (ColumnData) DebugStringRaw ¶ added in v0.0.13
func (cd ColumnData) DebugStringRaw() string
DebugStringRaw create a debug string
func (ColumnData) IsNull ¶ added in v0.0.13
func (cd ColumnData) IsNull() bool
IsNull is null ColumnData
type ColumnDescriptor ¶
type ColumnDescriptor struct { Name string JSONKey string JSONMandatory bool EnumValues []string NotNullable bool Type DataType }
ColumnDescriptor describe a storage column
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver is the entry point to serve file with the table packed file format
func InitDriver ¶
func InitDriver(conf config.Config, logger *zap.Logger, tableDescriptorRepo map[string]Table) (*Driver, error)
InitDriver init packed table dirver
func (*Driver) AppendRowData ¶
func (d *Driver) AppendRowData(cf config.ContainerFile, rows []*RowData) error
AppendRowData append rows to a container file
func (*Driver) Archive ¶
func (d *Driver) Archive(cf config.ContainerFile) error
Archive archive the file
func (*Driver) ExecRsyncCommand ¶
ExecRsyncCommand will clean up, pause, execute the rsync command and resume
func (*Driver) GetReplicator ¶
func (d *Driver) GetReplicator() *wal.Replicator
GetReplicator get replicator
func (*Driver) ReadAllRowData ¶
func (d *Driver) ReadAllRowData(cf config.ContainerFile) (TableDataSlice, error)
ReadAllRowData from file
func (*Driver) RemoveContent ¶ added in v0.0.13
func (d *Driver) RemoveContent(cf config.ContainerFile) error
RemoveContent append rows to a container file
type ErrBadEndingCRC ¶
type ErrBadEndingCRC struct {
SaneOffset int
}
ErrBadEndingCRC happened when a row has a bad CRC SaneOffset is the limit we should truncate the file to have a sane file
func (*ErrBadEndingCRC) Error ¶
func (e *ErrBadEndingCRC) Error() string
type RowData ¶
type RowData struct {
Data []ColumnData
}
RowData row data
func (RowData) WriteToBuffer ¶
WriteToBuffer write row data to buffer
type Table ¶
type Table struct { Name string Columns []ColumnDescriptor }
Table contains columns
func UnmarshallJSONTableDescriptor ¶ added in v0.0.13
UnmarshallJSONTableDescriptor unmarshall atable descriptor from a json file
type TableData ¶
type TableData struct { Data []*RowData // contains filtered or unexported fields }
TableData table data
func ReadAllRowDataFromFile ¶
func ReadAllRowDataFromFile(cf config.ContainerFile, wal *wal.WAL, rowDataPool *sync.Pool, bufferPool *sync.Pool) (*TableData, error)
ReadAllRowDataFromFile append row data
func ReadAllRowDataFromFileBuffer ¶ added in v0.0.13
func ReadAllRowDataFromFileBuffer(fileBuf *wutils.Buffer, rowDataPool *sync.Pool) (*TableData, error)
ReadAllRowDataFromFileBuffer append row data
type TableDataSlice ¶
type TableDataSlice struct {
// contains filtered or unexported fields
}
TableDataSlice table data slice
func InitTableDataSlice ¶
func InitTableDataSlice(t *TableData) TableDataSlice
InitTableDataSlice from table data
func (TableDataSlice) AllRows ¶
func (tds TableDataSlice) AllRows() []*RowData
AllRows get all rows in the slice
func (TableDataSlice) Release ¶
func (tds TableDataSlice) Release()
Release rfc count for this table data
func (TableDataSlice) Retain ¶
func (tds TableDataSlice) Retain()
Retain rfc count for this table data