Documentation ¶
Index ¶
- Constants
- Variables
- type Btree
- func (t *Btree) Delete(id int64)
- func (t *Btree) DeleteAll(filter, doc interface{})
- func (t *Btree) Find(id int64) (*Node, error)
- func (t *Btree) FindAll(filter interface{}) *Cursor
- func (t *Btree) Get(name string) *Btree
- func (t *Btree) Insert(data []byte) int64
- func (t *Btree) InsertOrUpdate(id int64, data []byte) int64
- func (t *Btree) InsertSubCollection(name string)
- func (t *Btree) Save()
- func (t *Btree) ShowCase()
- func (t *Btree) Update(id int64, data []byte) error
- type Cache
- type CacheCursor
- type Cursor
- type DB
- type Document
- type Meta
- type Node
Constants ¶
View Source
const ( // MinKeys minimum number of keys in a node // this automatically makes the upper bound of 2 * Minkeys MinKeys = pageSize / dataSize // BtreeMaxSize is maximum size of disk space btree could take // before it overflows BtreeMaxSize = 10000000 )
Variables ¶
View Source
var (
// MaxCacheSize is max amount of document that can be in memory
MaxCacheSize = 30
)
Functions ¶
This section is empty.
Types ¶
type Btree ¶
type Btree struct { Name string NumDocuments int64 NumRoots int SubCollections map[string]*Btree Pool []int64 // pool of available ids Pages []int64 // the pages this bree occupies // contains filtered or unexported fields }
A Btree object
func (*Btree) DeleteAll ¶
func (t *Btree) DeleteAll(filter, doc interface{})
DeleteAll deletes all document matching a criterion
func (*Btree) InsertOrUpdate ¶
InsertOrUpdate update an item in the btree with the specified key if found insert it with a new id if found
func (*Btree) InsertSubCollection ¶
InsertSubCollection insert a newSubCollection to this btree
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache to hold document in memory .uses LRU cache policy
type CacheCursor ¶
type CacheCursor struct {
// contains filtered or unexported fields
}
CacheCursor object supplies matching Nodes for a search
type Cursor ¶
type Cursor struct {
// contains filtered or unexported fields
}
Cursor object supplies matching Nodes for a search
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB represents our database file
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
Document type representing a document
type Meta ¶
type Meta struct { MagicString []byte NofCollections int64 // add mutex OverflowSize int64 OverflowDataOffset int64 RootTreeOffset int64 RootTreeSize int64 NumPages int64 // add mutex // contains filtered or unexported fields }
Meta represent the database file metadata
magic string is used to idenitify the database file number of collection in this database offset overflow bytes offset number of overflow doc number of overflow data offset of the root btree
Click to show internal directories.
Click to hide internal directories.