You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#---------------------------------------------# db-level struct:struct=db:doc:record# db-level uri :uri=db:doc:rid.datauri=db:doc:iid.datauri=db:doc:uid.data# full uri flow structure which can point data in doc uri=db:doc:rid.pid.sid.recpos.data# o(1) # doc indexesrid= ( pid , sid ) # rid used to pin point any rec in dociid->rid#o(1) # iid is primary index point to rid uid->rid#o(log(n)) # uid is key secondery index point to rid#---------------------------------------------# struct expansiodb=phyfolder#- entire database physical folderdoc=phyfile#- .oxd individual unit of database live in diskrecord=phydata#- a cantionus block of bin data in a docindex=indexdata#- .oxdi index file that stored all indexescache=cashefile#- .oxdc pressisted inmemory data#---------------------------------------------# uri expansion :uri=reslocator#- used as db level index to locate datarid=locationID#- generated on demand from doc rec by scan and cachediid=indexID#- numerical index for records (sorted sequencely generated)uid=hashkeyID#- (uuid,keystr,named) in memory maped to rid after scanpid=pageIndex#- pageindex slotted pagessid=slotIndex#- slotIndex slotarray point to recposrecpos=pagepos#- record pos with in the pagesdata=Data#- simplay a data we are seeking for#---------------------------------------------# data units :# high-level data unit : ( record , rec , row )record=# a single unit of (doc and db) any data# all datas are stored as and within rec# low-level data unit :data=typet : any= [ r , x , n , i , f , s , l , v , m , c ]
#---------------------------------------------# oxdbin :oxdbin=oxdatabinary# an ox standard bin data representation# for efficient storage and scaning of bin data and convertion to usable data# all binary representation of oxdbin contain 2 or 3 components# standard unit Identifier | Size | Data |
(bytes) len= [ I= (2) , S= (4,8) , D= (n=[0-"2^32"-"2^64"]) ]
# record :oxdbin=Identifier|iid|Size|uid|Data|record=r : record|i4b|8|keys_str+"\x00"|Data|# uri :oxdbin=Identifier|size|Data|uri=x : uri|4|str"\x00"|del=n : delbyte|4|"\x00"|# may packed with "\x00" but ignored# nums :oxdbin=Identifier|Data|#no size rep direct dataint=i : integer|max=8bytes|float=f : float|max=8bytes|# strings :oxdbin=Identifier|Size|Data|str=s : string|4|max(n) ="2^32"or"4gb"large=l : large_s|8|max(n) ="2^64"bytes (theoretically)
# collections :oxdbin=Identifier|Size|Data|vec=v : vector|4|tany|map=m : hashmap|4|sstr , tany|# custom :oxdbin=Identifier|size|cty|cData|cstm=c : custom|4|str|tany|#Custom type# uri units :# starts with 4b resents size ends with "\x00"oxdbin=Identifier:size+n*cData+"\x00"sid=xsid:4b+4b+4b+4b+....+n*4b+"\x00"# stream of bytes pid=xpid:4b+4b+4b+4b+....+n*4b+"\x00"# used to store lookupszid=xzid:4b+4b+4b+4b+....+n*4b+"\x00"#- schema id or planiid=xiid:4b+4b+4b+4b+....+n*4b+"\x00"#- unique num id of recrid=xrid:4b+10b+10b+.....+n*10b+"\x00"#- (pid+sid)uid=xuid:str+str+........+n*str+"\x00"#- (uuid or unique keystr named)#---------------------------------------------# db map :# map representation of db # physical data repdb : {
doc : {
pid : 4b=dynamicFalse : {
pagesize : psz (n1b*blocksz2b) =16*4Kb=64kbsid : 4b+..+n*4b+"\x00"True ,
rec : iid4b : size4b : uidnb+"\x00" : =dynamicTrue : {
data : typet : any= [ r , x , n , i , f , s , l , v , m , c ]
}
}
}
}
# example in binbasedb : {
basedoc : {
pagesizei24096xsidl22345"\x00"r10110b"key1""\x00"datar256"key2""\x00"data
}
}
# uri for above sampleuri=db:doc:1:2:recuri=db:doc:pid:sid:iid:uid:data.valuri=db:doc:rid:iid:uid:data.valuri=db:doc:rid:rec#---------------------------------------------# doc storage :blocks=4kb#default dependence on system hardwarepages=n*blocks=64kb# n = 16 default pages->slottedpages [ slot-array-- , --> [records]]
pid->sid->recpos->rec#--------doc----------# end of streamed data will be marked by "\x0"# an doc 0-pos contain (in 0th page) start of docpagesize : (n : 1b*blocksz : 2b) =16*4Kb=64kb#--------pag----------# page in linar read initial look up will be sidxsid:4b+2b+2b+2b+"\x00"records= {
iiiduuidddata
}
#---------------------#---------------------------------------------# index storage :# - proto-1 :# sorted continues sequence of numsiid : 4b->pid : 4b , sid : 4b# o(1) look up with ridpos = iid * 10b# - proto-2 :# Btree indexiid->pid , sid# o(log(n)) look up binary search#---------------------------------------------# Transaction :#each opreation is Transc by defaultbegineditmultipleoperationsendcommit# flushed after commit to disk#---------------------------------------------