-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
953 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
The Client Store API provides a simple key-value store for client-specific states and preferences. | ||
|
||
# Client Store API | ||
|
||
## clientStore.set(key, value) | ||
Sets a value in the client store. | ||
|
||
Example: | ||
```lua | ||
clientStore.set("theme", "dark") | ||
``` | ||
|
||
## clientStore.get(key) | ||
Gets a value from the client store. | ||
|
||
Example: | ||
```lua | ||
local theme = clientStore.get("theme") | ||
print("Current theme: " .. theme) | ||
``` | ||
|
||
## clientStore.del(key) | ||
Deletes a value from the client store. | ||
|
||
Example: | ||
```lua | ||
clientStore.del("theme") | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Datastore API | ||
|
||
The Datastore API provides functions for interacting with a key-value store that has query capabilities. | ||
|
||
## Key-Value Operations | ||
|
||
### datastore.set(key, value) | ||
Sets a value in the key-value store. | ||
|
||
Example: | ||
```lua | ||
datastore.set("user:123", {name = "John", age = 30}) | ||
``` | ||
|
||
### datastore.get(key) | ||
Gets a value from the key-value store. | ||
|
||
Example: | ||
```lua | ||
local user = datastore.get("user:123") | ||
print(user.name) -- prints "John" | ||
``` | ||
|
||
### datastore.del(key) | ||
Deletes a value from the key-value store. | ||
|
||
Example: | ||
```lua | ||
datastore.del("user:123") | ||
``` | ||
|
||
## Batch Operations | ||
|
||
### datastore.batch_set(kvs) | ||
Sets multiple key-value pairs in a single operation. | ||
|
||
Example: | ||
```lua | ||
local kvs = { | ||
{key = "user:1", value = {name = "Alice"}}, | ||
{key = "user:2", value = {name = "Bob"}} | ||
} | ||
datastore.batch_set(kvs) | ||
``` | ||
|
||
### datastore.batch_get(keys) | ||
Gets multiple values in a single operation. | ||
|
||
Example: | ||
```lua | ||
local keys = {"user:1", "user:2"} | ||
local values = datastore.batch_get(keys) | ||
for _, value in ipairs(values) do | ||
print(value.name) | ||
end | ||
``` | ||
|
||
### datastore.batch_del(keys) | ||
Deletes multiple values in a single operation. | ||
|
||
Example: | ||
```lua | ||
local keys = {"user:1", "user:2"} | ||
datastore.batch_del(keys) | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Debug API | ||
|
||
The Debug API provides functions for debugging and resetting the application state. | ||
|
||
## debug.reset_client() | ||
Completely wipes the client state, including cached files and databases. | ||
|
||
Example: | ||
```lua | ||
debug.reset_client() | ||
print("Client state has been reset") | ||
``` | ||
|
||
## debug.cleanup() | ||
Wipes the entire state KV store and the entire space KV store. | ||
|
||
Example: | ||
```lua | ||
debug.cleanup() | ||
print("All KV stores have been wiped") | ||
``` |
Oops, something went wrong.