Embedding Oxia
Besides running as dedicated oxia server / oxia coordinator processes, Oxia can be embedded as a library
inside a Go application, so that each application node hosts an Oxia data server (and, on some nodes, the
coordinator) in the same binary:
import (
"github.com/oxia-db/oxia/oxiad/dataserver"
"github.com/oxia-db/oxia/oxiad/dataserver/option"
)
options := option.NewDefaultOptions()
options.Storage.Database.Dir = "./data/db"
options.Storage.WAL.Dir = "./data/wal"
server, err := dataserver.New(ctx, options)These are the same entry points the oxia binary itself is built on. See the
dataserver package documentation for
embedding a data server or a standalone single-node server, and the
coordinator package documentation for
bootstrapping a whole cluster in-process with coordinator.New and for choosing its metadata provider.
Caveats
Embedded servers share process-global state (the OpenTelemetry meter provider, the Prometheus registry and the log level), and a failure to serve gRPC or metrics, or a fatal storage error, still terminates the host process.