The Tiny HTM Library
Data Structures | Functions
HTM tree indexes

Data Structures

struct  htm_tree_entry
 An entry (a row ID and a position) in an HTM tree. More...
struct  htm_tree
 An HTM tree containing a list of points sorted on HTM ID (tree entries), and optionally an index over the points that allows for fast spatial searches/counts. More...

Functions

struct htm_tree_entry __attribute__ ((aligned(16)))
enum htm_errcode htm_tree_init (struct htm_tree *tree, const char *const treefile, const char *const datafile)
 Initializes an HTM tree from the given tree and data files, returning HTM_OK on success.
void htm_tree_destroy (struct htm_tree *tree)
 Releases the resources for the given HTM tree.
enum htm_errcode htm_tree_lock (struct htm_tree *tree, size_t datathresh)
 Locks the HTM tree index in memory.

Function Documentation

enum htm_errcode htm_tree_init ( struct htm_tree tree,
const char *const  treefile,
const char *const  datafile 
)

Initializes an HTM tree from the given tree and data files, returning HTM_OK on success.

The treefile argument may be NULL, in which case queries result in scans of the points in datafile.

Definition at line 27 of file tree.c.

References htm_tree::count, count, htm_tree::datafd, htm_tree::datasz, htm_tree::entries, HTM_EINV, HTM_EIO, HTM_EMMAN, HTM_ENULLPTR, HTM_ETREE, HTM_OK, htm_tree_destroy(), htm_varint_decode(), htm_varint_nfollow(), htm_tree::index, htm_tree::indexfd, htm_tree::indexsz, htm_tree::leafthresh, and htm_tree::root.

enum htm_errcode htm_tree_lock ( struct htm_tree tree,
size_t  datathresh 
)

Locks the HTM tree index in memory.

If the associated data file is of size datathresh or less, it is locked in memory as well.

Definition at line 183 of file tree.c.

References htm_tree::datasz, htm_tree::entries, HTM_ENOMEM, HTM_ENULLPTR, HTM_OK, htm_tree::index, htm_tree::indexfd, and htm_tree::indexsz.