diskpoda

package module
v0.0.0-...-81e7329 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2024 License: BSD-3-Clause Imports: 17 Imported by: 0

README

diskpoda

using whole disk partition as database.so it has high speed and make SSD disk have more lifetime.

Documentation

Overview

diskpoda project diskpoda.go iwlb@outlook.com 2024/09/19 disk partition as a database.

diskpoda document

Index

Constants

View Source
const (
	ERROR = iota
	LIST
	FILE
	ROW
	COLLUM
	OBJECT
	ANY
	VECTOR
	MATRIX
	CODE
	FUNCTION
	ENVIROMENT
	SENTENCE
	SENTORLD //SENTENCE ELEMENT;PART OF SENTENCE;
	SITORD   //SENTORLD'S WORD;
	PIPE

	INT
	UINT
	INT8
	UINT8
	INT16
	UINT16
	INT32
	UINT32
	INT64
	UINT64
	LISTBYTE
	STRING
)

Variables

This section is empty.

Functions

func ClosePartition

func ClosePartition(parth uint64)

func DiskSizeStep

func DiskSizeStep(size uint64) uint64

func OpenPartition

func OpenPartition(path string) uint64

Types

type Any

type Any = *Table

func NewValue

func NewValue(v any) Any

type Area

type Area = *Table

type BatteryCapacity

type BatteryCapacity = *Table

type BinaryNumber

type BinaryNumber = *Table

type Bit

type Bit = *Table

type Bool

type Bool = *Table

type Bools

type Bools = *Table

type Bytes

type Bytes = *Table

type Code

type Code = *Table

func NewCode

func NewCode() Code

func NewFunction

func NewFunction() Code

type Collum

type Collum = *Table

func NewCollum

func NewCollum() Collum

type Color

type Color = *Table

type Coordinate

type Coordinate = *Table

type Cubage

type Cubage = *Table

type Current

type Current = *Table

type Dampness

type Dampness = *Table

type DataBlockInfo

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

type DecimalNumber

type DecimalNumber = *Table

type Density

type Density = *Table

type Diskpoda

type Diskpoda struct {
	Path string

	Opt       *DiskpodaOption
	IdBlocks  [][]byte
	Num_block map[uint32]*SpaceBlockInfo

	SyncChan chan int
	// contains filtered or unexported fields
}

func OpenDiskpoda

func OpenDiskpoda(path string, opt *DiskpodaOption) (*Diskpoda, error)

设计就是name id常用来处理搜索执行用. 需要融入:dealloc_numnums,name_id,named_named_id, 结构:文件系统分区信息扇区;ID找地址表:1/32*2^32ID*6byte地址信息第一块;4byte哈希*2^32*6byte名字地址或者名字地址列表的地址24GB;被释放空间记录数据开始;第一个可以分配名字数据开始地址; id 4byte表示,时间4byte表示(现实必须带时间); 流会实际写入硬盘,缓存两边,numnus全部缓存,idaddrs全部缓存,hashaddr全部缓存,idseg全部缓存,缓存的都是小数据,Sync前写入个压缩的硬盘备份;

func (*Diskpoda) AddHash

func (dp *Diskpoda) AddHash(name string, addr uint64) (er error)

func (*Diskpoda) AddId

func (dp *Diskpoda) AddId(id uint32, addr uint64) (er error)

func (*Diskpoda) AllocId

func (dp *Diskpoda) AllocId() (id uint32)

func (*Diskpoda) Close

func (dp *Diskpoda) Close() error

func (*Diskpoda) CondGet

func (dp *Diskpoda) CondGet(condses, getses *Table) (tb []*Table)

func (*Diskpoda) CondSet

func (dp *Diskpoda) CondSet(condses, setses *Table) Error

func (*Diskpoda) DelHash

func (dp *Diskpoda) DelHash(name string, addr uint64) (er error)

func (*Diskpoda) DelId

func (dp *Diskpoda) DelId(id uint32, addr uint64) (er error)

func (*Diskpoda) DeleteData

func (dp *Diskpoda) DeleteData(name string, id, addr uint64) (er error)

func (*Diskpoda) DiskAllocSpace

func (dp *Diskpoda) DiskAllocSpace(size uint64) (id uint64)

func (*Diskpoda) DiskStepSize

func (dp *Diskpoda) DiskStepSize(size uint64) uint64

func (*Diskpoda) GetData

func (dp *Diskpoda) GetData(name string, id uint32, addr uint64, outbuf []byte) (data []byte)

func (*Diskpoda) GetSpace

func (dp *Diskpoda) GetSpace(lendata uint64) (addr uint64)

fail 0;

func (*Diskpoda) GetTable

func (dp *Diskpoda) GetTable(name string, id uint32, addr uint64) (tb *Table)

func (*Diskpoda) OpenStream

func (dp *Diskpoda) OpenStream(name string, id uint32, addr, blocksize uint64, bcompress byte) (ds *Stream)

func (*Diskpoda) OpenTable

func (dp *Diskpoda) OpenTable(name string, id uint64, addr uint64) (tb *Table)

func (*Diskpoda) PutData

func (dp *Diskpoda) PutData(name string, id uint32, addr uint64, data []byte, bcompress byte) (retaddr uint64, er error)

防止掉电出错: 要做的事情日志记录下来 记录开始操作 再操作 记录停止操作

func (*Diskpoda) PutSpace

func (dp *Diskpoda) PutSpace(lendata uint64, addr uint64) error

func (*Diskpoda) PutTable

func (dp *Diskpoda) PutTable(name string, id uint32, addr uint64, tb *Table) (retaddr uint64, er Error)

func (*Diskpoda) ReadSector

func (dp *Diskpoda) ReadSector(secpos uint64, bs []byte) uint64

func (*Diskpoda) ReadSectorTail

func (dp *Diskpoda) ReadSectorTail(addr uint64, outsectabuf []byte) (outsecta []byte)

outsectabuf is nil use bytespool.Put(outbs) to release memory;

func (*Diskpoda) ReleaseAddr

func (dp *Diskpoda) ReleaseAddr(addr uint64) (err error)

bsbuf length < out size should release memory by bytespool.Put(outbs);

func (*Diskpoda) Sync

func (dp *Diskpoda) Sync() error

func (*Diskpoda) WriteSector

func (dp *Diskpoda) WriteSector(secpos uint64, bs []byte) uint64

type DiskpodaOption

type DiskpodaOption struct {
	FullSize     uint64
	SectorSize   uint64 //should be 512;ssd最小读写单元;
	IdSegCur     uint64 //address have 512MB;max 2^32 ID value;
	SizeBitCnt   uint64
	FreeSpaceCur uint64

	//free space num nums
	NumnumsBlockSize               uint64
	MaxModelVal                    uint64 //must equal or great than physical sector byte size;
	MaxBlockSize                   uint64 //stream file or single block file max block size;
	TwoAddrbytelen                 uint64 //default 11byte;
	AddrPrefixbitlen               uint64 //AddrPrefixbitlen+Addrbitlen*2=TwoAddrbytelen*8;
	Addrbitlen                     uint64 //AddrPrefixbitlen+Addrbitlen*2=TwoAddrbytelen*8;
	BlockSizeByteCnt               uint64 //3byte;
	UselessStreamBlockSize         uint64 //存储修改极少或者每次全部不一样的数据大于4兆的数据256kb一块的流文件.
	DefaultStreamBlockSize         uint64 //4096byte;
	DefaultStreamCompressBlockSize uint64 //4*4096byte;
}

func DefaultDiskpodaOption

func DefaultDiskpodaOption(partitionsize, sectorsize uint64) *DiskpodaOption

type Dollar

type Dollar = *Table

type ElectricEnerger

type ElectricEnerger = *Table

type ElectricQuantity

type ElectricQuantity = *Table

type Energy

type Energy = *Table

type Enviroment

type Enviroment = *Table

func NewEnviroment

func NewEnviroment() Enviroment

type Equation

type Equation = *Table

type Error

type Error *Table

func NewError

func NewError(s string) Error

func NewFile

func NewFile(s string) Error

type File

type File = *Table

type Float32

type Float32 = *Table

type Float32s

type Float32s = *Table

type Float64

type Float64 = *Table

type Float64s

type Float64s = *Table

type Force

type Force = *Table

type Function

type Function = *Table

type Graph

type Graph = *Table

type HVector

type HVector = *Table

type Height

type Height = *Table

type IdSet

type IdSet = *Table

type Image

type Image = *Table

type Int

type Int = *Table

type Int16

type Int16 = *Table

type Int16s

type Int16s = *Table

type Int32

type Int32 = *Table

type Int32s

type Int32s = *Table

type Int64

type Int64 = *Table

type Int64s

type Int64s = *Table

type Int8

type Int8 = *Table

type Int8s

type Int8s = *Table

type Integer

type Integer = *Table

type Intensity

type Intensity = *Table

type Ints

type Ints = *Table

type KeyValue

type KeyValue = *Table

type Length

type Length = *Table

type List

type List = *Table

type Matrix

type Matrix = *Table

func NewMatrix

func NewMatrix() Matrix

type Number

type Number = *Table

type Object

type Object = *Table

func NewObject

func NewObject() Object

type Percentage

type Percentage = *Table

type Pipe

type Pipe = *Table

type Placename

type Placename = *Table

type Quantity

type Quantity = *Table

type Range

type Range = *Table

type RangeSet

type RangeSet = *Table

type Rmb

type Rmb = *Table

type Row

type Row = *Table

func NewRow

func NewRow() Row

type Sentence

type Sentence = *Table

func NewSentence

func NewSentence() Sentence

type Setoret

type Setoret = *Table //entorld's word;

type Setorld

type Setorld = *Table //sentence element;part of sentence;

type Sound

type Sound = *Table

type SpaceBlockInfo

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

type SpaceModel

type SpaceModel = *Table

type Speed

type Speed = *Table

type StateOfMatter

type StateOfMatter = *Table

type Stream

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

func (*Stream) Addr

func (ds *Stream) Addr() (addr uint64)

func (*Stream) BlockMaxDataSize

func (ds *Stream) BlockMaxDataSize() (siz uint64)

func (*Stream) Close

func (ds *Stream) Close() (er error)

func (*Stream) Read

func (ds *Stream) Read(pos uint64, outbsbuf []byte) (obs []byte)

func (*Stream) ReadAll

func (ds *Stream) ReadAll(outbsbuf []byte) (outbs []byte)

if cap(buf)<output bytespool.Put(output);

func (*Stream) Size

func (ds *Stream) Size() (n uint64)

func (*Stream) Truncate

func (ds *Stream) Truncate(newsize int64) (er error)

>=0正向保留; <0 count from end;必须与ds.blocksize对齐;

func (*Stream) Write

func (ds *Stream) Write(pos uint64, dabs []byte) (er error)

func (*Stream) WriteAll

func (ds *Stream) WriteAll(dabs []byte) (er error)

type StreamBlockInfo

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

type String

type String = *Table

type Strings

type Strings = *Table

type Table

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

拥有属性:二维表,列表,文件,句子,行数据,列数据,代码段,可输入输出代码段, 表数据存储:段落式,流式,标记式,段落由长度数据组成,段落可以是一条行数据或则列数据。 能表示的表是离散的,有的表头有行数据,有的只有表头与值; 表数据修改,表的首地址是必须不变的;

func (*Table) AddCollum

func (tb *Table) AddCollum(key string, val any) Error

func (*Table) AddRow

func (tb *Table) AddRow(row map[string]string) Error

func (*Table) Append

func (tb *Table) Append(buf []byte) (n int, er error)

func (*Table) AttrGet

func (tb *Table) AttrGet(key string) (val Any)

func (*Table) AttrSet

func (tb *Table) AttrSet(key string, val Any) Error

func (*Table) AttriDelete

func (tb *Table) AttriDelete(row map[string]string) Error

func (*Table) CanExecute

func (tb *Table) CanExecute() (can bool)

func (*Table) Clear

func (tb *Table) Clear() (er Error)

func (*Table) Close

func (tb *Table) Close() Error

func (*Table) CurrentSentence

func (tb *Table) CurrentSentence() (se Sentence)

func (*Table) DeleteCollum

func (tb *Table) DeleteCollum(col string) Error

func (*Table) DeleteRow

func (tb *Table) DeleteRow(rules map[string]string, rlcnt int) Error

func (*Table) Execute

func (tb *Table) Execute(codetext string, pipe Pipe) (env Enviroment, er Error)

func (*Table) ExecuteSentence

func (tb *Table) ExecuteSentence(se Sentence, code Code) (err Error)

func (*Table) FromText

func (tb *Table) FromText(text string) (er Error)

func (*Table) GetChildren

func (tb *Table) GetChildren() (children []*Table)

func (*Table) GetId

func (tb *Table) GetId() (id uint64)

func (*Table) GetParents

func (tb *Table) GetParents() (parents []*Table)

func (*Table) GetTable

func (tb *Table) GetTable(key string) (ktb *Table)

func (*Table) ModifyCollum

func (tb *Table) ModifyCollum(rules map[string]string, colname string, dta []byte) Error

func (*Table) ModifyRow

func (tb *Table) ModifyRow(rules map[string]string, row map[string]string) Error

func (*Table) Name

func (tb *Table) Name() string

func (*Table) NodeName

func (tb *Table) NodeName() (name string)

func (*Table) NodePath

func (tb *Table) NodePath() (path string)

func (*Table) Read

func (tb *Table) Read(buf []byte) (n int, er error)

func (*Table) ReadAll

func (tb *Table) ReadAll() (li []byte, er error)

func (*Table) ReadBytes

func (tb *Table) ReadBytes(limit byte) (li []byte, er error)

func (*Table) ReadSentence

func (tb *Table) ReadSentence() (ktb *Table)

func (*Table) RemoveTable

func (tb *Table) RemoveTable(key string) (er Error)

func (*Table) Run

func (tb *Table) Run() (er Error)

func (*Table) Seek

func (tb *Table) Seek(po int64, seekfrom int) (newpos int64, er error)

func (*Table) SeletCollum

func (tb *Table) SeletCollum(rules map[string]string) (rs []*Collum)

func (*Table) SeletRow

func (tb *Table) SeletRow(rules map[string]string, sorthead string) (rs []*Row)

func (*Table) SetCode

func (tb *Table) SetCode(code string) (er Error)

func (*Table) SetPipe

func (tb *Table) SetPipe(condses, doses *Table) Error

func (*Table) SetTable

func (tb *Table) SetTable(key string, ktb *Table) Error

func (*Table) SimulateExecute

func (tb *Table) SimulateExecute() (err Error)

func (*Table) Start

func (tb *Table) Start() (err Error)

func (*Table) Sync

func (tb *Table) Sync() error

func (*Table) ToBytes

func (tb *Table) ToBytes() (i []byte)

func (*Table) ToCode

func (tb *Table) ToCode() (i Code)

func (*Table) ToCollum

func (tb *Table) ToCollum() (i Collum)

func (*Table) ToComplex128

func (tb *Table) ToComplex128() (i complex128)

func (*Table) ToComplex64

func (tb *Table) ToComplex64() (i complex64)

func (*Table) ToFile

func (tb *Table) ToFile() (i File)

func (*Table) ToFloat32

func (tb *Table) ToFloat32() (i float32)

func (*Table) ToFloat64

func (tb *Table) ToFloat64() (i float64)

func (*Table) ToFunction

func (tb *Table) ToFunction() (i Function)

func (*Table) ToInt

func (tb *Table) ToInt() (i int)

func (*Table) ToInt16

func (tb *Table) ToInt16() (i int16)

func (*Table) ToInt32

func (tb *Table) ToInt32() (i int32)

func (*Table) ToInt64

func (tb *Table) ToInt64() (i int64)

func (*Table) ToInt8

func (tb *Table) ToInt8() (i int8)

func (*Table) ToList

func (tb *Table) ToList() (i List)

func (*Table) ToMatrix

func (tb *Table) ToMatrix() (i Matrix)

func (*Table) ToObject

func (tb *Table) ToObject() (i Object)

func (*Table) ToRow

func (tb *Table) ToRow() (i Row)

func (*Table) ToSentene

func (tb *Table) ToSentene() (i Sentence)

func (*Table) ToString

func (tb *Table) ToString() (i string)

func (*Table) ToTextTable

func (tb *Table) ToTextTable() (text string)

func (*Table) ToUint

func (tb *Table) ToUint() (i uint)

func (*Table) ToUint16

func (tb *Table) ToUint16() (i uint16)

func (*Table) ToUint32

func (tb *Table) ToUint32() (i uint32)

func (*Table) ToUint64

func (tb *Table) ToUint64() (i uint64)

func (*Table) ToUint8

func (tb *Table) ToUint8() (i uint8)

func (*Table) ToVector

func (tb *Table) ToVector() (i Vector)

func (*Table) Truncate

func (tb *Table) Truncate(i int64) (er error)

func (*Table) WorldName

func (tb *Table) WorldName() (name string)

func (*Table) Write

func (tb *Table) Write(buf []byte) (n int, er error)

func (*Table) WriteSentence

func (tb *Table) WriteSentence(ktb *Table) Error

type Temperature

type Temperature = *Table

type Time

type Time = *Table

type Tree

type Tree = *Table

type TreeMap

type TreeMap = *Table

type Uint

type Uint = *Table

type Uint16

type Uint16 = *Table

type Uint16s

type Uint16s = *Table

type Uint32

type Uint32 = *Table

type Uint32s

type Uint32s = *Table

type Uint64

type Uint64 = *Table

type Uint64s

type Uint64s = *Table

type Uint8

type Uint8 = *Table

type Uint8s

type Uint8s = *Table

type Uints

type Uints = *Table

type VVector

type VVector = *Table

type Vector

type Vector = *Table

func NewList

func NewList() Vector

func NewVector

func NewVector() Vector

type Video

type Video = *Table

type Voltage

type Voltage = *Table

type Watt

type Watt = *Table

type Weight

type Weight = *Table

type Width

type Width = *Table

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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