mirror of
https://github.com/aziascreations/BakaShrot.git
synced 2026-11-23 20:58:46 +01:00
e044fcf359
The rewrite's plan and decisions are in revamp.md. Steps 0 to 10 are done: the workspace and checks, bakashrot-proto, bakashrot-pki and bakashrot-cert, bakashrot-config, bakashrot-storage (schema v9), the server and the client library (every request but replication's, attachments and retention included), the C DLL with its C, PureBasic and Python bindings, and the bakashrot tool. Step 11 (replication) is next. OldSource/ is the old implementation, kept building and passing as the reference. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RwFeVTGs2SsufaH6zquzcb
76 lines
1.9 KiB
Plaintext
76 lines
1.9 KiB
Plaintext
;{- Code Header
|
|
; ==- Basic Info -================================
|
|
; Name: BenchServer.pb
|
|
; Version: 0.0.1
|
|
; Author: Herwin Bozet (NibblePoker)
|
|
;
|
|
; ==- Compatibility -=============================
|
|
; Tested compiler versions:
|
|
; * PureBasic 5.73 LTS (Windows x64, Linux x64)
|
|
; * PureBasic 6.40 C Backend (Windows x64)
|
|
; * PureBasic 6.41 (Linux x64)
|
|
; * PureBasic 6.41 C Backend (Linux x64)
|
|
;
|
|
; ==- Links -=====================================
|
|
; GitHub: https://github.com/aziascreations/BakaShrot
|
|
;}
|
|
|
|
; ============================================================================
|
|
; BakaShrot Bench Server
|
|
;
|
|
; Usage: BenchServer <ConfigFile> <StopFile>
|
|
;
|
|
; The real server (Server/Root.pbi), without the console commands: it runs
|
|
; until StopFile exists, then stops its workers cleanly and exits.
|
|
; BakaShrot_Server.exe can't run headless, with no console input its
|
|
; Input() returns Chr(4) and it stops right away, see Notes.md.
|
|
;
|
|
; Used by Tests/Bench/Bench-Replication.ps1, compile as a thread-safe console
|
|
; program.
|
|
; ============================================================================
|
|
|
|
EnableExplicit
|
|
|
|
XIncludeFile "../../Server/Root.pbi"
|
|
|
|
|
|
Define Root.BakaShrot_Root
|
|
Define StopFile.s
|
|
|
|
OpenConsole("BakaShrot Bench Server")
|
|
|
|
If CountProgramParameters() < 2
|
|
PrintN("Usage: BenchServer <ConfigFile> <StopFile>")
|
|
End 1
|
|
EndIf
|
|
|
|
Root\ConfigPath = ProgramParameter(0)
|
|
StopFile = ProgramParameter(1)
|
|
|
|
If Not BakaShrot_Root_LoadConfig(@Root)
|
|
End 1
|
|
EndIf
|
|
|
|
If Not BakaShrot_Root_OpenDatabase(@Root)
|
|
FreeConfig(Root\Config)
|
|
End 1
|
|
EndIf
|
|
|
|
If Not BakaShrot_Root_StartWorkers(@Root)
|
|
BakaShrot_Root_CloseDatabase(@Root)
|
|
FreeConfig(Root\Config)
|
|
End 1
|
|
EndIf
|
|
|
|
PrintN("Running until '" + StopFile + "' exists.")
|
|
|
|
While FileSize(StopFile) < 0
|
|
Delay(200)
|
|
Wend
|
|
|
|
PrintN("Stopping...")
|
|
BakaShrot_Root_StopWorkers(@Root)
|
|
BakaShrot_Root_CloseDatabase(@Root)
|
|
FreeConfig(Root\Config)
|
|
End 0
|