File python_callbacks.h

struct PyCallbackIOWriter : public faiss::IOWriter

Public Functions

explicit PyCallbackIOWriter(PyObject *callback, size_t bs = 1024 * 1024)

Callback: Python function that takes a bytes object and returns the number of bytes successfully written.

virtual size_t operator()(const void *ptrv, size_t size, size_t nitems) override
~PyCallbackIOWriter() override

Public Members

PyObject *callback
size_t bs
struct PyCallbackIOReader : public faiss::IOReader

Public Functions

explicit PyCallbackIOReader(PyObject *callback, size_t bs = 1024 * 1024)

Callback: Python function that takes a size and returns a bytes object with the resulting read

virtual size_t operator()(void *ptrv, size_t size, size_t nitems) override
~PyCallbackIOReader() override

Public Members

PyObject *callback
size_t bs
struct PyCallbackIDSelector : public faiss::IDSelector

Public Functions

explicit PyCallbackIDSelector(PyObject *callback)
virtual bool is_member(faiss::idx_t id) const override
~PyCallbackIDSelector() override

Public Members

PyObject *callback