Skip to content

yt76/rx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About Rx:

 project homepage http://sites.google.com/site/neonlightcompiler/rx

Rx implements static key value storage with efficient storage usage.
This library is heavily inspired by another implementation
of similar functionality and data structure Tx.
(You might want to use Tx instead of this
 http://www-tsujii.is.s.u-tokyo.ac.jp/~hillbig/tx-j.htm)

--
Package structure:
 rx package contains following files.
  rx.c: Implementation
  rx.h: API definition
  rx_example.c: Examples of usage
  rx_test.c: Small tests
  README: This file
 Users may embed rx.c and rx.h into their application to use this.

--
API overview:
 Rx contains two data storages rx and rbx.
 * rx maps N distinct and sorted strings into numbers from 0 to N-1.
 * rbx maps number from to 0 to N-1 into N arbitrary size binary objects.
 With rx, user can perform prefix lookup and reverse lookup. By prefix
 lookup, when the search key is "abc", rx also returns values for "a"
 and "ab" if they exist.

 Both storage has API for itself and its builder, so there ara APIs for 4
 objects, rx, rx_builder, rbx and rbx_builder.

 rx_builder and rbx_builder generates binary images from given set of
 input. Users may store the image into file and open it later as rx or
 rbx object.

 Typical flow will be as follows.

  /* build time */
  rx_builder *builder = rx_builder_create();
  for each key
    rx_builder_add(builder, key);
  rx_builder_build(builder);
  unsigned char *image = rx_builder_get_image(builder);
  int size = rx_builder_get_size(builder);
  store image with size to a file.

  /* use time */
  rx *rx = rx_open(image);
  rx_search(rx, 0, "abc", ...); /* do actual work */
  rx_close(rx);

--
History:
0.1: preliminary
0.2: tweaked trie memory allocation
0.3: released for private purpose
0.4: optimized rx_builder code more
0.5: implement rx_builder_get_index_key() and custom allocator
0.6: API change to pass cookies
0.7: add const to API functions
0.8: add more const, fix rx_reverse bug
0.9: changed license to apache2
   : smaller bit width (<8) support
   : utility rbx (blob array) added
1.0rc1: fix type casts. fix reverse lookup bug. fast building without trie.
1.0rc2: fixed a bug in rx_builder_get_key_index(). fixed wrong id for predictive lookup.
1.0rc3: reorganized test and examples.
1.0rc4: fixed signedness issue.
1.0: fix a compiler warning.
1.1: add 1 level lookup mode
1.1.1: add depth limit
1.1.2: add rx_search_expand() feature from manabe hiroshi-san.
1.1.3: Change the license from Apache to 2-caluses BSD.

[email protected]


This licensing is tentative, please ask me when it is inconvenient for you.

Update: 2015 Sep 20. Changed from Apache license upon a request.
--
Copyright (c) 2015, Yusuke Tabata
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met: 

1. Redistributions of source code must retain the above copyright notice,
   this list of conditions and the following disclaimer. 
2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution. 

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

About

rx trie

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published