segmentio

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: 21 Imported by: 0

Documentation

Index

Constants

View Source
const ALL_UNIT_CLEAR = 0
View Source
const ALL_UNIT_SET = 0xffffffffffffffff
View Source
const BITS_PER_UNIT = UNIT_BYTES * 8
View Source
const BITS_PER_UNITSET = UNITSET_BYTES * 8
View Source
const BLOCK_SIZE = 4096
View Source
const BLOCK_SUFFIX = "blk"
View Source
const DATA_SIZE = SIZE - DATA_START
View Source
const DATA_START = 0
View Source
const DELETE_SUFFIX = "del"
View Source
const HOLE_SIZE = 512 * INODE_SIZE
View Source
const INDEX_SUFFIX = "idx"
View Source
const INODE_NUM = 20480
View Source
const INODE_SIZE = 512
View Source
const LOG_SIZE = INODE_NUM * INODE_SIZE
View Source
const LOG_START = 2 * BLOCK_SIZE
View Source
const MAGIC = 0xFFFFFFFF
View Source
const SIZE = 2 * 1024 * 1024 * 1024
View Source
const UNITSET_BYTES = UNIT_BYTES * UNITS_PER_UNITSET
View Source
const UNITS_PER_UNITSET = 8
View Source
const UNIT_BYTES = 8 // Length of uint64 bytes
View Source
const UPDATE_SUFFIX = "update"
View Source
const UPGRADE_FILE_NUM = 2

Variables

View Source
var ErrInodeLimit = errors.New("tae driver: Too many inodes")
View Source
var ErrNoSpace = errors.New("tae driver: No space")
View Source
var SegmentFactory file.SegmentFactory

Functions

This section is empty.

Types

type Allocator

type Allocator interface {
	Allocate(len uint64) (uint64, uint64)
	Free(start uint32, len uint32)
	CheckAllocations(start uint32, len uint32)
}

func NewBitmapAllocator

func NewBitmapAllocator(capacity uint64, pageSize uint32) Allocator

type BitmapAllocator

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

func (*BitmapAllocator) Allocate

func (b *BitmapAllocator) Allocate(needLen uint64) (uint64, uint64)

func (*BitmapAllocator) CheckAllocations

func (b *BitmapAllocator) CheckAllocations(start uint32, len uint32)

func (*BitmapAllocator) Free

func (b *BitmapAllocator) Free(start uint32, len uint32)

func (*BitmapAllocator) Init

func (b *BitmapAllocator) Init(capacity uint64, pageSize uint32)

type Driver

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

func (*Driver) Append

func (s *Driver) Append(fd *DriverFile, pl []byte) (err error)

func (*Driver) Destroy

func (s *Driver) Destroy()

func (*Driver) EncodeLogName

func (s *Driver) EncodeLogName(name string) string

func (*Driver) Free

func (s *Driver) Free(fd *DriverFile)

func (*Driver) GetInodeSize

func (s *Driver) GetInodeSize() uint32

func (*Driver) GetName

func (s *Driver) GetName() string

func (*Driver) GetNodes

func (s *Driver) GetNodes() map[string]*DriverFile

func (*Driver) GetPageSize

func (s *Driver) GetPageSize() uint32

func (*Driver) Init

func (s *Driver) Init(name string) (err error)

func (*Driver) Mount

func (s *Driver) Mount()

func (*Driver) NewBlockFile

func (s *Driver) NewBlockFile(fname string) *DriverFile

func (*Driver) Open

func (s *Driver) Open(name string) (err error)

func (*Driver) PrintLog

func (s *Driver) PrintLog(name, info string)

func (*Driver) ReleaseFile

func (s *Driver) ReleaseFile(fd *DriverFile)

func (*Driver) Replay

func (s *Driver) Replay(cache *bytes.Buffer) error

func (*Driver) Sync

func (s *Driver) Sync() error

func (*Driver) Unmount

func (s *Driver) Unmount()

func (*Driver) Update

func (s *Driver) Update(fd *DriverFile, pl []byte, fOffset uint64) error

type DriverFile

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

func (*DriverFile) Append

func (b *DriverFile) Append(offset uint64, data []byte, originSize uint32) (err error)

func (*DriverFile) Destroy

func (b *DriverFile) Destroy()

func (*DriverFile) GetExtents

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

func (*DriverFile) GetInode

func (b *DriverFile) GetInode() *Inode

func (*DriverFile) GetName

func (b *DriverFile) GetName() string

func (*DriverFile) GetSegement

func (b *DriverFile) GetSegement() *Driver

func (*DriverFile) Read

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

func (*DriverFile) ReadExtent

func (b *DriverFile) ReadExtent(offset, length uint32, data []byte) (uint32, error)

func (*DriverFile) SetCols

func (b *DriverFile) SetCols(cols uint32)

func (*DriverFile) SetIdxs

func (b *DriverFile) SetIdxs(idxs uint32)

func (*DriverFile) SetRows

func (b *DriverFile) SetRows(rows uint32)

func (*DriverFile) Update

func (b *DriverFile) Update(offset uint64, data []byte, fOffset uint32) ([]Extent, error)

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) GetFileSize

func (i *Inode) GetFileSize() int64

func (*Inode) GetIdxs

func (i *Inode) GetIdxs() uint32

func (*Inode) GetOriginSize

func (i *Inode) GetOriginSize() int64

func (*Inode) GetRows

func (i *Inode) GetRows() uint32

type Log

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

func (*Log) Append

func (l *Log) Append(file *DriverFile) error

func (*Log) CoverState

func (l *Log) CoverState(start uint32, state StateType) error

func (*Log) RemoveInode

func (l *Log) RemoveInode(file *DriverFile) error

func (*Log) Replay

func (l *Log) Replay(cache *bytes.Buffer) error

type StateType

type StateType uint8
const (
	RESIDENT StateType = iota
	REMOVE
)

type SuperBlock

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

Jump to

Keyboard shortcuts

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