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

Protocol 6: node identities, error codes, Synchronous, schema v8, examples

- Protocol 5: a client authenticates as a node (Node), its pushes go to the
  section's DefaultTopic unless they name one; old Identities refused at
  start with what to write instead.
- Topics listed by name, ids picked and kept by the server; nodes come from
  client sections, [BakaShrot.Nodes] optional, AcceptNodes = * by default.
- Protocol 6: every refusal carries a code, every client failure too
  (BakaShrot_ErrorCodes.pbi, BakaShrot_GetLastError(), ErrorCode in Python);
  nothing reconnects by itself, delivery is at least once.
- [BakaShrot.Server] Synchronous = FULL (default) or NORMAL, benchmarked.
- Schema v8: browse table and browse_messages view for database tools.
- Tools renamed BakaShrot<Name>, wait for Enter when started from Explorer.
- Examples/SingleServer: a server and a client with scripts (example keys,
  public on purpose).
- Restart-Test.ps1: servers killed mid-traffic and mid-catch-up.
- Docs: one server per node rule, DatabaseError() checked per thread,
  release notes' Compatibility section, Notes "Right now".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RwFeVQrLqMQPw9AZnsHqQH
This commit is contained in:
2026-11-09 23:57:55 +01:00
parent df61ef9719
commit 488ffe4bc8
67 changed files with 3163 additions and 1029 deletions
@@ -0,0 +1,69 @@
; ============================================================================
; BakaShrotResolveIds
;
; Usage: BakaShrotResolveIds <topic|node> <NameOrId> [ClientIni]
; topic|node What to look up.
; NameOrId A name, to get its id on the server, or an id, to get its name.
; ClientIni Identity and server to use, defaults to "client.ini".
;
; Prints the server's id and name for it, as "topic logs = 1". Each server
; can have different ids for the same names. The server only resolves the
; topics the client may push to or read, unless it may query.
; Compile as a console program, exits with 0 on success, 1 on failure.
; ============================================================================
EnableExplicit
XIncludeFile "../Common/ToolClient.pbi"
XIncludeFile "../../Commons/Networking/Names.pbi"
Define Kind.s, Ref.s, IniPath.s, Id.l, Name.s
OpenConsole()
If CountProgramParameters() < 2
PrintN("Usage: BakaShrotResolveIds <topic|node> <NameOrId> [ClientIni]")
ToolConsole_End(1)
EndIf
Kind = LCase(ProgramParameter(0))
If Kind <> "topic" And Kind <> "node"
PrintN("Expected 'topic' or 'node', not '" + ProgramParameter(0) + "'")
ToolConsole_End(1)
EndIf
Ref = ProgramParameter(1)
If Not BakaShrot_IsValidRef(Ref)
PrintN("Invalid " + Kind + " '" + Ref + "', expected a name or an id 0-65535")
ToolConsole_End(1)
EndIf
IniPath = "client.ini"
If CountProgramParameters() > 2
IniPath = ProgramParameter(2)
EndIf
If Not ToolClient_Connect(IniPath)
ToolConsole_End(1)
EndIf
If Kind = "topic"
Id = BakaShrot_ResolveTopic(Ref)
Else
Id = BakaShrot_ResolveNode(Ref)
EndIf
If Id < 0
ToolClient_PrintFailure()
ToolClient_Close()
ToolConsole_End(1)
EndIf
Name = BakaShrot_GetResolvedNameString()
If Name = ""
Name = "(unnamed)"
EndIf
PrintN(Kind + " " + Name + " = " + Str(Id))
ToolClient_Close()
ToolConsole_End(0)