MentDB Weak  Smart Earth Tool
Weak AI, Interoperability and Software Development
    Home  >  MQL Functions
File System

Each of your JSON nodes are saved in blocks to form a record.
All blocks and records are searchable through position calculations in index and data files.
You can see the sizes of the data and index files at any time.

fs index size <page> <nbByPage>

Description

    To show the size of all indexed files (by page)

Parameters

    page:   The page - integer >= 1 - required
    nbByPage:   The number by page - integer>0 - required
admin
fs index size 1 10;
mentdb
[<br> {<br> "percent_used": 6,<br> "current_max_block_size": 16,<br> "size": 200,<br> "current_block_size": 1,<br> "percent_graph": "|-----------------------------",<br> "indexFileId": 0<br> },<br> {<br> "percent_used": 12,<br> "current_max_block_size": 16,<br> "size": 200,<br> "current_block_size": 2,<br> "percent_graph": "|||---------------------------",<br> "indexFileId": 1<br> },<br> {<br> "percent_used": 31,<br> "current_max_block_size": 16,<br> "size": 200,<br> "current_block_size": 5,<br> "percent_graph": "|||||||||---------------------",<br> "indexFileId": 2<br> },<br> {<br> "percent_used": 25,<br> "current_max_block_size": 16,<br> "size": 200,<br> "current_block_size": 4,<br> "percent_graph": "|||||||-----------------------",<br> "indexFileId": 3<br> },<br> {<br> "percent_used": 37,<br> "current_max_block_size": 16,<br> "size": 200,<br> "current_block_size": 6,<br> "percent_graph": "|||||||||||-------------------",<br> "indexFileId": 4<br> },<br> {<br> "percent_used": 0,<br> "current_max_block_size": 16,<br> "size": 200,<br> "current_block_size": 0,<br> "percent_graph": "------------------------------",<br> "indexFileId": 5<br> },<br> {<br> "percent_used": 0,<br> "current_max_block_size": 16,<br> "size": 200,<br> "current_block_size": 0,<br> "percent_graph": "------------------------------",<br> "indexFileId": 6<br> },<br> {<br> "percent_used": 6,<br> "current_max_block_size": 16,<br> "size": 200,<br> "current_block_size": 1,<br> "percent_graph": "|-----------------------------",<br> "indexFileId": 7<br> },<br> {<br> "percent_used": 12,<br> "current_max_block_size": 16,<br> "size": 200,<br> "current_block_size": 2,<br> "percent_graph": "|||---------------------------",<br> "indexFileId": 8<br> },<br> {<br> "percent_used": 25,<br> "current_max_block_size": 16,<br> "size": 200,<br> "current_block_size": 4,<br> "percent_graph": "|||||||-----------------------",<br> "indexFileId": 9<br> }<br>]
admin
metric index files 1 10;
mentdb
Total block: 1000x16=16000<br>Total size: 1000x200=200000b<br>|----------------------------- 6% - 0 - used: 1, free: 15, total block: 16, size: 200b<br>|||--------------------------- 12% - 1 - used: 2, free: 14, total block: 16, size: 200b<br>|||||||||--------------------- 31% - 2 - used: 5, free: 11, total block: 16, size: 200b<br>|||||||----------------------- 25% - 3 - used: 4, free: 12, total block: 16, size: 200b<br>|||||||||||------------------- 37% - 4 - used: 6, free: 10, total block: 16, size: 200b<br>------------------------------ 0% - 5 - used: 0, free: 16, total block: 16, size: 200b<br>------------------------------ 0% - 6 - used: 0, free: 16, total block: 16, size: 200b<br>|----------------------------- 6% - 7 - used: 1, free: 15, total block: 16, size: 200b<br>|||--------------------------- 12% - 8 - used: 2, free: 14, total block: 16, size: 200b<br>|||||||----------------------- 25% - 9 - used: 4, free: 12, total block: 16, size: 200b<br>

fs data size <page> <nbByPage>

Description

    To show the size of all data files in a page

Parameters

    page:   The page - integer >= 1 - required
    nbByPage:   The number by page - integer>0 - required
admin
fs data size 1 2;
mentdb
[<br> {<br> "dataFileId": 0,<br> "percent_used": 0,<br> "current_max_block_size": 10000000,<br> "size": 1583616,<br> "current_block_size": 6186,<br> "nbUnusedBlock": 22,<br> "percent_graph": "------------------------------",<br> "lastUnusedBlock": 1577216<br> }<br>]
admin
metric data files 1 2;
mentdb
------------------------------ 0% - 0 - used: 6186, free: 9993814, total block: 10000000, size: 1583616b, max size: 2560Mb, last unused block: 1577216, nb unused block: 22

fs index calcul pos <key>

Description

    To calculate the index position for a specific key

Parameters

    key:   The key - string - required
admin
fs index calcul pos "W[cat]";
mentdb
{<br> "indexPosition": 8,<br> "key": "W[cat]",<br> "indexFileId": 115<br>}

fs index block <indexFileId> <position>

Description

    To show a specific block at a position in an index file (The first 8 bytes is the number of block from the index file)

Parameters

    indexFileId:   The index file id - integer >= 0 - required
    position:   The position - integer >= 0 - required
admin
fs index block 115 8;
mentdb
{<br> "DataFileId": 0,<br> "DataPosition": 1575168<br>}

fs index count <indexFileId>

Description

    To show the number of block from an index file

Parameters

    indexFileId:   The index file id - integer >= 0 - required
admin
fs index count 115;
mentdb
2

fs data block <dataFileId> <position>

Description

    To show a specific block at a position from a data file

Parameters

    dataFileId:   The data file id - integer >= 0 - required
    position:   The position - integer >= 0 - required
admin
#Here the collision block;<br>fs data block 0 1575168
mentdb
{<br> "nextBlockAddress": -1,<br> "data": "W1siV1tjYXRdIiwwLDE1NzU0MjRdXQ\u003d\u003d"<br>}

fs data record <dataFileId> <position>

Description

    To show all blocks in a record at the position in a data file

Parameters

    dataFileId:   The data file id - integer >= 0 - required
    position:   The position - integer >= 0 - required
admin
#Here the collision record;<br>fs data record 0 1575168
mentdb
[<br> {<br> "blockId": 1,<br> "block": {<br> "nextBlockAddress": -1,<br> "data": "W1siV1tjYXRdIiwwLDE1NzU0MjRdXQ\u003d\u003d"<br> },<br> "position": 1575168<br> },<br> "[[\"W[cat]\",0,1575424]]"<br>]
admin
#Here the data record W[cat];<br>fs data record 0 1575424
mentdb
[<br> {<br> "blockId": 1,<br> "block": {<br> "nextBlockAddress": -1,<br> "data": "eyJmbCI6eyJlbiI6eyJsdGwiOiJUSFs2dF0iLCJmdGwiOiJUSFs2dF0ifX0sInciOjIsImsiOiJXW2NhdF0ifQ\u003d\u003d"<br> },<br> "position": 1575424<br> },<br> "{\"fl\":{\"en\":{\"ltl\":\"TH[6t]\",\"ftl\":\"TH[6t]\"}},\"w\":2,\"k\":\"W[cat]\"}"<br>]
admin
#Here the data node W[cat];<br>node show W[cat]
mentdb
{<br> "fl": {<br> "en": {<br> "ltl": "TH[72]",<br> "ftl": "TH[6t]"<br> }<br> },<br> "w": 10,<br> "k": "W[cat]"<br>}

fs cache size

Description

    To show the cache size

admin
fs cache size;
mentdb
512

fs lock size

Description

    To show the lock size

admin
fs lock size;
mentdb
21

fs unused data block <dataFileId> <limit>

Description

    To show the unused block list (after a block was deleted). The list return the last block before.

Parameters

    dataFileId:   The data file id - integer >= 0 - required
    limit:   The limit - integer >= 0 - required
admin
fs unused data block 0 10;
mentdb
[<br> 1577728,<br> 1578752,<br> 1579008,<br> 57344,<br> 1579520,<br> 1579776,<br> 1581312,<br> 1580288,<br> 1580032,<br> 1579264,<br> 1581824<br>]

fs unused nb block <dataFileId>

Description

    To show the number of unused data block (after a block was deleted)

Parameters

    dataFileId:   The data file id - integer >= 0 - required
admin
fs unused nb block 0;
mentdb
22

fs unused last block <dataFileId>

Description

    To show the last unused data block (after a block was deleted)

Parameters

    dataFileId:   The data file id - integer >= 0 - required
admin
fs unused last block 0;
mentdb
1577728

fs force add_data_blocks <key> <jsonObjectValue>

Description

    To force to add a data blocks

Parameters

    key:   The key - string - required
    jsonObjectValue:   The json object value - string - required
admin
fs force add_data_blocks "keyId" "{}";
mentdb
["keyId", 0, 5662777]

fs force record

Description

    To force to all collision and data blocks

admin
#################################################################################; -> "[key]" "keyId"; -> "[val]" "{\"a\": 22}"; #################################################################################; json load "val" [val]; #################################################################################; node show [key]; #################################################################################; json load "calcul_pos" (fs index calcul pos [key]); json load "collisions_position" (fs index block (json select "calcul_pos" /indexFileId) (json select "calcul_pos" /indexPosition)); json doc "collisions_position"; #################################################################################; if (and (== -1 (json select "collisions_position" /DataFileId)) (== -1 (json select "collisions_position" /DataPosition))) { json load "collisions" "[]"; } { json load "coll_record_data" (fs data record (json select "collisions_position" /DataFileId) (json select "collisions_position" /DataPosition)); json load "collisions" (json select "coll_record_data" (concat "/[" (- (json count "coll_record_data" /) 1) "]")); }; json doc "collisions"; #################################################################################; -> "[pos_coll]" -1; -> "[index]" 0; json parse_array "collisions" "/" "col" { if (equal (json select "col" "/[0]") [key]) { -> "[pos_coll]" [index]; }; ++ "[index]"; }; if (> [pos_coll] -1) { json darray "collisions" / [pos_coll]; }; json iarray "collisions" / (fs force add_data_blocks [key] [val]) ARRAY; json doc "collisions"; #################################################################################; fs force add_collision_blocks [key] (json doc "collisions"); if (== [pos_coll] -1) { fs force index_counter_add (json select "calcul_pos" /indexFileId) 1; }; #################################################################################; node show [key];
mentdb
{"a": 22}

fs force add_collision_blocks <key> <jsonObjectValue>

Description

    To force to add a collision block

Parameters

    key:   The key - string - required
    jsonObjectValue:   The json object value - string - required
admin
fs force add_collision_blocks [key] (json doc "collisions");
mentdb
...

fs force index_counter_add <indexId> <add_diff_value>

Description

    To force to add a collision block

Parameters

    indexId:   The index file id - number - required
    add_diff_value:   The number to add - number - required
admin
fs force index_counter_add 1 1;
mentdb
1

fs force diagnostic <file_result_path> <repairGhostBlocks>

Description

    To force a diagnostic on all nodes

Parameters

    file_result_path:   The file result path - string - required
    repairGhostBlocks:   Repair ghost blocks - boolean - required
admin
fs force diagnostic "tmp/fs_diagnostic.html" false; fs force diagnostic "tmp/fs_diagnostic.html" true; fs force diagnostic "tmp/fs_diagnostic.html" false;
mentdb
1
    Home  >  MQL Functions
MentDB © 2012 - 2021