Copyright © 2017 - 2026 SigScale Global Inc.
Authors: Vance Shipley (vances@sigscale.com).
To do
Global Title Table.
This module implements generic prefix matching tables for digit
strings using an //mnesia backing store. Prefix matching
may be done effeciently because each unique prefix is stored
in the table. A lookup for "1519" may be done in up to four
steps. First find "1" as a key, if the key is not found the
prefix does not exist in the table. If the value for the key
is undefined lookup "15" and if that key's value is undefined
lookup "151" This continues until either the key is not found
or the value is not undefined.
1> ocs_gtt:insert(global_title, "1519240", "Bell Mobility").
{gtt, [1], undefined}
{gtt, [1,5], undefined}
{gtt, [1,5,1], undefined}
{gtt, [1,5,1,9], undefined}
{gtt, [1,5,1,9,2], undefined}
{gtt, [1,5,1,9,2,4], undefined}
{gtt, [1,5,1,9,2,4,0], "Bell Mobility"}
Note: gtt() = #gtt{num = string() | '_' | '$1', value = tuple() | undefined | '_' | '$2'}
| new/2 | Create a new table. |
| new/3 | Create a new table and populate it from the supplied list of items. |
| insert/3 | Insert a table entry. |
| insert/2 | Insert a list of table entries. |
| delete/2 | Delete a table entry. |
| lookup_first/2 | Lookup the value of the first matching table entry. |
| lookup_last/2 | Lookup the value of the longest matching table entry. |
| lookup_all/2 | Lookup the values of matching table entries. |
| list/0 | List all tables. |
| list/2 | List all gtt entries. |
| query/3 | Paginated filtered query of table. |
| clear_table/1 | Clear a table. |
new(Table, Options) -> ok
Create a new table.
The Options define table definitions used in //mnesia.
See also: //mnesia/mnesia:create_table/2.
new(Table, Options, Items) -> ok
Create a new table and populate it from the supplied list of items. This is the quickest way to build a new table as it performs all the insertions within one optimized transaction context.
TheOptions define table definitions used in //mnesia.
See also: //mnesia/mnesia:create_table/2.
insert(Table, Number, Value) -> Result
Insert a table entry.
insert(Table, Items) -> ok
Insert a list of table entries. The entries are inserted as a transaction, either all entries are added to the table or, if an entry insertion fails, none at all.
delete(Table, Number) -> ok
Delete a table entry.
lookup_first(Table, Number) -> Result
Lookup the value of the first matching table entry.
lookup_last(Table, Number) -> Result
Lookup the value of the longest matching table entry.
lookup_all(Table, Number) -> Result
Lookup the values of matching table entries.
list() -> Tables
List all tables.
list(Cont, Table) -> Result
List all gtt entries.
query(Cont, Table, MatchPrefix) -> Result
Paginated filtered query of table.
clear_table(Table) -> ok
Clear a table.
Generated by EDoc