Skip to content

Is it possible to avoid Close() + Reopen() for a clean Database which is opened for only TP service? #740

Description

@zhanglei1949

Currently we require any opened database to be closed and reopened before service TP queries.

database->Close();

However, for those users which simply open a large database for serving TP queries, the close and reopen is not necessary.
Could we provide some interface on python client like

from neug import load_and_serve

server = load_and_serve(
    db_path="/path/to/database",
    host="127.0.0.1",
    port=10000,
    blocking=False,
    max_thread_num=0,
    thread_num=0,
    buffer_strategy="M_FULL",
)

print(server.endpoint)
server.stop()

Which returns a Server handle.

class DatabaseServer:
    @property
    def endpoint(self):
        ...

    def stop(self):
        ...

    def close(self):
        ...

    def __enter__(self):
        return self

    def __exit__(self, exc_type, exc, tb):
        self.close()

We could also let Database.serve() return the same handle.

Metadata

Metadata

Assignees

Labels

clientClient bindings

Type

Projects

Status
To do

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions