CommitDatabaseServer

class dsviper.CommitDatabaseServer(database_path, socket, logging, cancelation)

Bases: object

A CommitDatabaseServer provides network access to a CommitDatabase.

WARNING – the server serves each client on a C++ thread that runs outside the GIL. Nothing reachable from it may call back into Python. logging therefore accepts only the C++ loggers – LoggerConsole, LoggerNull, LoggerReport – and raises TypeError on LoggerPrint or Logging.create(…), which would execute Python code without holding the GIL.

finish() → None

Block until every client thread has answered the cancelation request.

finish_before(timeout_in_sec: int) → int

Stop serving and wait up to timeout_in_sec for the client threads. Return the number that were still running, zero when all of them ended.

start() → None

Listen on the server socket, without blocking.

step() then accepts the clients one round at a time.

step(timeout_in_sec: int = 1) → bool

Accept the connections waiting, for at most timeout_in_sec.

Returns False once the server has stopped, so a loop can end on it.