Documentation
¶
Overview ¶
Package btree A BTree implementation optimized for disk storage. Copyright (C) Alex Gaetano Padula
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Package btree File pager implementation Copyright (C) Alex Gaetano Padula
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Index ¶
- Constants
- type BTree
- func (b *BTree) Close() error
- func (b *BTree) Delete(k []byte) error
- func (b *BTree) Get(k []byte) (*Key, error)
- func (b *BTree) GreaterThan(k []byte) ([]*Key, error)
- func (b *BTree) InOrderTraversal() ([]*Key, error)
- func (b *BTree) LessThan(k []byte) ([]*Key, error)
- func (b *BTree) NGet(k []byte) ([]*Key, error)
- func (b *BTree) PrintTree() error
- func (b *BTree) Put(key, value []byte) error
- func (b *BTree) Range(start, end []byte) ([]interface{}, error)
- func (b *BTree) Remove(key, value []byte) error
- type Key
- type Node
- type Pager
Constants ¶
const HEADER_SIZE = 256 // next (overflowed)
const PAGE_SIZE = 1024 // Page size
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BTree ¶
BTree is the main BTree struct ** not thread safe
func (*BTree) GreaterThan ¶ added in v1.1.0
GreaterThan returns all keys greater than k
func (*BTree) InOrderTraversal ¶ added in v1.1.0
InOrderTraversal returns all keys in the BTree in order
func (*BTree) Put ¶
Put inserts a key into the BTree A key can have multiple values Put inserts a key value pair into the BTree
type Node ¶
type Node struct {
Page int64 // The page number of the node
Keys []*Key // The keys in node
Children []int64 // The children of the node
Leaf bool // If the node is a leaf node
}
Node is the node struct for the BTree
type Pager ¶
type Pager struct {
// contains filtered or unexported fields
}
Pager manages pages in a file
func (*Pager) GetPage ¶
GetPage gets a page and returns the data Will gather all the pages that are linked together