From ea78960fa95e80e3b941cce5035cdf50b1b656c5 Mon Sep 17 00:00:00 2001 From: Jacob Schmidt Date: Tue, 13 Jan 2026 20:19:07 -0600 Subject: [PATCH] Update db function headers and payload size docs --- addons/db/functions/fnc_addTask.sqf | 18 ++---- addons/db/functions/fnc_delete.sqf | 10 +-- addons/db/functions/fnc_fetch.sqf | 43 +++++++------ addons/db/functions/fnc_get.sqf | 14 ++--- addons/db/functions/fnc_handler.sqf | 22 +++---- addons/db/functions/fnc_hashDelete.sqf | 12 +--- addons/db/functions/fnc_hashDeleteId.sqf | 12 +--- addons/db/functions/fnc_hashGet.sqf | 16 ++--- addons/db/functions/fnc_hashGetAll.sqf | 16 ++--- addons/db/functions/fnc_hashGetAllId.sqf | 16 ++--- addons/db/functions/fnc_hashGetId.sqf | 14 ++--- addons/db/functions/fnc_hashSet.sqf | 14 ++--- addons/db/functions/fnc_hashSetBulk.sqf | 16 ++--- addons/db/functions/fnc_hashSetId.sqf | 12 +--- addons/db/functions/fnc_hashSetIdBulk.sqf | 16 ++--- addons/db/functions/fnc_init.sqf | 14 ++--- addons/db/functions/fnc_listAdd.sqf | 12 +--- addons/db/functions/fnc_listGet.sqf | 14 ++--- addons/db/functions/fnc_listLoad.sqf | 14 ++--- addons/db/functions/fnc_listRemove.sqf | 10 +-- addons/db/functions/fnc_listSet.sqf | 12 +--- addons/db/functions/fnc_printAddonName.sqf | 24 ++++++- addons/db/functions/fnc_processQueue.sqf | 12 +--- addons/db/functions/fnc_pubSubFetch.sqf | 58 ----------------- addons/db/functions/fnc_pubSubHandler.sqf | 55 ---------------- addons/db/functions/fnc_publish.sqf | 53 ---------------- addons/db/functions/fnc_saveDB.sqf | 12 +--- addons/db/functions/fnc_scheduler.sqf | 18 ++---- addons/db/functions/fnc_set.sqf | 12 +--- addons/db/functions/fnc_setup.sqf | 14 ++--- addons/db/functions/fnc_subscribe.sqf | 73 ---------------------- addons/db/functions/fnc_test.sqf | 16 ++--- docs/README.md | 3 + docs/basic/README.md | 5 ++ docs/core/README.md | 5 ++ docs/hash/README.md | 5 ++ docs/list/README.md | 5 ++ 37 files changed, 177 insertions(+), 520 deletions(-) delete mode 100644 addons/db/functions/fnc_pubSubFetch.sqf delete mode 100644 addons/db/functions/fnc_pubSubHandler.sqf delete mode 100644 addons/db/functions/fnc_publish.sqf delete mode 100644 addons/db/functions/fnc_subscribe.sqf diff --git a/addons/db/functions/fnc_addTask.sqf b/addons/db/functions/fnc_addTask.sqf index 4087992..d77573f 100644 --- a/addons/db/functions/fnc_addTask.sqf +++ b/addons/db/functions/fnc_addTask.sqf @@ -4,25 +4,18 @@ * Function: dragonfly_db_fnc_addTask * Author: Creedcoder, J.Schmidt * Edit: 07.15.2024 - * Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved - * - * Do not edit without permission! - * - * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - * To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, - * PO Box 1866, Mountain View, CA 94042 * * [Description] - * Add task to queue. + * Queue a DB task and start the processor if idle. * * Arguments: - * 0: Type of task + * 0: Task type * 1: Name of stored key (default: "") * 2: Name of stored hash key field (default: "") - * 3: Index of stored value in list (default: -1) + * 3: Index of stored value in list (default: -1) * 4: Value to store in key [] (default: []) * 5: Name of function to return data (default: "") - * 6: Unscheduled environment (default: false) + * 6: Use call instead of spawn (default: false) * 7: NetID of target to return data from function (default: "") * * Return Value: @@ -35,6 +28,7 @@ * Public: Yes */ + params [["_taskType", "", [""]], ["_key", "", [""]], ["_keyField", "", [""]], ["_index", -1, [0]], ["_value", [], [[]]], ["_function", "", [""]], ["_call", false, [false]], ["_netId", "", [""]]]; private _task = [_taskType, _key, _keyField, _index, _value, _function, _call, _netId]; @@ -50,4 +44,4 @@ GVAR(taskQueue) pushBack _task; diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_addTask' Queue Size: %1", count GVAR(taskQueue)]; #endif -if !(GVAR(isProcessing)) then { [] spawn FUNC(processQueue); }; \ No newline at end of file +if !(GVAR(isProcessing)) then { [] spawn FUNC(processQueue); }; diff --git a/addons/db/functions/fnc_delete.sqf b/addons/db/functions/fnc_delete.sqf index 54f3dd2..3d6d142 100644 --- a/addons/db/functions/fnc_delete.sqf +++ b/addons/db/functions/fnc_delete.sqf @@ -4,13 +4,6 @@ * Function: dragonfly_db_fnc_delete * Author: Creedcoder, J.Schmidt * Edit: 07.15.2024 - * Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved - * - * Do not edit without permission! - * - * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - * To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, - * PO Box 1866, Mountain View, CA 94042 * * [Description] * Delete stored key from DB. @@ -28,6 +21,7 @@ * Public: Yes */ + params [["_key", "", [""]]]; #ifdef __A3__DEBUG__ @@ -38,4 +32,4 @@ if (_key == "") exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_delete' Invalid Input for Key '%1'", _key]; }; -"ArmaDragonflyClient" callExtension ["del", [_key]]; \ No newline at end of file +"ArmaDragonflyClient" callExtension ["del", [_key]]; diff --git a/addons/db/functions/fnc_fetch.sqf b/addons/db/functions/fnc_fetch.sqf index a406502..f650c13 100644 --- a/addons/db/functions/fnc_fetch.sqf +++ b/addons/db/functions/fnc_fetch.sqf @@ -1,24 +1,31 @@ #include "..\script_component.hpp" /* - @file Title: ArmaDragonflyClient Framework by Creedcoder, J.Schmidt - @file Version: 0.1 - @file Name: fnc_fetch.sqf - @file Author: Creedcoder, J.Schmidt - @file edit: 03.25.2024 - Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved + * Function: dragonfly_db_fnc_fetch + * Author: Creedcoder, J.Schmidt + * Edit: 07.15.2024 + * + * [Description] + * Receives DB response chunks, rebuilds the payload, and forwards it to the handler when complete. + * + * Arguments: + * 0: Unique request ID + * 1: Function name to execute + * 2: Chunk index + * 3: Total chunk count + * 4: Chunk data + * 5: Callback identifier or code + * 6: Network ID + * + * Return Value: + * N/A + * + * Examples: + * Called by the DB extension; not intended for direct use. + * + * Public: Yes + */ - Do not edit without permission! - - This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlikes 4.0 International License. - To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to Creative Commons, - 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. - - Fetch from DB: - dragonfly_db_fetch_array - - ["uniqueID", "function", "index", "indextotal", "datachunk", "call", "netId"] -*/ #ifdef __A3__DEBUG__ diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_fetch' Input: %1", _this]; @@ -55,4 +62,4 @@ if (_count_total == _total) then { [_uniqueID, _function, _call, (parseSimpleArray _dataString), _netId] call FUNC(handler); dragonfly_db_fetch_array = dragonfly_db_fetch_array select {!((_x select 0) in [_uniqueID])}; -}; \ No newline at end of file +}; diff --git a/addons/db/functions/fnc_get.sqf b/addons/db/functions/fnc_get.sqf index 16341aa..5300bc1 100644 --- a/addons/db/functions/fnc_get.sqf +++ b/addons/db/functions/fnc_get.sqf @@ -4,13 +4,6 @@ * Function: dragonfly_db_fnc_get * Author: Creedcoder, J.Schmidt * Edit: 07.15.2024 - * Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved - * - * Do not edit without permission! - * - * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - * To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, - * PO Box 1866, Mountain View, CA 94042 * * [Description] * Get value of stored key from DB. @@ -18,8 +11,8 @@ * Arguments: * 0: Name of stored key (default: "") * 1: Name of function to return data (default: "") - * 2: Unscheduled environment (default: false) - * 3: NetID of target to return data from function (default: "") + * 2: Use call instead of spawn (default: false) + * 3: NetID of target to return data to (default: "") * * Return Value: * N/A @@ -31,6 +24,7 @@ * Public: Yes */ + params [["_key", "", [""]], ["_function", "", [""]], ["_call", false, [false]], ["_netId", "", [""]]]; #ifdef __A3__DEBUG__ @@ -65,4 +59,4 @@ if (_netId != "") then { }; }; -[(_return select 0)] call FUNC(scheduler); \ No newline at end of file +[(_return select 0)] call FUNC(scheduler); diff --git a/addons/db/functions/fnc_handler.sqf b/addons/db/functions/fnc_handler.sqf index 47217f2..4eec4a3 100644 --- a/addons/db/functions/fnc_handler.sqf +++ b/addons/db/functions/fnc_handler.sqf @@ -4,26 +4,19 @@ * Function: dragonfly_db_fnc_handler * Author: Creedcoder, J.Schmidt * Edit: 07.15.2024 - * Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved - * - * Do not edit without permission! - * - * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - * To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, - * PO Box 1866, Mountain View, CA 94042 * * [Description] - * Handle data from DB. + * Dispatch DB data to a callback locally or via remoteExec. * * Arguments: - * 0: UniqueID for data chunk (default: "") + * 0: Unique request ID (default: "") * 1: Name of function to return data (default: "") - * 2: Unscheduled environment (default: false) + * 2: Use call instead of spawn (default: false) * 3: Data from key [] (default: []) - * 4: NetID of target to return data to from function (default: nil) + * 4: NetID of target to return data to (default: "") * * Return Value: - * [uniqueID, function, call, data, object] + * N/A * * Examples: * ["0123456789", "dragonfly_db_fnc_test", false, ["Hello World!"]] call dragonfly_db_fnc_handler (Server or Singleplayer Only) @@ -32,13 +25,14 @@ * Public: Yes */ + params [["_uniqueID", "", [""]], ["_function", "", [""]], ["_call", false, [false]], ["_data", [], [[]]], ["_netId", "", [""]]]; #ifdef __A3__DEBUG__ diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_handler' UniqueID: '%1', Function: '%2', Call: '%3', Data: '%4', NetId: '%5'", _uniqueID, _function, _call, _data, _netId]; #endif -if (_function == "" || count _data == 0) exitWith { +if (_function == "" || _data isEqualTo []) exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_handler' Invalid Input for Function '%1' or Data '%2'", _function, _data]; }; @@ -74,4 +68,4 @@ if (_netId != "") then { } else { _data spawn _func; }; -}; \ No newline at end of file +}; diff --git a/addons/db/functions/fnc_hashDelete.sqf b/addons/db/functions/fnc_hashDelete.sqf index 59ff9c0..4156892 100644 --- a/addons/db/functions/fnc_hashDelete.sqf +++ b/addons/db/functions/fnc_hashDelete.sqf @@ -4,16 +4,9 @@ * Function: dragonfly_db_fnc_hashDelete * Author: Creedcoder, J.Schmidt * Edit: 07.15.2024 - * Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved - * - * Do not edit without permission! - * - * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - * To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, - * PO Box 1866, Mountain View, CA 94042 * * [Description] - * Delete field in hash stored at key from DB. + * Delete a field from the default hash (no explicit key). * * Arguments: * 0: Name of stored field in hash (default: "") @@ -28,6 +21,7 @@ * Public: Yes */ + params [["_keyField", "", [""]]]; #ifdef __A3__DEBUG__ @@ -38,4 +32,4 @@ if (_keyField == "") exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashDelete' Invalid Input for KeyField '%1'", _keyField]; }; -"ArmaDragonflyClient" callExtension ["hdel", [_keyField]]; \ No newline at end of file +"ArmaDragonflyClient" callExtension ["hdel", [_keyField]]; diff --git a/addons/db/functions/fnc_hashDeleteId.sqf b/addons/db/functions/fnc_hashDeleteId.sqf index 4cc98d5..f9ea49f 100644 --- a/addons/db/functions/fnc_hashDeleteId.sqf +++ b/addons/db/functions/fnc_hashDeleteId.sqf @@ -4,20 +4,13 @@ * Function: dragonfly_db_fnc_hashDeleteId * Author: Creedcoder, J.Schmidt * Edit: 07.15.2024 - * Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved - * - * Do not edit without permission! - * - * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - * To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, - * PO Box 1866, Mountain View, CA 94042 * * [Description] * Delete field in hash stored at key from DB. * * Arguments: * 0: Key (default: "") - * 1: Key Field (default: "") + * 1: Key field (default: "") * * Return Value: * N/A @@ -29,6 +22,7 @@ * Public: Yes */ + params [["_key", "", [""]], ["_keyField", "", [""]]]; #ifdef __A3__DEBUG__ @@ -39,4 +33,4 @@ if (_key == "" || _keyField == "") exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashDeleteId' Invalid Input for Key '%1' or KeyField '%2'", _key, _keyField]; }; -"ArmaDragonflyClient" callExtension ["hdelid", [_key, _keyField]]; \ No newline at end of file +"ArmaDragonflyClient" callExtension ["hdelid", [_key, _keyField]]; diff --git a/addons/db/functions/fnc_hashGet.sqf b/addons/db/functions/fnc_hashGet.sqf index ae88277..b50f6ee 100644 --- a/addons/db/functions/fnc_hashGet.sqf +++ b/addons/db/functions/fnc_hashGet.sqf @@ -4,22 +4,15 @@ * Function: dragonfly_db_fnc_hashGet * Author: Creedcoder, J.Schmidt * Edit: 07.15.2024 - * Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved - * - * Do not edit without permission! - * - * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - * To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, - * PO Box 1866, Mountain View, CA 94042 * * [Description] - * Get value of field in hash stored in key from DB. + * Get value of field in the default hash and return it via callback. * * Arguments: * 0: Name of stored field in hash (default: "") * 1: Name of function to return data (default: "") - * 2: Unscheduled environment (default: false) - * 3: NetID of target to return data from function (default: nil) + * 2: Use call instead of spawn (default: false) + * 3: NetID of target to return data to (default: "") * * Return Value: * N/A @@ -31,6 +24,7 @@ * Public: Yes */ + params [["_keyField", "", [""]], ["_function", "", [""]], ["_call", false, [false]], ["_netId", "", [""]]]; #ifdef __A3__DEBUG__ @@ -69,4 +63,4 @@ if (_netId != "") then { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashGet' Return: '%1'", _return]; #endif -[(_return select 0)] call FUNC(scheduler); \ No newline at end of file +[(_return select 0)] call FUNC(scheduler); diff --git a/addons/db/functions/fnc_hashGetAll.sqf b/addons/db/functions/fnc_hashGetAll.sqf index 7346e77..6f71bdb 100644 --- a/addons/db/functions/fnc_hashGetAll.sqf +++ b/addons/db/functions/fnc_hashGetAll.sqf @@ -4,21 +4,14 @@ * Function: dragonfly_db_fnc_hashGetAll * Author: Creedcoder, J.Schmidt * Edit: 07.15.2024 - * Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved - * - * Do not edit without permission! - * - * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - * To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, - * PO Box 1866, Mountain View, CA 94042 * * [Description] - * Get all fields and values of hash stored in key from DB. + * Get all fields and values from the default hash and return them via callback. * * Arguments: * 0: Name of function to return data (default: "") - * 1: Unscheduled environment (default: false) - * 2: NetID of target to return data from function (default: nil) + * 1: Use call instead of spawn (default: false) + * 2: NetID of target to return data to (default: "") * * Return Value: * N/A @@ -30,6 +23,7 @@ * Public: Yes */ + params [["_function", "", [""]], ["_call", false, [false]], ["_netId", "", [""]]]; #ifdef __A3__DEBUG__ @@ -68,4 +62,4 @@ if (_netId != "") then { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashGetAll' Return: '%1'", _return]; #endif -[(_return select 0)] call FUNC(scheduler); \ No newline at end of file +[(_return select 0)] call FUNC(scheduler); diff --git a/addons/db/functions/fnc_hashGetAllId.sqf b/addons/db/functions/fnc_hashGetAllId.sqf index 99122c3..74c87bb 100644 --- a/addons/db/functions/fnc_hashGetAllId.sqf +++ b/addons/db/functions/fnc_hashGetAllId.sqf @@ -4,22 +4,15 @@ * Function: dragonfly_db_fnc_hashGetAllId * Author: Creedcoder, J.Schmidt * Edit: 07.15.2024 - * Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved - * - * Do not edit without permission! - * - * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - * To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, - * PO Box 1866, Mountain View, CA 94042 * * [Description] - * Get all fields and values of hash stored in key from DB. + * Get all fields and values of hash stored at key from DB. * * Arguments: * 0: Name of stored key with hash (default: "") * 1: Name of function to return data (default: "") - * 2: Unscheduled environment (default: false) - * 3: NetID of target to return data from function (default: nil) + * 2: Use call instead of spawn (default: false) + * 3: NetID of target to return data to (default: "") * * Return Value: * N/A @@ -31,6 +24,7 @@ * Public: Yes */ + params [["_key", "", [""]], ["_function", "", [""]], ["_call", false, [false]], ["_netId", "", [""]]]; #ifdef __A3__DEBUG__ @@ -69,4 +63,4 @@ if (_netId != "") then { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashGetAllId' Return: '%1'", _return]; #endif -[(_return select 0)] call FUNC(scheduler); \ No newline at end of file +[(_return select 0)] call FUNC(scheduler); diff --git a/addons/db/functions/fnc_hashGetId.sqf b/addons/db/functions/fnc_hashGetId.sqf index 489ea5a..4911d99 100644 --- a/addons/db/functions/fnc_hashGetId.sqf +++ b/addons/db/functions/fnc_hashGetId.sqf @@ -4,13 +4,6 @@ * Function: dragonfly_db_fnc_hashGetId * Author: Creedcoder, J.Schmidt * Edit: 07.15.2024 - * Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved - * - * Do not edit without permission! - * - * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - * To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, - * PO Box 1866, Mountain View, CA 94042 * * [Description] * Get value of field in hash stored at key from DB. @@ -19,8 +12,8 @@ * 0: Name of stored key with hash (default: "") * 1: Name of stored field in hash (default: "") * 2: Name of function to return data (default: "") - * 3: Unscheduled environment (default: false) - * 4: NetID of target to return data from function (default: nil) + * 3: Use call instead of spawn (default: false) + * 4: NetID of target to return data to (default: "") * * Return Value: * N/A @@ -32,6 +25,7 @@ * Public: Yes */ + params [["_key", "", [""]], ["_keyField", "", [""]], ["_function", "", [""]], ["_call", false, [false]], ["_netId", "", [""]]]; #ifdef __A3__DEBUG__ @@ -70,4 +64,4 @@ if (_netId != "") then { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashGetId' Return: '%1'", _return]; #endif -[(_return select 0)] call FUNC(scheduler); \ No newline at end of file +[(_return select 0)] call FUNC(scheduler); diff --git a/addons/db/functions/fnc_hashSet.sqf b/addons/db/functions/fnc_hashSet.sqf index e0fdf16..a3e140b 100644 --- a/addons/db/functions/fnc_hashSet.sqf +++ b/addons/db/functions/fnc_hashSet.sqf @@ -4,16 +4,9 @@ * Function: dragonfly_db_fnc_hashSet * Author: Creedcoder, J.Schmidt * Edit: 07.15.2024 - * Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved - * - * Do not edit without permission! - * - * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - * To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, - * PO Box 1866, Mountain View, CA 94042 * * [Description] - * Set value of field in hash stored at key from DB. + * Set value of field in the default hash (no explicit key). * * Arguments: * 0: Name of stored field in hash (default: "") @@ -29,14 +22,15 @@ * Public: Yes */ + params [["_keyField", "", [""]], ["_data", [], [[]]]]; #ifdef __A3__DEBUG__ diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashSet' KeyField: '%1', Data: '%2'", _keyField, _data]; #endif -if (_keyField == "" || count _data == 0) exitWith { +if (_keyField == "" || _data isEqualTo []) exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashSet' Invalid Input for KeyField '%1' or Data '%2'", _keyField, _data]; }; -"ArmaDragonflyClient" callExtension ["hset", [_keyField, _data]]; \ No newline at end of file +"ArmaDragonflyClient" callExtension ["hset", [_keyField, _data]]; diff --git a/addons/db/functions/fnc_hashSetBulk.sqf b/addons/db/functions/fnc_hashSetBulk.sqf index afe4110..dfff0d5 100644 --- a/addons/db/functions/fnc_hashSetBulk.sqf +++ b/addons/db/functions/fnc_hashSetBulk.sqf @@ -4,19 +4,12 @@ * Function: dragonfly_db_fnc_hashSetBulk * Author: Creedcoder, J.Schmidt * Edit: 07.15.2024 - * Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved - * - * Do not edit without permission! - * - * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - * To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, - * PO Box 1866, Mountain View, CA 94042 * * [Description] - * Set fields and values in hash stored at key from DB. + * Set multiple field/value pairs in the default hash (no explicit key). * * Arguments: - * 0: Fields and Values to store in hash [] (default: []) + * 0: Fields and values to store in hash (default: []) * * Return Value: * N/A @@ -28,14 +21,15 @@ * Public: Yes */ + params [["_data", [], [[]]]]; #ifdef __A3__DEBUG__ diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashSetBulk' Data: %1", _data]; #endif -if (count _data == 0) exitWith { +if (_data isEqualTo []) exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashSetBulk' Invalid Input for Data '%1'", _data]; }; -"ArmaDragonflyClient" callExtension ["hset", _data]; \ No newline at end of file +"ArmaDragonflyClient" callExtension ["hset", _data]; diff --git a/addons/db/functions/fnc_hashSetId.sqf b/addons/db/functions/fnc_hashSetId.sqf index 7e5f4c4..e815234 100644 --- a/addons/db/functions/fnc_hashSetId.sqf +++ b/addons/db/functions/fnc_hashSetId.sqf @@ -4,13 +4,6 @@ * Function: dragonfly_db_fnc_hashSetId * Author: Creedcoder, J.Schmidt * Edit: 07.15.2024 - * Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved - * - * Do not edit without permission! - * - * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - * To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, - * PO Box 1866, Mountain View, CA 94042 * * [Description] * Set value of field in hash stored at key from DB. @@ -30,14 +23,15 @@ * Public: Yes */ + params [["_key", "", [""]], ["_keyField", "", [""]], ["_data", [], [[]]]]; #ifdef __A3__DEBUG__ diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashSetId' Key: '%1', KeyField: '%2', Data: '%3'", _key, _keyField, _data]; #endif -if (_key == "" || _keyField == "" || count _data == 0) exitWith { +if (_key == "" || _keyField == "" || _data isEqualTo []) exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashSetId' Invalid Input for Key '%1', KeyField '%2' or Data '%3'", _key, _keyField, _data]; }; -"ArmaDragonflyClient" callExtension ["hsetid", [_key, _keyField, _data]]; \ No newline at end of file +"ArmaDragonflyClient" callExtension ["hsetid", [_key, _keyField, _data]]; diff --git a/addons/db/functions/fnc_hashSetIdBulk.sqf b/addons/db/functions/fnc_hashSetIdBulk.sqf index 7235b94..95a6e51 100644 --- a/addons/db/functions/fnc_hashSetIdBulk.sqf +++ b/addons/db/functions/fnc_hashSetIdBulk.sqf @@ -4,19 +4,12 @@ * Function: dragonfly_db_fnc_hashSetIdBulk * Author: Creedcoder, J.Schmidt * Edit: 07.15.2024 - * Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved - * - * Do not edit without permission! - * - * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - * To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, - * PO Box 1866, Mountain View, CA 94042 * * [Description] - * Set fields and values in hash stored at key from DB. + * Set multiple field/value pairs in hash stored at key from DB. * * Arguments: - * 0: Fields and Values to store in hash [] (default: []) + * 0: Key followed by fields and values to store in hash (default: []) * * Return Value: * N/A @@ -28,14 +21,15 @@ * Public: Yes */ + params [["_data", [], [[]]]]; #ifdef __A3__DEBUG__ diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashSetIdBulk' Data: %1", _data]; #endif -if (count _data == 0) exitWith { +if (_data isEqualTo []) exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_hashSetIdBulk' Invalid Input for Data '%1'", _data]; }; -"ArmaDragonflyClient" callExtension ["hsetid", _data]; \ No newline at end of file +"ArmaDragonflyClient" callExtension ["hsetid", _data]; diff --git a/addons/db/functions/fnc_init.sqf b/addons/db/functions/fnc_init.sqf index 48579aa..e687810 100644 --- a/addons/db/functions/fnc_init.sqf +++ b/addons/db/functions/fnc_init.sqf @@ -4,16 +4,9 @@ * Function: dragonfly_db_fnc_init * Author: Creedcoder, J.Schmidt * Edit: 07.15.2024 - * Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved - * - * Do not edit without permission! - * - * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - * To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, - * PO Box 1866, Mountain View, CA 94042 * * [Description] - * Initial Extension settings. + * Initialize extension settings and log version info. * * Arguments: * N/A @@ -27,11 +20,12 @@ * Public: Yes */ -dragonfly_db_buffer = 10240; + +dragonfly_db_buffer = 20480; private _dll = "ArmaDragonflyClient" callExtension ["version", []]; diag_log text (format ["ArmaDragonflyClient: DLL Version %1 found", _dll]); diag_log text "ArmaDragonflyClient: Functions loaded and Initializtion completed!"; diag_log text (format ["ArmaDragonflyClient: Buffer size set to %1 Bytes", dragonfly_db_buffer]); -diag_log text "ArmaDragonflyClient: Ready for use!"; \ No newline at end of file +diag_log text "ArmaDragonflyClient: Ready for use!"; diff --git a/addons/db/functions/fnc_listAdd.sqf b/addons/db/functions/fnc_listAdd.sqf index 17931fa..0a80001 100644 --- a/addons/db/functions/fnc_listAdd.sqf +++ b/addons/db/functions/fnc_listAdd.sqf @@ -4,13 +4,6 @@ * Function: dragonfly_db_fnc_listAdd * Author: Creedcoder, J.Schmidt * Edit: 07.15.2024 - * Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved - * - * Do not edit without permission! - * - * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - * To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, - * PO Box 1866, Mountain View, CA 94042 * * [Description] * Add element to list stored at key from DB. @@ -29,14 +22,15 @@ * Public: Yes */ + params [["_key", "", [""]], ["_data", [], [[]]]]; #ifdef __A3__DEBUG__ diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_listAdd' Key: '%1', Data: '%2'", _key, _data]; #endif -if (_key == "" || count _data == 0) exitWith { +if (_key == "" || _data isEqualTo []) exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_listAdd' Invalid Input for Key '%1' or Data '%2'", _key, _data]; }; -"ArmaDragonflyClient" callExtension ["listadd", [_key, _data]]; \ No newline at end of file +"ArmaDragonflyClient" callExtension ["listadd", [_key, _data]]; diff --git a/addons/db/functions/fnc_listGet.sqf b/addons/db/functions/fnc_listGet.sqf index a5e5748..164cd62 100644 --- a/addons/db/functions/fnc_listGet.sqf +++ b/addons/db/functions/fnc_listGet.sqf @@ -4,13 +4,6 @@ * Function: dragonfly_db_fnc_listGet * Author: Creedcoder, J.Schmidt * Edit: 07.15.2024 - * Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved - * - * Do not edit without permission! - * - * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - * To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, - * PO Box 1866, Mountain View, CA 94042 * * [Description] * Get element of list stored at key from DB. @@ -19,8 +12,8 @@ * 0: Name of stored key (default: "") * 1: Index of stored value in list (default: -1) * 2: Name of function to return data (default: "") - * 3: Unscheduled environment (default: false) - * 4: NetID of target to return data from function (default: nil) + * 3: Use call instead of spawn (default: false) + * 4: NetID of target to return data to (default: "") * * Return Value: * N/A @@ -32,6 +25,7 @@ * Public: Yes */ + params [["_key", "", [""]], ["_index", -1, [0]], ["_function", "", [""]], ["_call", false, [false]], ["_netId", "", [""]]]; #ifdef __A3__DEBUG__ @@ -70,4 +64,4 @@ if (_netId != "") then { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_listGet' Return: '%1'", _return]; #endif -[(_return select 0)] call FUNC(scheduler); \ No newline at end of file +[(_return select 0)] call FUNC(scheduler); diff --git a/addons/db/functions/fnc_listLoad.sqf b/addons/db/functions/fnc_listLoad.sqf index 53795a3..ce617c9 100644 --- a/addons/db/functions/fnc_listLoad.sqf +++ b/addons/db/functions/fnc_listLoad.sqf @@ -4,13 +4,6 @@ * Function: dragonfly_db_fnc_listLoad * Author: Creedcoder, J.Schmidt * Edit: 07.15.2024 - * Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved - * - * Do not edit without permission! - * - * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - * To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, - * PO Box 1866, Mountain View, CA 94042 * * [Description] * Get all elements of list stored at key from DB. @@ -18,8 +11,8 @@ * Arguments: * 0: Name of stored key (default: "") * 1: Name of function to return data (default: "") - * 2: Unscheduled environment (default: false) - * 3: NetID of target to return data from function (default: nil) + * 2: Use call instead of spawn (default: false) + * 3: NetID of target to return data to (default: "") * * Return Value: * N/A @@ -31,6 +24,7 @@ * Public: Yes */ + params [["_key", "", [""]], ["_function", "", [""]], ["_call", false, [false]], ["_netId", "", [""]]]; #ifdef __A3__DEBUG__ @@ -69,4 +63,4 @@ if (_netId != "") then { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_listLoad' Return: '%1'", _return]; #endif -[(_return select 0)] call FUNC(scheduler); \ No newline at end of file +[(_return select 0)] call FUNC(scheduler); diff --git a/addons/db/functions/fnc_listRemove.sqf b/addons/db/functions/fnc_listRemove.sqf index be4f654..235f46c 100644 --- a/addons/db/functions/fnc_listRemove.sqf +++ b/addons/db/functions/fnc_listRemove.sqf @@ -4,13 +4,6 @@ * Function: dragonfly_db_fnc_listRemove * Author: Creedcoder, J.Schmidt * Edit: 07.15.2024 - * Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved - * - * Do not edit without permission! - * - * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - * To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, - * PO Box 1866, Mountain View, CA 94042 * * [Description] * Remove element of list stored at key from DB. @@ -29,6 +22,7 @@ * Public: Yes */ + params [["_key", "", [""]], ["_index", -1, [0]]]; #ifdef __A3__DEBUG__ @@ -39,4 +33,4 @@ if (_key == "") exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_listRemove' Invalid Input for Key '%1'", _key]; }; -"ArmaDragonflyClient" callExtension ["listrem", [_key, _index]]; \ No newline at end of file +"ArmaDragonflyClient" callExtension ["listrem", [_key, _index]]; diff --git a/addons/db/functions/fnc_listSet.sqf b/addons/db/functions/fnc_listSet.sqf index c0b1db5..1bb520e 100644 --- a/addons/db/functions/fnc_listSet.sqf +++ b/addons/db/functions/fnc_listSet.sqf @@ -4,13 +4,6 @@ * Function: dragonfly_db_fnc_listSet * Author: Creedcoder, J.Schmidt * Edit: 07.15.2024 - * Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved - * - * Do not edit without permission! - * - * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - * To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, - * PO Box 1866, Mountain View, CA 94042 * * [Description] * Set element of list stored at key from DB. @@ -30,14 +23,15 @@ * Public: Yes */ + params [["_key", "", [""]], ["_index", -1, [0]], ["_data", [], [[]]]]; #ifdef __A3__DEBUG__ diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_listSet' Key: '%1', Index: '%2', Data: '%3'", _key, _index, _data]; #endif -if (_key == "" || count _data == 0) exitWith { +if (_key == "" || _data isEqualTo []) exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_listSet' Invalid Input for Key '%1' or Data '%2'", _key, _data]; }; -"ArmaDragonflyClient" callExtension ["listset", [_key, _index, _data]]; \ No newline at end of file +"ArmaDragonflyClient" callExtension ["listset", [_key, _index, _data]]; diff --git a/addons/db/functions/fnc_printAddonName.sqf b/addons/db/functions/fnc_printAddonName.sqf index 511d7b1..78e7c5a 100644 --- a/addons/db/functions/fnc_printAddonName.sqf +++ b/addons/db/functions/fnc_printAddonName.sqf @@ -1,3 +1,25 @@ #include "..\script_component.hpp" -systemChat format ["Thank you for using the %1", 'ADDON']; \ No newline at end of file +/* + * Function: dragonfly_db_fnc_printAddonName + * Author: Creedcoder, J.Schmidt + * Edit: 07.15.2024 + * + * [Description] + * Print a system chat message with the addon name. + * + * Arguments: + * N/A + * + * Return Value: + * N/A + * + * Examples: + * [] call dragonfly_db_fnc_printAddonName (Server or Singleplayer Only) + * [] remoteExecCall ["dragonfly_db_fnc_printAddonName", 2, false] (Multiplayer Only) + * + * Public: Yes + */ + + +systemChat format ["Thank you for using the %1", 'ADDON']; diff --git a/addons/db/functions/fnc_processQueue.sqf b/addons/db/functions/fnc_processQueue.sqf index da8d319..d041b34 100644 --- a/addons/db/functions/fnc_processQueue.sqf +++ b/addons/db/functions/fnc_processQueue.sqf @@ -4,16 +4,9 @@ * Function: dragonfly_db_fnc_processQueue * Author: Creedcoder, J.Schmidt * Edit: 07.15.2024 - * Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved - * - * Do not edit without permission! - * - * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - * To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, - * PO Box 1866, Mountain View, CA 94042 * * [Description] - * Process queue of tasks. + * Process queued DB tasks sequentially. * * Arguments: * N/A @@ -28,6 +21,7 @@ * Public: Yes */ + GVAR(isProcessing) = true; while { count GVAR(taskQueue) > 0} do { @@ -178,4 +172,4 @@ while { count GVAR(taskQueue) > 0} do { }; -GVAR(isProcessing) = false; \ No newline at end of file +GVAR(isProcessing) = false; diff --git a/addons/db/functions/fnc_pubSubFetch.sqf b/addons/db/functions/fnc_pubSubFetch.sqf deleted file mode 100644 index d4b8f9c..0000000 --- a/addons/db/functions/fnc_pubSubFetch.sqf +++ /dev/null @@ -1,58 +0,0 @@ -#include "..\script_component.hpp" - -/* - @file Title: ArmaDragonflyClient Framework by Creedcoder, J.Schmidt - @file Version: 0.1 - @file Name: fnc_pubSubFetch.sqf - @file Author: Creedcoder, J.Schmidt - @file edit: 03.25.2024 - Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved - - Do not edit without permission! - - This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlikes 4.0 International License. - To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to Creative Commons, - 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. - - Fetch from DB: - dragonfly_db_pubSubFetch_array - - ["uniqueID", "evetnType", "eventName", "index", "indextotal", "datachunk", "target"] -*/ - -#ifdef __A3__DEBUG__ - diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_pubSubFetch' Data: %1", _this]; -#endif - -params ["_uniqueID", "_eventType", "_eventName", "_index", "_total", "_datachunk", "_target"]; - -private _dataString = ""; -private _index_array = []; -private _count_total = -1; - -dragonfly_db_pubSubFetch_array pushBackUnique [_uniqueID, _eventType, _eventName, _index, _total, _datachunk, _target]; - -_count_total = { - if (_uniqueID == _x select 0) then { - _index_array pushBackUnique [_x select 3, _x select 5]; - true - } else { - false - } -} count dragonfly_db_pubSubFetch_array; - -if (_count_total == _total) then { - _index_array sort true; - - for "_i" from 0 to (_total - 1) do { - _dataString = _dataString + ((_index_array select _i) select 1); - }; - - #ifdef __ARMA_DEBUG__ - diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_pubSubFetch' Data String: %1", _dataString]; - #endif - - [_uniqueID, _eventType, _eventName, (parseSimpleArray _dataString), _target] call FUNC(pubSubHandler); - - dragonfly_db_pubSubFetch_array = dragonfly_db_pubSubFetch_array select {!((_x select 0) in [_uniqueID])}; -}; \ No newline at end of file diff --git a/addons/db/functions/fnc_pubSubHandler.sqf b/addons/db/functions/fnc_pubSubHandler.sqf deleted file mode 100644 index 2b013db..0000000 --- a/addons/db/functions/fnc_pubSubHandler.sqf +++ /dev/null @@ -1,55 +0,0 @@ -#include "..\script_component.hpp" - -/* - * Function: dragonfly_db_fnc_pubSubHandler - * Author: Creedcoder, J.Schmidt - * Edit: 07.15.2024 - * Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved - * - * Do not edit without permission! - * - * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - * To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, - * PO Box 1866, Mountain View, CA 94042 - * - * [Description] - * Handles pub/sub messages and routes them through the CBA event system based on event type. - * - * Arguments: - * 0: UniqueID for message tracking (default: "") - * 1: Event type (global, local, server, remote) (default: "") - * 2: Event name for CBA event system (default: "") - * 3: Message data [] (default: []) - * 4: Target NetID for remote events (default: "") - * - * Return Value: - * None - * - * Examples: - * ["123", "global", "myEvent", ["Hello"], ""] call dragonfly_db_fnc_pubSubHandler - * ["456", "remote", "playerEvent", ["Update"], "2:3"] call dragonfly_db_fnc_pubSubHandler - * - * Public: Yes - */ - -params [["_uniqueID", "", [""]], ["_eventType", "", [""]], ["_eventName", "", [""]], ["_data", [], [[]]], ["_target", "", [""]]]; - -#ifdef __A3__DEBUG__ - diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_pubSubHandler' Data: %1", _this]; -#endif - -switch (_eventType) do { - case "global": { - [_eventName, _data] call CFUNC(globalEvent); - }; - case "local": { - [_eventName, _data] call CFUNC(localEvent); - }; - case "server": { - [_eventName, _data] call CFUNC(serverEvent); - }; - case "remote": { - private _targetObj = objectFromNetId _target; - [_eventName, _data, _targetObj] call CFUNC(remoteEvent); - }; -}; \ No newline at end of file diff --git a/addons/db/functions/fnc_publish.sqf b/addons/db/functions/fnc_publish.sqf deleted file mode 100644 index 62be3d3..0000000 --- a/addons/db/functions/fnc_publish.sqf +++ /dev/null @@ -1,53 +0,0 @@ -#include "..\script_component.hpp" - -/* - * Function: dragonfly_db_fnc_publish - * Author: Creedcoder, J. Schmidt - * Edit: 07.15.2024 - * Copyright © 2024 Creedcoder, J. Schmidt, All rights reserved - * - * Do not edit without permission! - * - * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - * To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, - * PO Box 1866, Mountain View, CA 94042 - * - * [Description] - * Publish a message to a DragonflyDB channel. - * The message will be routed through the CBA event system based on the subscription event type. - * - * Arguments: - * 0: STRING - Channel name to publish to (default: "") - * 1: ARRAY|STRING|NUMBER|BOOL - Data to publish (default: []) - * - * Return Value: - * BOOLEAN - True if successful, false otherwise - * - * Examples: - * ["global_chat", "Hello world!"] call dragonfly_db_fnc_publish - * ["mission_updates", ["task_01", "SUCCEEDED", [2, 3, 4]]] call dragonfly_db_fnc_publish - * - * Public: Yes - */ - -params [["_channel", "", [""]], ["_message", [], [[], "", 0, true]]]; - -#ifdef __A3__DEBUG__ - diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_publish' Channel: '%1', Message: '%2'", _channel, _message]; -#endif - -if (_channel isEqualTo "") exitWith { - diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_publish' Invalid Input for Channel '%1'", _channel]; - false -}; - -private _args = [_channel, _message]; -private _formattedArgs = _args apply { if (_x isEqualType "") then { str _x } else { _x } }; -private _extensionArgs = _formattedArgs joinString ","; -private _result = "ArmaDragonflyClient" callExtension ["publish", [_extensionArgs]]; - -#ifdef __ARMA_DEBUG__ - diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_publish' Published message to channel '%1': '%2'", _channel, _message]; -#endif - -true \ No newline at end of file diff --git a/addons/db/functions/fnc_saveDB.sqf b/addons/db/functions/fnc_saveDB.sqf index 03f9918..b5b03e7 100644 --- a/addons/db/functions/fnc_saveDB.sqf +++ b/addons/db/functions/fnc_saveDB.sqf @@ -4,16 +4,9 @@ * Function: dragonfly_db_fnc_saveDB * Author: Creedcoder, J.Schmidt * Edit: 07.15.2024 - * Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved - * - * Do not edit without permission! - * - * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - * To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, - * PO Box 1866, Mountain View, CA 94042 * * [Description] - * Save DB to disc. + * Save DB to disk. * * Arguments: * N/A @@ -28,4 +21,5 @@ * Public: Yes */ -"ArmaDragonflyClient" callExtension ["savedb", []]; \ No newline at end of file + +"ArmaDragonflyClient" callExtension ["savedb", []]; diff --git a/addons/db/functions/fnc_scheduler.sqf b/addons/db/functions/fnc_scheduler.sqf index 7be3904..fc88823 100644 --- a/addons/db/functions/fnc_scheduler.sqf +++ b/addons/db/functions/fnc_scheduler.sqf @@ -4,30 +4,24 @@ * Function: dragonfly_db_fnc_scheduler * Author: Creedcoder, J.Schmidt * Edit: 07.15.2024 - * Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved - * - * Do not edit without permission! - * - * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - * To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, - * PO Box 1866, Mountain View, CA 94042 * * [Description] - * Scheduled Environment for extension. + * Parse extension scheduler payload and map task ID to callback. * * Arguments: - * 0: Task ID from extension (default: "") + * 0: Serialized task payload from extension (default: "") * * Return Value: * N/A * * Examples: - * ["071620241600_get"] call dragonfly_db_fnc_scheduler (Server or Singleplayer Only) - * ["071620241600_get"] remoteExecCall ["dragonfly_db_fnc_scheduler", 2, false] (Multiplayer Only) + * [(_return select 0)] call dragonfly_db_fnc_scheduler (Server or Singleplayer Only) + * [(_return select 0)] remoteExecCall ["dragonfly_db_fnc_scheduler", 2, false] (Multiplayer Only) * * Public: Yes */ + private _params = call compile format ["%1", (_this select 0)]; private _taskID = _params select 0; private _function = _params select 1; @@ -45,4 +39,4 @@ private _addTaskIDToMap = { _myHashMap = missionNamespace getVariable [_varName, createHashMap]; }; -[_taskType, _taskID] call _addTaskIDToMap; \ No newline at end of file +[_taskType, _taskID] call _addTaskIDToMap; diff --git a/addons/db/functions/fnc_set.sqf b/addons/db/functions/fnc_set.sqf index d659610..300774c 100644 --- a/addons/db/functions/fnc_set.sqf +++ b/addons/db/functions/fnc_set.sqf @@ -4,13 +4,6 @@ * Function: dragonfly_db_fnc_set * Author: Creedcoder, J.Schmidt * Edit: 07.15.2024 - * Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved - * - * Do not edit without permission! - * - * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - * To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, - * PO Box 1866, Mountain View, CA 94042 * * [Description] * Set value of stored key from DB. @@ -29,7 +22,8 @@ * Public: Yes */ -params [["_key", "", [""]], ["_data", "", [[]]]]; + +params [["_key", "", [""]], ["_data", [], [[]]]]; #ifdef __A3__DEBUG__ diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_set' Key: '%1', Data: '%2'", _key, _data]; @@ -39,4 +33,4 @@ if (_key == "" || isNil "_data") exitWith { diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_set' Invalid Input for Key '%1' or Data '%2'", _key, _data]; }; -"ArmaDragonflyClient" callExtension ["set", [_key, _data]]; \ No newline at end of file +"ArmaDragonflyClient" callExtension ["set", [_key, _data]]; diff --git a/addons/db/functions/fnc_setup.sqf b/addons/db/functions/fnc_setup.sqf index a998bcf..caa57f8 100644 --- a/addons/db/functions/fnc_setup.sqf +++ b/addons/db/functions/fnc_setup.sqf @@ -4,21 +4,14 @@ * Function: dragonfly_db_fnc_setup * Author: Creedcoder, J.Schmidt * Edit: 07.15.2024 - * Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved - * - * Do not edit without permission! - * - * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - * To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, - * PO Box 1866, Mountain View, CA 94042 * * [Description] - * Setup Extension to communicate with DB. + * Setup extension connection settings. * * Arguments: * 0: Name of host (default: "localhost") * 1: Port of host (default: 6379) - * 2: Password of host (default: "xyz123") + * 2: Password of host (default: "") * * Return Value: * N/A @@ -30,6 +23,7 @@ * Public: Yes */ + params [["_host", "localhost", [""]], ["_port", 6379, [0]], ["_password", "", [""]]]; -"ArmaDragonflyClient" callExtension ["setup", [_host, _port, _password]]; \ No newline at end of file +"ArmaDragonflyClient" callExtension ["setup", [_host, _port, _password]]; diff --git a/addons/db/functions/fnc_subscribe.sqf b/addons/db/functions/fnc_subscribe.sqf deleted file mode 100644 index ea5f7a1..0000000 --- a/addons/db/functions/fnc_subscribe.sqf +++ /dev/null @@ -1,73 +0,0 @@ -#include "..\script_component.hpp" - -/* - * Function: dragonfly_db_fnc_subscribe - * Author: J. Schmidt - * Edit: 07.15.2024 - * Copyright © 2024 J. Schmidt, All rights reserved - * - * Do not edit without permission! - * - * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - * To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, - * PO Box 1866, Mountain View, CA 94042 - * - * [Description] - * Subscribe to a DragonflyDB channel for real-time updates. - * Uses CBA event system for message handling. - * - * Arguments: - * 0: STRING - Channel name to subscribe to (default: "") - * 1: STRING - Event type: "global", "local", "server", or "remote" (default: "global") - * 2: STRING - CBA event name to trigger when messages are received (default: "") - * 3: STRING - NetID of target to receive messages (only needed for "remote" event type) (default: nil) - * - * Return Value: - * BOOLEAN - True if successful, false otherwise - * - * Examples: - * ["global_chat", "global", "myChatEvent"] call dragonfly_db_fnc_subscribe - * ["player_notifications", "remote", "playerNotificationEvent", netId player] call dragonfly_db_fnc_subscribe - * - * Public: Yes - */ - -params [["_channel", "", [""]], ["_eventType", "global", [""]], ["_eventName", "", [""]], ["_target", nil, [""]]]; - -#ifdef __A3__DEBUG__ - diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_subscribe' Channel: '%1', Event Type: '%2', Event Name: '%3', Target: '%4'", _channel, _eventType, _eventName, _target]; -#endif - -if (_channel isEqualTo "") exitWith { - diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_subscribe' Invalid Input for Channel '%1'", _channel]; - false -}; - -if (!(_eventType in ["global", "local", "server", "remote"])) exitWith { - diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_subscribe' Invalid Input for Event Type '%1'", _eventType]; - false -}; - -if (_eventType isEqualTo "remote" && (isNil "_target" || _target isEqualTo "")) exitWith { - diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_subscribe' Invalid Input for Target NetID '%1'", _target]; - false -}; - -if (_eventName isEqualTo "") exitWith { - diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_subscribe' Invalid Input for Event Name '%1'", _eventName]; - false -}; - -private _args = [_channel, _eventType, _eventName]; - -if (!isNil "_target") then { _args pushBack _target; }; - -private _formattedArgs = _args apply { if (_x isEqualType "") then { str _x } else { _x } }; -private _extensionArgs = _formattedArgs joinString ","; -private _result = "ArmaDragonflyClient" callExtension ["subscribe", [_extensionArgs]]; - -#ifdef __ARMA_DEBUG__ - diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_subscribe' Subscribed to channel '%1' with event type '%2' and event name '%3'", _channel, _eventType, _eventName]; -#endif - -true \ No newline at end of file diff --git a/addons/db/functions/fnc_test.sqf b/addons/db/functions/fnc_test.sqf index 1ea2cd2..5f98156 100644 --- a/addons/db/functions/fnc_test.sqf +++ b/addons/db/functions/fnc_test.sqf @@ -4,22 +4,15 @@ * Function: dragonfly_db_fnc_test * Author: Creedcoder, J.Schmidt * Edit: 07.15.2024 - * Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved - * - * Do not edit without permission! - * - * This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. - * To view a copy of this license, vist https://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, - * PO Box 1866, Mountain View, CA 94042 * * [Description] - * Test function. + * Log and display a test payload. * * Arguments: - * 0: Value + * 0: Payload value * * Return Value: - * Value + * N/A * * Examples: * ["Hello World!"] spawn dragonfly_db_fnc_test (Server or Singleplayer Only) @@ -28,8 +21,9 @@ * Public: Yes */ + _res = _this; dragonfly_db_test = _res; hint format ["%1", _res]; -diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_test' Result: '%1'", _res]; \ No newline at end of file +diag_log text format ["ArmaDragonflyClient: 'dragonfly_db_fnc_test' Result: '%1'", _res]; diff --git a/docs/README.md b/docs/README.md index 94d6106..8337c3d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -2,6 +2,9 @@ This documentation provides details on all functions available in `ArmaDragonflyClient`. These functions allow you to interact with the in-memory database system for Arma 3. +## Important Payload Limit +Keep payloads under 20,480 bytes. This is the maximum size the engine can send or receive at one time. If you expect a response larger than 20,480 bytes, provide a callback function so the mod can use its internal fetch/chunking flow and deliver the reconstructed data to your callback. + ## Function Categories The functions are categorized by their purpose: diff --git a/docs/basic/README.md b/docs/basic/README.md index ab4e0b8..92daaed 100644 --- a/docs/basic/README.md +++ b/docs/basic/README.md @@ -1,5 +1,10 @@ # Basic Data Operations + + +## Important Payload Limit +Keep payloads under 20,480 bytes. This is the maximum size the engine can send or receive at one time. If you expect a response larger than 20,480 bytes, provide a callback function so the mod can use its internal fetch/chunking flow and deliver the reconstructed data to your callback. + This section contains documentation for the basic data operations of ArmaDragonflyClient that allow for simple key-value storage and retrieval. ## Available Functions diff --git a/docs/core/README.md b/docs/core/README.md index 3ff5ed5..78803a4 100644 --- a/docs/core/README.md +++ b/docs/core/README.md @@ -1,5 +1,10 @@ # Core Functions + + +## Important Payload Limit +Keep payloads under 20,480 bytes. This is the maximum size the engine can send or receive at one time. If you expect a response larger than 20,480 bytes, provide a callback function so the mod can use its internal fetch/chunking flow and deliver the reconstructed data to your callback. + This section contains documentation for the core functions of ArmaDragonflyClient that handle initialization, process management, and scheduling. ## Available Functions diff --git a/docs/hash/README.md b/docs/hash/README.md index bfa1177..aa63362 100644 --- a/docs/hash/README.md +++ b/docs/hash/README.md @@ -1,5 +1,10 @@ # Hash Operations + + +## Important Payload Limit +Keep payloads under 20,480 bytes. This is the maximum size the engine can send or receive at one time. If you expect a response larger than 20,480 bytes, provide a callback function so the mod can use its internal fetch/chunking flow and deliver the reconstructed data to your callback. + This section contains documentation for the hash operations of ArmaDragonflyClient that allow for working with hash tables (key-value pairs within a namespace). ## Available Functions diff --git a/docs/list/README.md b/docs/list/README.md index 9f72dae..3c7b317 100644 --- a/docs/list/README.md +++ b/docs/list/README.md @@ -1,5 +1,10 @@ # List Operations + + +## Important Payload Limit +Keep payloads under 20,480 bytes. This is the maximum size the engine can send or receive at one time. If you expect a response larger than 20,480 bytes, provide a callback function so the mod can use its internal fetch/chunking flow and deliver the reconstructed data to your callback. + This section contains documentation for the list operations of ArmaDragonflyClient that allow for working with ordered collections of items. ## Available Functions