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,71 @@
; ============================================================================
; BakaShrotGetLatestMessage
;
; Usage: BakaShrotGetLatestMessage <Topic> <Node> [ClientIni]
; Topic, Node Whose latest message to get, each a name or an id.
; ClientIni Identity and server to use, defaults to "client.ini".
;
; Prints the latest message stored for that topic/node, and when it was
; pushed (UTC), its attachment if it has one (BakaShrotGetAttachment saves it), then
; its data. The server refuses
; if the client's ReadTopics don't allow the topic, if either is unknown, or
; if there's no message.
; Compile as a console program, exits with 0 on success, 1 on failure.
; ============================================================================
EnableExplicit
XIncludeFile "../Common/ToolClient.pbi"
XIncludeFile "../../Commons/Networking/Names.pbi"
Define Topic.s, Node.s, IniPath.s
OpenConsole()
If CountProgramParameters() < 2
PrintN("Usage: BakaShrotGetLatestMessage <Topic> <Node> [ClientIni]")
PrintN(" Topic and Node are names or ids.")
ToolConsole_End(1)
EndIf
Topic = ProgramParameter(0)
If Not BakaShrot_IsValidRef(Topic)
PrintN("Invalid topic '" + Topic + "', expected a name or an id 0-65535")
ToolConsole_End(1)
EndIf
Node = ProgramParameter(1)
If Not BakaShrot_IsValidRef(Node)
PrintN("Invalid node '" + Node + "', 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 Not BakaShrot_GetLatestMessageOf(Topic, Node)
ToolClient_PrintFailure()
ToolClient_Close()
ToolConsole_End(1)
EndIf
PrintN("Message " + BakaShrot_GetMessageTopicString() + ":" + BakaShrot_GetMessageNodeString() + "#" + Str(BakaShrot_GetMessageId()) +
" (ids " + Str(BakaShrot_GetMessageTopicId()) + ":" + Str(BakaShrot_GetMessageNodeId()) + "), pushed " + ToolClient_FormatUtc(BakaShrot_GetMessagePushedAt()))
If BakaShrot_GetMessageAttachmentSize() > 0
If BakaShrot_IsMessageAttachmentReady()
PrintN("Attachment: " + Str(BakaShrot_GetMessageAttachmentSize()) + " bytes")
Else
PrintN("Attachment: " + Str(BakaShrot_GetMessageAttachmentSize()) + " bytes, not on this server yet")
EndIf
EndIf
PrintN(BakaShrot_GetMessageDataString())
ToolClient_Close()
ToolConsole_End(0)