1
0
mirror of https://github.com/aziascreations/BakaShrot.git synced 2026-11-23 20:58:46 +01:00

Made the roles the only lists of topics, Refused PRAGMAs in queries

- Removed `[server] topics` and `[replication] replicated_topics`: a push
  is taken by its roles' `push_topics`, a replicated message by the
  peer's `accept_topics`; a topic exists from its first message.
- Topics that only came from a peer are read and listed like any other;
  `ListNames` lists the topics with messages, filtered by the roles.
- A push to a topic no role names is `NotAllowed`; `UnknownName` is only
  for nodes.
- Clients' queries: every PRAGMA refused as it's prepared (SQLite's
  authorizer), `PRAGMA query_only = 0` used to take effect.
- Noted the leads found by reading the code in `docs/known-issues.md`.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
2026-11-16 01:28:24 +01:00
parent cef99102f9
commit cf8264b21d
34 changed files with 304 additions and 227 deletions
@@ -12,7 +12,6 @@ listen = "127.0.0.1:0"
ca = "ca.crt"
certificate = "server.crt"
key = "server.key"
topics = ["logs", "secret"]
[roles.home]
push_topics = ["logs", "secret"]
+5 -4
View File
@@ -125,8 +125,8 @@ fn exports() {
-1
);
let (failed, why) = error();
assert_eq!(failed, code(ErrorCode::UnknownName));
assert!(why.contains("unknown topic"), "{why}");
assert_eq!(failed, code(ErrorCode::NotAllowed));
assert!(why.contains("may not push to 'nothing'"), "{why}");
// The latest; none yet in another topic.
assert_eq!(
@@ -199,10 +199,11 @@ fn exports() {
assert_eq!(bytes[1..3], [b'{', 0]);
// Names, queries.
assert_eq!(BakaShrot_ListTopics(), 2);
// Topics: those with messages (nothing in `secret` yet).
assert_eq!(BakaShrot_ListTopics(), 1);
assert_eq!(
get_w(BakaShrot_GetNamesListW),
r#"{"kind":"topic","names":["logs","secret"],"truncated":false}"#
r#"{"kind":"topic","names":["logs"],"truncated":false}"#
);
assert_eq!(BakaShrot_ListNodes(), 1);
assert_eq!(