bundletree

package module
v0.0.0-...-4291d2a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2019 License: MIT Imports: 7 Imported by: 0

README

#bundletree BTrees modified for fixed capacity and multiple items per score, in Go

Data structure expanding on the functionality of BTree (btree.BTree from github.com/google/btree) in two ways:

  • Fixed capacity, kicking out the oldest entry added, via double-ended queue (lane.Deque from github.com/oleiade/lane)
  • "Bundles", allowing efficient storage of multiple items with identical scores in the BTree.

Documentation

Index

Constants

View Source
const HARDCODED_BTREE_DEGREE = 4

Variables

This section is empty.

Functions

This section is empty.

Types

type BundleTree

type BundleTree struct {
	Deque *lane.Deque //stores Items

	Logger chanlog.Logger

	Display_string string //Used as a prefix when displaying items.
	// contains filtered or unexported fields
}

func NewBundleTree

func NewBundleTree(n_memory int, logger chanlog.Logger, disp string) *BundleTree

Instantiation

func NewUncappedBundleTree

func NewUncappedBundleTree(logger chanlog.Logger, disp string) *BundleTree

func (*BundleTree) Deserialize_btree

func (bt *BundleTree) Deserialize_btree(dec *gob.Decoder) error

func (*BundleTree) Deserialize_deque

func (bt *BundleTree) Deserialize_deque(dec *gob.Decoder) error

func (*BundleTree) Get_score

func (bundletree *BundleTree) Get_score(item Item) (item_score float64)

Grab properties Needs to be edited to have an error return value for when the lookup fails. Maybe just make the map public???

func (*BundleTree) Get_size

func (bundletree *BundleTree) Get_size() int

func (*BundleTree) GobDecode

func (bt *BundleTree) GobDecode(data []byte) error

func (*BundleTree) GobEncode

func (bt *BundleTree) GobEncode() ([]byte, error)

need all objects to satisfy Gob_Encoder and Gob_Decoder.

func (*BundleTree) Has_item

func (bundletree *BundleTree) Has_item(item Item) bool

func (*BundleTree) In_top_items

func (bundletree *BundleTree) In_top_items(item Item, n int) bool

func (*BundleTree) Insert_item

func (bundletree *BundleTree) Insert_item(item Item, item_score float64) (removed_item Item)

Core functionality

func (*BundleTree) Is_capped

func (bundletree *BundleTree) Is_capped() bool

func (*BundleTree) Items

func (bundletree *BundleTree) Items() map[Item]float64

func (*BundleTree) Max_item

func (bundletree *BundleTree) Max_item() Item

func (*BundleTree) Min_item

func (bundletree *BundleTree) Min_item() Item

func (*BundleTree) Read_from_file

func (bt *BundleTree) Read_from_file(filename string) error

func (*BundleTree) Remove_item

func (bundletree *BundleTree) Remove_item(item Item, item_score float64)

func (*BundleTree) Serialize_btree

func (bt *BundleTree) Serialize_btree(enc *gob.Encoder) error

func (*BundleTree) Serialize_deque

func (bt *BundleTree) Serialize_deque(enc *gob.Encoder) error

func (*BundleTree) Show

func (bundletree *BundleTree) Show()

for displaying

func (*BundleTree) Show_deque

func (bundletree *BundleTree) Show_deque()

func (*BundleTree) Write_to_file

func (bt *BundleTree) Write_to_file(filename string) error

bundletrees can be mapped to and from memory.

type Item

type Item interface{}

type ItemBundle

type ItemBundle struct {
	Display_string string
	// contains filtered or unexported fields
}

func NewItemBundle

func NewItemBundle(item_score float64, disp string) *ItemBundle

func (*ItemBundle) GobDecode

func (ib *ItemBundle) GobDecode(data []byte) error

func (*ItemBundle) GobEncode

func (ib *ItemBundle) GobEncode() ([]byte, error)

func (*ItemBundle) Less

func (bundle *ItemBundle) Less(than btree.Item) bool

func (ItemBundle) String

func (bundle ItemBundle) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL