redict/tests/unit/moduleapi
Oran Agra eef9c6b0ee
New detailed key-spec flags (RO, RW, OW, RM, ACCESS, UPDATE, INSERT, DELETE) (#10122)
The new ACL key based permissions in #9974 require the key-specs (#8324) to have more
explicit flags rather than just READ and WRITE. See discussion in #10040

This PR defines two groups of flags:
One about how redis internally handles the key (mutually-exclusive).
The other is about the logical operation done from the user's point of view (3 mutually exclusive
write flags, and one read flag, all optional).
In both groups, if we can't explicitly flag something as explicit read-only, delete-only, or
insert-only, we flag it as `RW` or `UPDATE`.
here's the definition from the code:
```
/* Key-spec flags *
 * -------------- */
/* The following refer what the command actually does with the value or metadata
 * of the key, and not necessarily the user data or how it affects it.
 * Each key-spec may must have exaclty one of these. Any operation that's not
 * distinctly deletion, overwrite or read-only would be marked as RW. */
#define CMD_KEY_RO (1ULL<<0)     /* Read-Only - Reads the value of the key, but
                                  * doesn't necessarily returns it. */
#define CMD_KEY_RW (1ULL<<1)     /* Read-Write - Modifies the data stored in the
                                  * value of the key or its metadata. */
#define CMD_KEY_OW (1ULL<<2)     /* Overwrite - Overwrites the data stored in
                                  * the value of the key. */
#define CMD_KEY_RM (1ULL<<3)     /* Deletes the key. */
/* The follwing refer to user data inside the value of the key, not the metadata
 * like LRU, type, cardinality. It refers to the logical operation on the user's
 * data (actual input strings / TTL), being used / returned / copied / changed,
 * It doesn't refer to modification or returning of metadata (like type, count,
 * presence of data). Any write that's not INSERT or DELETE, would be an UPADTE.
 * Each key-spec may have one of the writes with or without access, or none: */
#define CMD_KEY_ACCESS (1ULL<<4) /* Returns, copies or uses the user data from
                                  * the value of the key. */
#define CMD_KEY_UPDATE (1ULL<<5) /* Updates data to the value, new value may
                                  * depend on the old value. */
#define CMD_KEY_INSERT (1ULL<<6) /* Adds data to the value with no chance of,
                                  * modification or deletion of existing data. */
#define CMD_KEY_DELETE (1ULL<<7) /* Explicitly deletes some content
                                  * from the value of the key. */
```

Unrelated changes:
- generate-command-code.py is only compatible with python3 (modified the shabang)
- generate-command-code.py print file on json parsing error
- rename `shard_channel` key-spec flag to just `channel`.
- add INCOMPLETE flag in input spec of SORT and SORT_RO
2022-01-18 16:00:00 +02:00
..
aclcheck.tcl Adding ACL support for modules (#9309) 2021-09-23 08:52:56 +03:00
auth.tcl Fixed some typos, add a spell check ci and others minor fix (#8890) 2021-06-10 15:39:33 +03:00
basics.tcl Protected configs and sensitive commands (#9920) 2021-12-19 10:46:16 +02:00
blockedclient.tcl Fix module blocked clients RESP version (#9634) 2021-10-21 14:01:10 +03:00
blockonbackground.tcl Changed latency histogram output to omit trailing 0s and periods (#10075) 2022-01-09 17:04:18 -08:00
blockonkeys.tcl Test that module can wake up module blocked on non-empty list key (#8382) 2021-01-22 16:19:37 +02:00
cluster.tcl fix new cluster tests issues (#9657) 2021-10-20 15:40:28 +03:00
commandfilter.tcl Remove const from CommandFilterArgGet result (#9247) 2021-08-01 11:29:32 +03:00
datatype2.tcl Tests: don't rely on the response of MEMORY USAGE when mem_allocator is not jemalloc (#10010) 2021-12-27 21:37:21 +02:00
datatype.tcl Modules: add RM_LoadDataTypeFromStringEncver (#9537) 2021-09-30 11:21:32 +03:00
defrag.tcl Tests: fix new defrag test to be skipped when not supported (#8185) 2020-12-14 11:13:46 +02:00
eventloop.tcl Add event loop support to the module API (#10001) 2022-01-18 13:10:07 +02:00
fork.tcl Set errno to EEXIST in redisFork() if child process exists (#10059) 2022-01-06 09:54:21 +02:00
getkeys.tcl Auto-generate the command table from JSON files (#9656) 2021-12-15 21:23:15 +02:00
hash.tcl Modules: In RM_HashSet, add COUNT_ALL flag and set errno (#8446) 2021-02-15 11:40:05 +02:00
hooks.tcl Set repl-diskless-sync to yes by default, add repl-diskless-sync-max-replicas (#10092) 2022-01-17 14:11:11 +02:00
infotest.tcl Escape unsafe field name characters in INFO. (#8492) 2021-02-15 17:08:53 +02:00
infra.tcl add test for modules load/unload and config rewrite 2021-06-01 13:43:48 +03:00
keyspace_events.tcl Modules: adding a module type for key space notification (#8759) 2021-04-19 21:33:26 +03:00
keyspecs.tcl New detailed key-spec flags (RO, RW, OW, RM, ACCESS, UPDATE, INSERT, DELETE) (#10122) 2022-01-18 16:00:00 +02:00
list.tcl Modules: Add remaining list API functions (#8439) 2021-09-14 17:48:06 +03:00
misc.tcl Added RM_MonotonicMicroseconds() API to provide monotonic time function (#10101) 2022-01-13 11:36:03 +02:00
propagate.tcl use startEvictionTimeProc() in config set maxmemory (#10019) 2022-01-04 13:08:10 +02:00
reply.tcl fix valgrind issues with long double module test (#9709) 2021-11-01 13:41:35 +02:00
scan.tcl Fix RM_ScanKey module api not to return int encoded strings 2020-06-14 11:20:15 +03:00
stream.tcl Add modules API for streams (#8288) 2021-01-28 16:19:43 +02:00
subcommands.tcl New detailed key-spec flags (RO, RW, OW, RM, ACCESS, UPDATE, INSERT, DELETE) (#10122) 2022-01-18 16:00:00 +02:00
test_lazyfree.tcl Sort out mess around propagation and MULTI/EXEC (#9890) 2021-12-23 00:03:48 +02:00
testrdb.tcl Wait for asyn_loading to stop in short read test (#9841) 2021-11-24 12:46:43 +02:00
timer.tcl Add timer module API tests. (#8041) 2020-11-11 22:57:33 +02:00
zset.tcl RM_ZsetRem: Delete key if empty (#8453) 2021-02-05 19:54:01 +02:00