Documentation ¶
Overview ¶
diskpoda project diskpoda.go iwlb@outlook.com 2024/09/19 disk partition as a database.
diskpoda document
Index ¶
- Constants
- func ClosePartition(parth uint64)
- func DiskSizeStep(size uint64) uint64
- func OpenPartition(path string) uint64
- type Any
- type Area
- type BatteryCapacity
- type BinaryNumber
- type Bit
- type Bool
- type Bools
- type Bytes
- type Code
- type Collum
- type Color
- type Coordinate
- type Cubage
- type Current
- type Dampness
- type DataBlockInfo
- type DecimalNumber
- type Density
- type Diskpoda
- func (dp *Diskpoda) AddHash(name string, addr uint64) (er error)
- func (dp *Diskpoda) AddId(id uint32, addr uint64) (er error)
- func (dp *Diskpoda) AllocId() (id uint32)
- func (dp *Diskpoda) Close() error
- func (dp *Diskpoda) CondGet(condses, getses *Table) (tb []*Table)
- func (dp *Diskpoda) CondSet(condses, setses *Table) Error
- func (dp *Diskpoda) DelHash(name string, addr uint64) (er error)
- func (dp *Diskpoda) DelId(id uint32, addr uint64) (er error)
- func (dp *Diskpoda) DeleteData(name string, id, addr uint64) (er error)
- func (dp *Diskpoda) DiskAllocSpace(size uint64) (id uint64)
- func (dp *Diskpoda) DiskStepSize(size uint64) uint64
- func (dp *Diskpoda) GetData(name string, id uint32, addr uint64, outbuf []byte) (data []byte)
- func (dp *Diskpoda) GetSpace(lendata uint64) (addr uint64)
- func (dp *Diskpoda) GetTable(name string, id uint32, addr uint64) (tb *Table)
- func (dp *Diskpoda) OpenStream(name string, id uint32, addr, blocksize uint64, bcompress byte) (ds *Stream)
- func (dp *Diskpoda) OpenTable(name string, id uint64, addr uint64) (tb *Table)
- func (dp *Diskpoda) PutData(name string, id uint32, addr uint64, data []byte, bcompress byte) (retaddr uint64, er error)
- func (dp *Diskpoda) PutSpace(lendata uint64, addr uint64) error
- func (dp *Diskpoda) PutTable(name string, id uint32, addr uint64, tb *Table) (retaddr uint64, er Error)
- func (dp *Diskpoda) ReadSector(secpos uint64, bs []byte) uint64
- func (dp *Diskpoda) ReadSectorTail(addr uint64, outsectabuf []byte) (outsecta []byte)
- func (dp *Diskpoda) ReleaseAddr(addr uint64) (err error)
- func (dp *Diskpoda) Sync() error
- func (dp *Diskpoda) WriteSector(secpos uint64, bs []byte) uint64
- type DiskpodaOption
- type Dollar
- type ElectricEnerger
- type ElectricQuantity
- type Energy
- type Enviroment
- type Equation
- type Error
- type File
- type Float32
- type Float32s
- type Float64
- type Float64s
- type Force
- type Function
- type Graph
- type HVector
- type Height
- type IdSet
- type Image
- type Int
- type Int16
- type Int16s
- type Int32
- type Int32s
- type Int64
- type Int64s
- type Int8
- type Int8s
- type Integer
- type Intensity
- type Ints
- type KeyValue
- type Length
- type List
- type Matrix
- type Number
- type Object
- type Percentage
- type Pipe
- type Placename
- type Quantity
- type Range
- type RangeSet
- type Rmb
- type Row
- type Sentence
- type Setoret
- type Setorld
- type Sound
- type SpaceBlockInfo
- type SpaceModel
- type Speed
- type StateOfMatter
- type Stream
- func (ds *Stream) Addr() (addr uint64)
- func (ds *Stream) BlockMaxDataSize() (siz uint64)
- func (ds *Stream) Close() (er error)
- func (ds *Stream) Read(pos uint64, outbsbuf []byte) (obs []byte)
- func (ds *Stream) ReadAll(outbsbuf []byte) (outbs []byte)
- func (ds *Stream) Size() (n uint64)
- func (ds *Stream) Truncate(newsize int64) (er error)
- func (ds *Stream) Write(pos uint64, dabs []byte) (er error)
- func (ds *Stream) WriteAll(dabs []byte) (er error)
- type StreamBlockInfo
- type String
- type Strings
- type Table
- func (tb *Table) AddCollum(key string, val any) Error
- func (tb *Table) AddRow(row map[string]string) Error
- func (tb *Table) Append(buf []byte) (n int, er error)
- func (tb *Table) AttrGet(key string) (val Any)
- func (tb *Table) AttrSet(key string, val Any) Error
- func (tb *Table) AttriDelete(row map[string]string) Error
- func (tb *Table) CanExecute() (can bool)
- func (tb *Table) Clear() (er Error)
- func (tb *Table) Close() Error
- func (tb *Table) CurrentSentence() (se Sentence)
- func (tb *Table) DeleteCollum(col string) Error
- func (tb *Table) DeleteRow(rules map[string]string, rlcnt int) Error
- func (tb *Table) Execute(codetext string, pipe Pipe) (env Enviroment, er Error)
- func (tb *Table) ExecuteSentence(se Sentence, code Code) (err Error)
- func (tb *Table) FromText(text string) (er Error)
- func (tb *Table) GetChildren() (children []*Table)
- func (tb *Table) GetId() (id uint64)
- func (tb *Table) GetParents() (parents []*Table)
- func (tb *Table) GetTable(key string) (ktb *Table)
- func (tb *Table) ModifyCollum(rules map[string]string, colname string, dta []byte) Error
- func (tb *Table) ModifyRow(rules map[string]string, row map[string]string) Error
- func (tb *Table) Name() string
- func (tb *Table) NodeName() (name string)
- func (tb *Table) NodePath() (path string)
- func (tb *Table) Read(buf []byte) (n int, er error)
- func (tb *Table) ReadAll() (li []byte, er error)
- func (tb *Table) ReadBytes(limit byte) (li []byte, er error)
- func (tb *Table) ReadSentence() (ktb *Table)
- func (tb *Table) RemoveTable(key string) (er Error)
- func (tb *Table) Run() (er Error)
- func (tb *Table) Seek(po int64, seekfrom int) (newpos int64, er error)
- func (tb *Table) SeletCollum(rules map[string]string) (rs []*Collum)
- func (tb *Table) SeletRow(rules map[string]string, sorthead string) (rs []*Row)
- func (tb *Table) SetCode(code string) (er Error)
- func (tb *Table) SetPipe(condses, doses *Table) Error
- func (tb *Table) SetTable(key string, ktb *Table) Error
- func (tb *Table) SimulateExecute() (err Error)
- func (tb *Table) Start() (err Error)
- func (tb *Table) Sync() error
- func (tb *Table) ToBytes() (i []byte)
- func (tb *Table) ToCode() (i Code)
- func (tb *Table) ToCollum() (i Collum)
- func (tb *Table) ToComplex128() (i complex128)
- func (tb *Table) ToComplex64() (i complex64)
- func (tb *Table) ToFile() (i File)
- func (tb *Table) ToFloat32() (i float32)
- func (tb *Table) ToFloat64() (i float64)
- func (tb *Table) ToFunction() (i Function)
- func (tb *Table) ToInt() (i int)
- func (tb *Table) ToInt16() (i int16)
- func (tb *Table) ToInt32() (i int32)
- func (tb *Table) ToInt64() (i int64)
- func (tb *Table) ToInt8() (i int8)
- func (tb *Table) ToList() (i List)
- func (tb *Table) ToMatrix() (i Matrix)
- func (tb *Table) ToObject() (i Object)
- func (tb *Table) ToRow() (i Row)
- func (tb *Table) ToSentene() (i Sentence)
- func (tb *Table) ToString() (i string)
- func (tb *Table) ToTextTable() (text string)
- func (tb *Table) ToUint() (i uint)
- func (tb *Table) ToUint16() (i uint16)
- func (tb *Table) ToUint32() (i uint32)
- func (tb *Table) ToUint64() (i uint64)
- func (tb *Table) ToUint8() (i uint8)
- func (tb *Table) ToVector() (i Vector)
- func (tb *Table) Truncate(i int64) (er error)
- func (tb *Table) WorldName() (name string)
- func (tb *Table) Write(buf []byte) (n int, er error)
- func (tb *Table) WriteSentence(ktb *Table) Error
- type Temperature
- type Time
- type Tree
- type TreeMap
- type Uint
- type Uint16
- type Uint16s
- type Uint32
- type Uint32s
- type Uint64
- type Uint64s
- type Uint8
- type Uint8s
- type Uints
- type VVector
- type Vector
- type Video
- type Voltage
- type Watt
- type Weight
- type Width
Constants ¶
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 OpenPartition ¶
Types ¶
type BatteryCapacity ¶
type BatteryCapacity = *Table
type BinaryNumber ¶
type BinaryNumber = *Table
type Coordinate ¶
type Coordinate = *Table
type DataBlockInfo ¶
type DataBlockInfo struct {
// contains filtered or unexported fields
}
type DecimalNumber ¶
type DecimalNumber = *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) DeleteData ¶
func (*Diskpoda) DiskAllocSpace ¶
func (*Diskpoda) DiskStepSize ¶
func (*Diskpoda) OpenStream ¶
func (*Diskpoda) PutData ¶
func (dp *Diskpoda) PutData(name string, id uint32, addr uint64, data []byte, bcompress byte) (retaddr uint64, er error)
防止掉电出错: 要做的事情日志记录下来 记录开始操作 再操作 记录停止操作
func (*Diskpoda) ReadSectorTail ¶
outsectabuf is nil use bytespool.Put(outbs) to release memory;
func (*Diskpoda) ReleaseAddr ¶
bsbuf length < out size should release memory by bytespool.Put(outbs);
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 ElectricEnerger ¶
type ElectricEnerger = *Table
type ElectricQuantity ¶
type ElectricQuantity = *Table
type Percentage ¶
type Percentage = *Table
type SpaceBlockInfo ¶
type SpaceBlockInfo struct {
// contains filtered or unexported fields
}
type SpaceModel ¶
type SpaceModel = *Table
type StateOfMatter ¶
type StateOfMatter = *Table
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
func (*Stream) BlockMaxDataSize ¶
type StreamBlockInfo ¶
type StreamBlockInfo struct {
// contains filtered or unexported fields
}
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
拥有属性:二维表,列表,文件,句子,行数据,列数据,代码段,可输入输出代码段, 表数据存储:段落式,流式,标记式,段落由长度数据组成,段落可以是一条行数据或则列数据。 能表示的表是离散的,有的表头有行数据,有的只有表头与值; 表数据修改,表的首地址是必须不变的;
func (*Table) CanExecute ¶
func (*Table) CurrentSentence ¶
func (*Table) DeleteCollum ¶
func (*Table) Execute ¶
func (tb *Table) Execute(codetext string, pipe Pipe) (env Enviroment, er Error)
func (*Table) ExecuteSentence ¶
func (*Table) GetChildren ¶
func (*Table) GetParents ¶
func (*Table) ModifyCollum ¶
func (*Table) ReadSentence ¶
func (*Table) RemoveTable ¶
func (*Table) SimulateExecute ¶
func (*Table) ToComplex128 ¶
func (tb *Table) ToComplex128() (i complex128)
func (*Table) ToComplex64 ¶
func (*Table) ToFunction ¶
func (*Table) ToTextTable ¶
func (*Table) WriteSentence ¶
type Temperature ¶
type Temperature = *Table