Code clean up and function rename

This commit is contained in:
Coder12a
2019-01-14 18:17:45 -06:00
parent 69f789e5fd
commit b700bd5c77
2 changed files with 153 additions and 205 deletions

View File

@ -2,7 +2,7 @@ ColdDB
===========
ColdDB is a minetest mod that implements a serverless, asynchronous, NoSQL database engine.<br>
It provides a key or key-value storage system using plain Lua tables, also it can iterate through the keys.<br>
It provides a key or key-value based storage system using plain Lua tables.<br>
Usage
===========
@ -44,27 +44,23 @@ coldbase.remove("MyKeyAndValue")
```lua
coldbase.add_to_mem_pool = true
```
7. if indexes is true(false by default). When a key file is created an indexing file stores the key for look-ups. this makes it possible to iterate through keys.
7. returns the amount of entries from the entry file.
```lua
coldbase.indexes = true
coldbase.get_entry_file_count(name, tag_name)
```
8. only if coldbase.indexes is true. returns the amount of keys that are in the indexing file.
8. iterates through the entry file(breaks and ends if it reaches the end of the file).
```lua
coldbase.get_count()
coldbase.iterate_entry_file(name, begin_func, func_on_iterate, end_func, args, tag_name)
```
9. only if coldbase.indexes is true. iterates through the indexing file(breaks and ends if it reaches the end of the file).
```lua
coldbase.iterate_index_table(nil, func_list_keys, nil)
```
10. adds a folder which can be used in other functions that have tag_name arg.
9. adds a folder which can be used in other functions that have tag_name arg.
```lua
coldbase.add_tag("Extra_Folder", {"Extra", "Folder"})
```
11. returns the tag name if the tag does not exists it creates one.
10. returns the tag name if the tag does not exists it creates one.
```lua
coldbase.get_or_add_tag("Extra_Folder", {"Extra", "Folder"})
coldbase.get_or_add_tag("Extra_Folder", {"Extra", "Folder"}, no_new_path)
```
12. remove tag by name.
11. remove tag by name.
```lua
coldbase.remove_tag("Extra_Folder")
```