Skip to content

Commit 8e3efde

Browse files
committed
Fix file paths and escape angular brackets
1 parent fcd69bc commit 8e3efde

File tree

23 files changed

+369
-83
lines changed

23 files changed

+369
-83
lines changed

doc.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
cd docbuilder && cargo run
1+
cd docbuilder && cargo build
2+
cd -
3+
./docbuilder/target/debug/docbuilder

docbuilder/src/document.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ impl Document {
4545
return_ty,
4646
description,
4747
} = self;
48+
49+
let description = description.replace('<', "&lt;");
50+
let description = description.replace('>', "&gt;");
4851
let path = format!("docs/actions/{}.md", action_name);
4952
let syntax_rendered = render_list(syntax);
5053
let returns_rendered = render_link_list(return_ty, linklist);
@@ -86,16 +89,15 @@ title: {title}
8689

8790
fn render_list(inp: Vec<String>) -> String {
8891
inp.into_iter()
89-
.map(|v| format!("- {}\n", v).chars().collect::<Vec<_>>())
92+
.map(|v| format!("- `{}`\n", v).chars().collect::<Vec<_>>())
9093
.flatten()
9194
.collect()
9295
}
9396

9497
fn render_link_list(inp: Vec<String>, linklist: &HashMap<&'static str, &'static str>) -> String {
9598
inp.into_iter()
9699
.map(|v| {
97-
println!("looking for: {}", v);
98-
format!("- [{}]({})\n", v, linklist.get(v.as_str()).unwrap())
100+
format!("- [{}](../{})\n", v, linklist.get(v.as_str()).unwrap())
99101
.chars()
100102
.collect::<Vec<_>>()
101103
})

docbuilder/src/main.rs

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ fn parse_into_actiondoc(output: Cow<'_, str>) {
4848
for map in yml.iter() {
4949
let name = getstr!(map, "name");
5050
let complexity = getstr!(map, "complexity");
51-
println!("{:?}", map.get("accept").unwrap());
5251
let accept_ty = get_str_array!(map, "accept");
5352
let return_ty = get_str_array!(map, "return");
5453
let syntax = get_str_array!(map, "syntax");
@@ -97,29 +96,32 @@ Skytable currently supports the following actions:
9796

9897
pub fn init_type_linklist() -> HashMap<&'static str, &'static str> {
9998
let mut hm = HashMap::new();
100-
hm.insert("Rcode 0", "protocol/response-codes");
101-
hm.insert("Rcode 1", "protocol/response-codes");
102-
hm.insert("Rcode 2", "protocol/response-codes");
103-
hm.insert("Rcode 3", "protocol/response-codes");
104-
hm.insert("Rcode 4", "protocol/response-codes");
105-
hm.insert("Rcode 5", "protocol/response-codes");
106-
hm.insert("Rcode 6", "protocol/response-codes");
107-
hm.insert("Rcode 7", "protocol/response-codes");
108-
hm.insert("Rcode 8", "protocol/response-codes");
109-
hm.insert("Rcode 9", "protocol/response-codes");
110-
hm.insert("Error String", "protocol/errors#table-of-errors");
111-
hm.insert("err-snapshot-busy", "protocol/errors/#table-of-errors");
99+
hm.insert("Rcode 0", "../protocol/response-codes");
100+
hm.insert("Rcode 1", "../protocol/response-codes");
101+
hm.insert("Rcode 2", "../protocol/response-codes");
102+
hm.insert("Rcode 3", "../protocol/response-codes");
103+
hm.insert("Rcode 4", "../protocol/response-codes");
104+
hm.insert("Rcode 5", "../protocol/response-codes");
105+
hm.insert("Rcode 6", "../protocol/response-codes");
106+
hm.insert("Rcode 7", "../protocol/response-codes");
107+
hm.insert("Rcode 8", "../protocol/response-codes");
108+
hm.insert("Rcode 9", "../protocol/response-codes");
109+
hm.insert("Error String", "../protocol/errors#table-of-errors");
110+
hm.insert("err-snapshot-busy", "../protocol/errors/#table-of-errors");
112111
hm.insert(
113112
"err-invalid-snapshot-name",
114-
"protocol/errors/#table-of-errors",
113+
"../protocol/errors/#table-of-errors",
115114
);
116-
hm.insert("err-snapshot-disabled", "protocol/errors/#table-of-errors");
117-
hm.insert("AnyArray", "protocol/data-types#any-array");
118-
hm.insert("Flat Array", "protocol/data-types#flat-array");
119-
hm.insert("Typed Array", "protocol/data-types#typed-array");
120-
hm.insert("String", "skyhash#strings-");
121-
hm.insert("Binstr", "skyhash#strings-");
122-
hm.insert("Integer", "skyhash#unsigned-integers-");
115+
hm.insert(
116+
"err-snapshot-disabled",
117+
"../protocol/errors/#table-of-errors",
118+
);
119+
hm.insert("AnyArray", "../protocol/data-types#any-array");
120+
hm.insert("Flat Array", "../protocol/data-types#flat-array");
121+
hm.insert("Typed Array", "../protocol/data-types#typed-array");
122+
hm.insert("String", "../protocol/skyhash#strings-");
123+
hm.insert("Binstr", "../protocol/skyhash#strings-");
124+
hm.insert("Integer", "../protocol/skyhash#unsigned-integers-");
123125
hm
124126
}
125127

docs/6.all-actions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Skytable currently supports the following actions:
1414
- [LSKEYS](actions/LSKEYS.md)
1515
- [MGET](actions/MGET.md)
1616
- [MKSNAP](actions/MKSNAP.md)
17+
- [MPOP](actions/MPOP.md)
1718
- [MSET](actions/MSET.md)
1819
- [MUPDATE](actions/MUPDATE.md)
1920
- [POP](actions/POP.md)

docs/actions/DBSIZE.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,22 @@
22
id: dbsize
33
title: DBSIZE
44
---
5+
56
:::note About
67
**Time complexity**: O(1)
7-
**Arguments**: `DBSIZE`
8-
**Returns**: Number of keys that exist in the database as an unsigned int
8+
**Accept type**:
9+
10+
- [AnyArray](../../protocol/data-types#any-array)
11+
12+
**Return type**:
13+
14+
- [Integer](../../protocol/skyhash#unsigned-integers-)
15+
16+
**Syntax**:
17+
18+
- `DBSIZE`
19+
- `DBSIZE <entity>`
20+
921
:::
10-
Number of key/value pairs stored in the database
22+
23+
Check the number of entries stored in the current table or in the provided entity

docs/actions/DEL.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,22 @@
22
id: del
33
title: DEL
44
---
5+
56
:::note About
67
**Time complexity**: O(n)
7-
**Arguments**: `DEL <key1> <key2> ...`
8-
**Returns**: Number of keys that were deleted as an unsigned int
8+
**Accept type**:
9+
10+
- [AnyArray](../../protocol/data-types#any-array)
11+
12+
**Return type**:
13+
14+
- [Integer](../../protocol/skyhash#unsigned-integers-)
15+
- [Rcode 5](../../protocol/response-codes)
16+
17+
**Syntax**:
18+
19+
- `DEL <key1> <key2> ...`
20+
921
:::
10-
Delete 'n' keys
22+
23+
Delete 'n' keys from the current table

docs/actions/EXISTS.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,21 @@
22
id: exists
33
title: EXISTS
44
---
5+
56
:::note About
67
**Time complexity**: O(n)
7-
**Arguments**: `EXISTS <key1> <key2> ...`
8-
**Returns**: Number of keys that exist as an unsigned int
8+
**Accept type**:
9+
10+
- [AnyArray](../../protocol/data-types#any-array)
11+
12+
**Return type**:
13+
14+
- [Integer](../../protocol/skyhash#unsigned-integers-)
15+
16+
**Syntax**:
17+
18+
- `EXISTS <key1> <key2> ...`
19+
920
:::
10-
Check if 'n' keys exist
21+
22+
Check if 'n' keys exist in the current table

docs/actions/FLUSHDB.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,23 @@
22
id: flushdb
33
title: FLUSHDB
44
---
5+
56
:::note About
67
**Time complexity**: O(n)
7-
**Arguments**: `FLUSHDB`
8-
**Returns**: (Code: 0) if the operation succeeded
8+
**Accept type**:
9+
10+
- [AnyArray](../../protocol/data-types#any-array)
11+
12+
**Return type**:
13+
14+
- [Rcode 0](../../protocol/response-codes)
15+
- [Rcode 5](../../protocol/response-codes)
16+
17+
**Syntax**:
18+
19+
- `FLUSHDB`
20+
- `FLUSHDB <entity>`
21+
922
:::
10-
Removes all the key/value pairs stored in the database
23+
24+
Removes all entries stored in the current table or in the provided entity

docs/actions/GET.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,23 @@
22
id: get
33
title: GET
44
---
5+
56
:::note About
67
**Time complexity**: O(1)
7-
**Arguments**: `GET <key>`
8-
**Returns**: Value if it exists or (Code: 1) if it does not
8+
**Accept type**:
9+
10+
- [AnyArray](../../protocol/data-types#any-array)
11+
12+
**Return type**:
13+
14+
- [Rcode 1](../../protocol/response-codes)
15+
- [String](../../protocol/skyhash#strings-)
16+
- [Binstr](../../protocol/skyhash#strings-)
17+
18+
**Syntax**:
19+
20+
- `GET <key>`
21+
922
:::
10-
Get the value of a key
23+
24+
Get the value of a key from the current table

docs/actions/KEYLEN.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,22 @@
22
id: keylen
33
title: KEYLEN
44
---
5+
56
:::note About
67
**Time complexity**: O(1)
7-
**Arguments**: `KEYLEN <key>`
8-
**Returns**: Length of the key as an unsigned int
8+
**Accept type**:
9+
10+
- [AnyArray](../../protocol/data-types#any-array)
11+
12+
**Return type**:
13+
14+
- [Integer](../../protocol/skyhash#unsigned-integers-)
15+
- [Rcode 1](../../protocol/response-codes)
16+
17+
**Syntax**:
18+
19+
- `KEYLEN <key>`
20+
921
:::
10-
Returns the length of the UTF-8 string
22+
23+
Returns the length of the UTF-8 string, if it exists in the current table

0 commit comments

Comments
 (0)