Skip to content

Commit

Permalink
Initial version of the trie module
Browse files Browse the repository at this point in the history
  • Loading branch information
vladpaiu committed Dec 3, 2024
1 parent a27db64 commit 5d3dc3a
Show file tree
Hide file tree
Showing 26 changed files with 3,349 additions and 3 deletions.
14 changes: 14 additions & 0 deletions db/schema/opensips-trie.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE database PUBLIC "-//opensips.org//DTD DBSchema V1.1//EN"
"https://opensips.org/pub/opensips/dbschema/dtd/1.1/dbschema.dtd" [

<!ENTITY % entities SYSTEM "entities.xml">
%entities;

]>

<database xmlns:xi="http://www.w3.org/2001/XInclude">
<name>Trie</name>
<xi:include href="trie_table.xml"/>
<xi:include href="trie_partitions.xml"/>
</database>
56 changes: 56 additions & 0 deletions db/schema/trie_partitions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE table PUBLIC "-//opensips.org//DTD DBSchema V1.1//EN"
"https://opensips.org/pub/opensips/dbschema/dtd/1.1/dbschema.dtd" [

<!ENTITY % entities SYSTEM "entities.xml">
%entities;

]>

<table id="dr_partitions" xmlns:db="http://docbook.org/ns/docbook">
<name>dr_partitions</name>
<version>1</version>
<type db="mysql">&MYSQL_TABLE_TYPE;</type>
<description>
<db:para>This table is used by the Trie module to store
information about the partitions used in the script (url to database and table name).
More information can be found at: &OPENSIPS_MOD_DOC;trie.html.
</db:para>
</description>

<column id="id">
<name>id</name>
<type>unsigned int</type>
<size>&table_id_len;</size>
<autoincrement/>
<natural/>
<primary/>
<type db="dbtext">int,auto</type>
<description>Partition unique ID
</description>
</column>

<column id="partition_name">
<name>partition_name</name>
<type>string</type>
<size>255</size>
<description>The name of the partition.
</description>
</column>

<column id="db_url">
<name>db_url</name>
<type>string</type>
<size>255</size>
<description>The url to the database containing the tables: dr_rules, dr_groups,
dr_carriers and dr_gateways</description>
</column>

<column id="trie_table">
<name>trie_table</name>
<type>string</type>
<size>255</size>
<null/>
<description>The name of the trie_rules table in the given database (for the given partition).</description>
</column>
</table>
57 changes: 57 additions & 0 deletions db/schema/trie_table.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE table PUBLIC "-//opensips.org//DTD DBSchema V1.1//EN"
"https://opensips.org/pub/opensips/dbschema/dtd/1.1/dbschema.dtd" [

<!ENTITY % entities SYSTEM "entities.xml">
%entities;

]>

<table id="trie_table" xmlns:db="http://docbook.org/ns/docbook">
<name>trie_table</name>
<version>1</version>
<type db="mysql">&MYSQL_TABLE_TYPE;</type>
<description>
<db:para>This table is used by the Trie module in order to build the trie that it caches
More information can be found at: &OPENSIPS_MOD_DOC;trie.html.
</db:para>
</description>

<column id="ruleid">
<name>ruleid</name>
<type>unsigned int</type>
<size>&table_id_len;</size>
<autoincrement/>
<natural/>
<primary/>
<type db="dbtext">int,auto</type>
<description>Rule unique ID
</description>
</column>

<column id="prefix">
<name>prefix</name>
<type>string</type>
<size>64</size>
<description>prefix to be cached</description>
</column>

<column id="attrs">
<name>attrs</name>
<type>string</type>
<size>255</size>
<null/>
<default><null/></default>
<description>Generic string describing RULE attributes - this string is
to be interpreted from the script</description>
</column>

<column id="enabled">
<name>priority</name>
<type>int</type>
<size>11</size>
<default>1</default>
<description>1 if the rule is enabled, 0 if the rule is disabled.</description>
</column>

</table>
10 changes: 10 additions & 0 deletions modules/trie/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# $Id$
#
# WARNING: do not run this directly, it should be run by the master Makefile

include ../../Makefile.defs
auto_gen=
NAME=trie.so
LIBS=

include ../../Makefile.modules
Loading

0 comments on commit 5d3dc3a

Please sign in to comment.