Documentation ¶
Index ¶
- Constants
- Variables
- func CreateDatabase(params map[string]string)
- func LinkAndStore(uuid []byte, bs *BlockStore, bp bprovider.StorageProvider, ...) map[uint64]uint64
- func UUIDToMapKey(id uuid.UUID) [16]byte
- type BlockStore
- func (bs *BlockStore) DEBUG_DELETE_UUID(id uuid.UUID)
- func (bs *BlockStore) FreeCoreblock(cb **Coreblock)
- func (bs *BlockStore) FreeVectorblock(vb **Vectorblock)
- func (bs *BlockStore) LoadSuperblock(id uuid.UUID, generation uint64) *Superblock
- func (bs *BlockStore) ObtainGeneration(id uuid.UUID) *Generation
- func (bs *BlockStore) ReadDatablock(uuid uuid.UUID, addr uint64, impl_Generation uint64, impl_Pointwidth uint8, ...) Datablock
- func (bs *BlockStore) UnlinkGenerations(id uuid.UUID, sgen uint64, egen uint64) error
- type BlockType
- type CacheItem
- type Coreblock
- type Datablock
- type Generation
- func (gen *Generation) AllocateCoreblock() (*Coreblock, error)
- func (gen *Generation) AllocateVectorblock() (*Vectorblock, error)
- func (gen *Generation) Commit() (map[uint64]uint64, error)
- func (g *Generation) Number() uint64
- func (g *Generation) UpdateRootAddr(addr uint64)
- func (g *Generation) Uuid() *uuid.UUID
- type Superblock
- type Vectorblock
Constants ¶
const ( VSIZE = 1024 KFACTOR = 64 VBSIZE = 2 + 9*VSIZE + 9*VSIZE + 2*VSIZE //Worst case with huffman CBSIZE = 1 + KFACTOR*9*6 DBSIZE = VBSIZE PWFACTOR = uint8(6) //1<<6 == 64 RELOCATION_BASE = 0xFF00000000000000 )
Note to self, if you bump VSIZE such that the max blob goes past 2^16, make sure to adapt providers
const ABSZERO = 1
const FULLZERO = 2
const FlagsMask uint8 = 3
const LatestGeneration = uint64(^(uint64(0)))
const VALUE = 0
These functions allow us to read/write the packed numbers in the datablocks These are huffman encoded in big endian 0xxx xxxx 7 0x00 10xx xxxx +1 14 0x80 1100 xxxx +2 20 0xC0 1101 xxxx +3 28 0xD0 1110 xxxx +4 36 0xE0 1111 00xx +5 42 0xF0 1111 01xx +6 50 0xF4 1111 10xx +7 58 0xF8 1111 1100 +8 64 0xFC 1111 1101 +0 ABSZERO (special symbol) 0xFD 1111 1110 +0 FULLZERO (special symbol) 0xFE
Variables ¶
var ErrDatablockNotFound = errors.New("Coreblock not found")
var ErrGenerationNotFound = errors.New("Generation not found")
Functions ¶
func CreateDatabase ¶
func LinkAndStore ¶
func LinkAndStore(uuid []byte, bs *BlockStore, bp bprovider.StorageProvider, vblocks []*Vectorblock, cblocks []*Coreblock) map[uint64]uint64
func UUIDToMapKey ¶
Types ¶
type BlockStore ¶
type BlockStore struct {
// contains filtered or unexported fields
}
func NewBlockStore ¶
func NewBlockStore(params map[string]string) (*BlockStore, error)
func (*BlockStore) DEBUG_DELETE_UUID ¶
func (bs *BlockStore) DEBUG_DELETE_UUID(id uuid.UUID)
func (*BlockStore) FreeCoreblock ¶
func (bs *BlockStore) FreeCoreblock(cb **Coreblock)
func (*BlockStore) FreeVectorblock ¶
func (bs *BlockStore) FreeVectorblock(vb **Vectorblock)
func (*BlockStore) LoadSuperblock ¶
func (bs *BlockStore) LoadSuperblock(id uuid.UUID, generation uint64) *Superblock
func (*BlockStore) ObtainGeneration ¶
func (bs *BlockStore) ObtainGeneration(id uuid.UUID) *Generation
* This obtains a generation, blocking if necessary
func (*BlockStore) ReadDatablock ¶
func (*BlockStore) UnlinkGenerations ¶
type Coreblock ¶
type Coreblock struct { //Metadata, not copied Identifier uint64 "metadata,implicit" Generation uint64 "metadata,implicit" //Payload, copied PointWidth uint8 "implicit" StartTime int64 "implicit" Addr [KFACTOR]uint64 Count [KFACTOR]uint64 Min [KFACTOR]float64 Mean [KFACTOR]float64 Max [KFACTOR]float64 CGeneration [KFACTOR]uint64 }
func (*Coreblock) Deserialize ¶
func (*Coreblock) GetDatablockType ¶
type Generation ¶
type Generation struct { Cur_SB *Superblock New_SB *Superblock // contains filtered or unexported fields }
A generation stores all the information acquired during a write pass. * A superblock contains all the information required to navigate a tree.
func (*Generation) AllocateCoreblock ¶
func (gen *Generation) AllocateCoreblock() (*Coreblock, error)
*
- The real function is supposed to allocate an address for the data
- block, reserving it on disk, and then give back the data block that
- can be filled in
- This stub makes up an address, and mongo pretends its real
func (*Generation) AllocateVectorblock ¶
func (gen *Generation) AllocateVectorblock() (*Vectorblock, error)
func (*Generation) Commit ¶
func (gen *Generation) Commit() (map[uint64]uint64, error)
The returned address map is primarily for unit testing
func (*Generation) Number ¶
func (g *Generation) Number() uint64
func (*Generation) UpdateRootAddr ¶
func (g *Generation) UpdateRootAddr(addr uint64)
func (*Generation) Uuid ¶
func (g *Generation) Uuid() *uuid.UUID
type Superblock ¶
type Superblock struct {
// contains filtered or unexported fields
}
func NewSuperblock ¶
func NewSuperblock(id uuid.UUID) *Superblock
func (*Superblock) Clone ¶
func (s *Superblock) Clone() *Superblock
func (*Superblock) Gen ¶
func (s *Superblock) Gen() uint64
func (*Superblock) Root ¶
func (s *Superblock) Root() uint64
func (*Superblock) Unlinked ¶
func (s *Superblock) Unlinked() bool
func (*Superblock) Uuid ¶
func (s *Superblock) Uuid() uuid.UUID
type Vectorblock ¶
type Vectorblock struct { //Metadata, not copied on clone Identifier uint64 "metadata,implicit" Generation uint64 "metadata,implicit" //Payload, copied on clone Len uint16 PointWidth uint8 "implicit" StartTime int64 "implicit" Time [VSIZE]int64 Value [VSIZE]float64 }
The leaf datablock type. The tags allow unit tests to work out if clone / serdes are working properly metadata is not copied when a node is cloned implicit is not serialised
func (*Vectorblock) CopyInto ¶
func (src *Vectorblock) CopyInto(dst *Vectorblock)
func (*Vectorblock) Deserialize ¶
func (v *Vectorblock) Deserialize(src []byte)
func (*Vectorblock) GetDatablockType ¶
func (*Vectorblock) GetDatablockType() BlockType
func (*Vectorblock) Serialize ¶
func (v *Vectorblock) Serialize(dst []byte) []byte