objectio

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DATA = "data"
	META = "meta"
)
View Source
const MAGIC = 0xFFFFFFFF
View Source
const OBJECT_SIZE = 64 * 1024 * 1024
View Source
const PAGE_SIZE = 4096

Variables

View Source
var ExtName map[Extension]string = map[Extension]string{
	ColumnBlockExt:     "cblk",
	ComposedUpdatesExt: "cus",
	ColumnUpdatesExt:   "cu",
	DeletesExt:         "del",
	IndexExt:           "idx",
	MetaIndexExt:       "midx",
}
View Source
var SegmentFactory file.SegmentFactory

Functions

func EncodeColBlkNameWithVersion

func EncodeColBlkNameWithVersion(id *common.ID, version uint64, fs tfs.FS) (name string)

func EncodeDeleteName

func EncodeDeleteName(id *common.ID, fs tfs.FS) (name string)

func EncodeDeleteNameWithVersion

func EncodeDeleteNameWithVersion(id *common.ID, version uint64, fs tfs.FS) (name string)

func EncodeDir

func EncodeDir(id *common.ID) (dir string)

func EncodeIndexName

func EncodeIndexName(id *common.ID, idx int, fs tfs.FS) (name string)

func EncodeMetaIndexName

func EncodeMetaIndexName(id *common.ID, fs tfs.FS) (name string)

func EncodeUpdateNameWithVersion

func EncodeUpdateNameWithVersion(id *common.ID, version uint64, fs tfs.FS) (name string)

func ExtensionName

func ExtensionName(ext Extension) (name string)

func NewObjectFS

func NewObjectFS() tfs.FS

Types

type Attr

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

type Extension

type Extension int16
const (
	ColumnBlockExt Extension = iota + 1000
	ComposedUpdatesExt
	ColumnUpdatesExt
	DeletesExt
	IndexExt
	MetaIndexExt
)

type Extent

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

func (*Extent) End

func (ex *Extent) End() uint32

func (*Extent) GetData

func (ex *Extent) GetData() *entry

func (*Extent) Length

func (ex *Extent) Length() uint32

func (*Extent) Offset

func (ex *Extent) Offset() uint32

type ExtentType

type ExtentType uint8
const (
	APPEND ExtentType = iota
	UPDATE
)

type Inode

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

func (*Inode) GetAlgo

func (i *Inode) GetAlgo() uint8

func (*Inode) GetCols

func (i *Inode) GetCols() uint32

func (*Inode) GetDataSize

func (i *Inode) GetDataSize() int64

func (*Inode) GetFileSize

func (i *Inode) GetFileSize() int64

func (*Inode) GetIdxs

func (i *Inode) GetIdxs() uint32

func (*Inode) GetRows

func (i *Inode) GetRows() uint32

func (*Inode) Marshal

func (i *Inode) Marshal() (buf []byte, err error)

func (*Inode) UnMarshal

func (i *Inode) UnMarshal(cache *bytes.Buffer, inode *Inode) (n int, err error)

type InodeType

type InodeType uint8
const (
	FILE InodeType = iota
	DIR
)

type Object

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

func OpenObject

func OpenObject(id uint64, oType ObjectType, dir string) (object *Object, err error)

func (*Object) Append

func (o *Object) Append(data []byte) (offset, allocated uint64, err error)

func (*Object) GetSize

func (o *Object) GetSize() uint64

func (*Object) Read

func (o *Object) Read(offset int64, data []byte) (length int, err error)

type ObjectAllocator

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

func NewObjectAllocator

func NewObjectAllocator(capacity uint64, pageSize uint32) *ObjectAllocator

func (*ObjectAllocator) Allocate

func (o *ObjectAllocator) Allocate(needLen uint64) (uint64, uint64)

func (*ObjectAllocator) GetAvailable

func (o *ObjectAllocator) GetAvailable() uint64

func (*ObjectAllocator) Init

func (o *ObjectAllocator) Init(capacity uint64, pageSize uint32)

type ObjectDir

type ObjectDir struct {
	common.RefHelper
	// contains filtered or unexported fields
}

func (*ObjectDir) Close

func (d *ObjectDir) Close() error

func (*ObjectDir) Delete

func (d *ObjectDir) Delete(name string)

func (*ObjectDir) GetFileType

func (d *ObjectDir) GetFileType() common.FileType

func (*ObjectDir) OpenFile

func (d *ObjectDir) OpenFile(fs *ObjectFS, name string) tfs.File

func (*ObjectDir) Read

func (d *ObjectDir) Read(bytes []byte) (int, error)

func (*ObjectDir) Remove

func (d *ObjectDir) Remove(name string) error

func (*ObjectDir) Stat

func (d *ObjectDir) Stat() common.FileInfo

func (*ObjectDir) Sync

func (d *ObjectDir) Sync() error

func (*ObjectDir) Write

func (d *ObjectDir) Write(p []byte) (n int, err error)

type ObjectFS

type ObjectFS struct {
	sync.RWMutex
	common.RefHelper
	// contains filtered or unexported fields
}

func (*ObjectFS) Append

func (o *ObjectFS) Append(file *ObjectFile, data []byte) (n int, err error)

func (*ObjectFS) Delete

func (o *ObjectFS) Delete(file tfs.File) error

func (*ObjectFS) GetData

func (o *ObjectFS) GetData(size uint64) (object *Object, err error)

func (*ObjectFS) GetDataWithId

func (o *ObjectFS) GetDataWithId(id uint64) *Object

func (*ObjectFS) GetMeta

func (o *ObjectFS) GetMeta(size uint64) (object *Object, err error)

func (*ObjectFS) MountInfo

func (o *ObjectFS) MountInfo() *tfs.MountInfo

func (*ObjectFS) OpenFile

func (o *ObjectFS) OpenFile(name string, flag int) (tfs.File, error)

func (*ObjectFS) Read

func (o *ObjectFS) Read(file *ObjectFile, data []byte) (n int, err error)

func (*ObjectFS) ReadDir

func (o *ObjectFS) ReadDir(dir string) ([]common.FileInfo, error)

func (*ObjectFS) Remove

func (o *ObjectFS) Remove(name string) error

func (*ObjectFS) RemoveAll

func (o *ObjectFS) RemoveAll(dir string) error

func (*ObjectFS) SetDir

func (o *ObjectFS) SetDir(dir string)

func (*ObjectFS) Sync

func (o *ObjectFS) Sync(file *ObjectFile) error

type ObjectFile

type ObjectFile struct {
	common.RefHelper
	// contains filtered or unexported fields
}

func (*ObjectFile) Close

func (b *ObjectFile) Close() error

func (*ObjectFile) Destroy

func (b *ObjectFile) Destroy()

func (*ObjectFile) GetExtents

func (b *ObjectFile) GetExtents() *[]Extent

func (*ObjectFile) GetFS

func (b *ObjectFile) GetFS() *ObjectFS

func (*ObjectFile) GetFileType

func (b *ObjectFile) GetFileType() common.FileType

func (*ObjectFile) GetInode

func (b *ObjectFile) GetInode() *Inode

func (*ObjectFile) GetName

func (b *ObjectFile) GetName() string

func (*ObjectFile) Read

func (b *ObjectFile) Read(data []byte) (n int, err error)

func (*ObjectFile) SetCols

func (b *ObjectFile) SetCols(cols uint32)

func (*ObjectFile) SetIdxs

func (b *ObjectFile) SetIdxs(idxs uint32)

func (*ObjectFile) SetRows

func (b *ObjectFile) SetRows(rows uint32)

func (*ObjectFile) Stat

func (b *ObjectFile) Stat() common.FileInfo

func (*ObjectFile) Sync

func (b *ObjectFile) Sync() error

func (*ObjectFile) Write

func (b *ObjectFile) Write(data []byte) (n int, err error)

type ObjectType

type ObjectType uint8
const (
	DATATYPE ObjectType = iota
	METADATA
)

type Reader

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

func NewReader

func NewReader(fs tfs.FS, block *blockFile) *Reader

func (*Reader) LoadABlkColumns

func (r *Reader) LoadABlkColumns(
	colTypes []types.Type,
	colNames []string,
	nullables []bool,
	opts *containers.Options) (bat *containers.Batch, err error)

func (*Reader) LoadDeletes

func (r *Reader) LoadDeletes(id *common.ID) (mask *roaring.Bitmap, err error)

func (*Reader) LoadIndexMeta

func (r *Reader) LoadIndexMeta(id *common.ID) (any, error)

func (*Reader) LoadUpdates

func (r *Reader) LoadUpdates() (masks map[uint16]*roaring.Bitmap, vals map[uint16]map[uint32]any)

func (*Reader) Read

func (r *Reader) Read(
	version uint64,
	id *common.ID,
	data []byte) (err error)

type StateType

type StateType uint8
const (
	RESIDENT StateType = iota
	REMOVE
)

type VFS

type VFS struct {
	common.RefHelper
	// contains filtered or unexported fields
}

func (*VFS) GetFileType

func (v *VFS) GetFileType() common.FileType

func (*VFS) Read

func (v *VFS) Read(p []byte) (n int, err error)

func (*VFS) RefCount

func (v *VFS) RefCount() int64

func (*VFS) Stat

func (v *VFS) Stat() common.FileInfo

func (*VFS) Write

func (v *VFS) Write(p []byte) (n int, err error)

type Writer

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

func NewWriter

func NewWriter(fs tfs.FS) *Writer

func (*Writer) WriteABlkColumn

func (w *Writer) WriteABlkColumn(
	version uint64,
	id *common.ID,
	column containers.Vector) (info common.FileInfo, err error)

func (*Writer) WriteABlkColumns

func (w *Writer) WriteABlkColumns(
	version uint64,
	id *common.ID,
	columns *containers.Batch) (infos []common.FileInfo, err error)

func (*Writer) WriteBlockColumn

func (w *Writer) WriteBlockColumn(
	version uint64,
	id *common.ID,
	column *vector.Vector) (err error)

func (*Writer) WriteData

func (w *Writer) WriteData(
	version uint64,
	id *common.ID,
	data []byte) (err error)

func (*Writer) WriteDeletes

func (w *Writer) WriteDeletes(
	version uint64,
	id *common.ID,
	data []byte) (err error)

func (*Writer) WriteIndex

func (w *Writer) WriteIndex(
	id *common.ID,
	idx int,
	data []byte) (err error)

func (*Writer) WriteIndexMeta

func (w *Writer) WriteIndexMeta(
	id *common.ID,
	data []byte) (err error)

func (*Writer) WriteUpdates

func (w *Writer) WriteUpdates(
	version uint64,
	id *common.ID,
	data []byte) (err error)

func (*Writer) WriteZonemapIndexFromSource

func (w *Writer) WriteZonemapIndexFromSource(
	version uint64,
	cols []int,
	indexT catalog.IndexT,
	id *common.ID,
	source *vector.Vector) (err error)

Jump to

Keyboard shortcuts

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