Documentation
¶
Overview ¶
Package server executes off-thread database requests against a real SQLite database (plan item P3.5).
This is the half that links the engine. It imports db/sqlite, which imports ncruces/go-sqlite3, which embeds wazero — roughly a megabyte of wasm interpreter. Compiling this package into domain.wasm and NOT into app.wasm is the entire point of the split, and it is what criterion (b) checks.
A Server is single-threaded by construction, matching both the worker it runs in and the one-connection pool underneath it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LocalTransport ¶
type LocalTransport struct {
// contains filtered or unexported fields
}
LocalTransport runs a Server in-process, implementing offthread.Transport.
It exists so an app can develop and test against the off-thread API without a worker, and so criterion (c) — a mixed app using both models — has something to exercise. It is NOT the production path: running the server in-process puts the engine back on the calling thread, which is the thing being avoided.
func NewLocalTransport ¶
func NewLocalTransport(parseServer *Server) *LocalTransport
NewLocalTransport wraps a server as an in-process transport.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server answers offthread.Request against a SQLite database.
func (*Server) Handle ¶
func (parseServer *Server) Handle(parseCtx context.Context, parseRequest offthread.Request) offthread.Response
Handle executes one request and returns its response.
It never returns a Go error: every failure travels in Response.Err, because the response is what crosses the thread boundary. A transport that also returned an error would give the client two channels for the same failure and invite it to check only one.
func (*Server) OpenTransactionCount ¶
OpenTransactionCount reports how many transactions are open, for diagnostics and for tests asserting that failure paths do not leak them.