Sessions and object stores
- group Sessions and object stores
Reusable session caches and custom object-store registries.
Functions
-
LanceDBSession *lancedb_session_new(const LanceDBSessionOptions *options)
Create a new session.
The returned session must be freed with lancedb_session_free(). A session can be attached to an embedded connection with lancedb_connect_builder_session(); Enterprise (db://) connections reject custom sessions when the builder is executed.
- Parameters:
options – - pointer to LanceDBSessionOptions, or NULL for defaults
- Returns:
Non-null pointer to LanceDBSession on success, NULL on failure
-
LanceDBSession *lancedb_session_new_with_registry(const LanceDBSessionOptions *options, const LanceDBObjectStoreRegistry *registry)
Create a new session with a custom ObjectStoreRegistry.
The registry must be created using “lancedb_registry_new()” API
When registry is non-NULL, this function takes ownership of it and it will be released when the session is freed.
If registry is NULL, a default ObjectStoreRegistry is created internally.
The returned session must be freed with lancedb_session_free().
- Parameters:
options – - pointer to LanceDBSessionOptions, or NULL for defaults
registry – - pointer to LanceDBObjectStoreRegistry, or NULL to use a default registry.
- Returns:
Non-null pointer to LanceDBSession on success, NULL on failure
-
LanceDBObjectStoreRegistry *lancedb_registry_new(void)
Create a new ObjectStoreRegistry.
Creates a new registry with default ObjectStore providers (local filesystem, S3, etc.). After creation, custom providers can be registered which can even override the default ones for existing scheme using “lancedb_registry_insert_provider()”
If the registry created is passed to a session, ownership will be transferred
If NOT passed to a session, it must be freed with lancedb_registry_free()
- Returns:
Non-null pointer to LanceDBObjectStoreRegistry on success, NULL on failure
-
void lancedb_registry_free(LanceDBObjectStoreRegistry *registry)
Free an ObjectStoreRegistry.
Only call this if the registry was NOT passed to any session. If the registry was passed to a session, the session owns it and will free it.
- Parameters:
registry – - pointer to LanceDBObjectStoreRegistry to free
-
LanceDBError lancedb_registry_insert_provider(LanceDBObjectStoreRegistry *registry, const char *scheme, LanceDBObjectStoreProvider *provider, char **error_message)
Insert or override an ObjectStoreProvider into an ObjectStoreRegistry for a given URL scheme.
If error_message is provided and an error occurs, the caller must free the error message with lancedb_free_string().
- Parameters:
registry – - pointer to LanceDBObjectStoreRegistry
scheme – - URL scheme to register the provider for (e.g., “s3”)
provider – - pointer to LanceDBObjectStoreProvider. Ownership is transferred to the registry; do not free the provider after this call.
error_message – - optional pointer to receive detailed error message (NULL to ignore)
- Returns:
0 on success, -1 on failure
-
void lancedb_object_store_provider_free(LanceDBObjectStoreProvider *provider)
Free an ObjectStoreProvider.
Only call this if the provider was NOT passed to lancedb_registry_insert_provider(). If the provider was inserted into a registry, the registry owns it.
- Parameters:
provider – - pointer to LanceDBObjectStoreProvider to free
-
LanceDBError lancedb_session_index_cache_stats(const LanceDBSession *session, LanceDBSessionCacheStats *out_stats, char **error_message)
Get index cache stats for a session.
If error_message is provided and an error occurs, the caller must free the error message with lancedb_free_string().
- Parameters:
session – - pointer to LanceDBSession
out_stats – - pointer to receive session cache statistics
error_message – - optional pointer to receive detailed error message (NULL to ignore)
- Returns:
Error code indicating success or failure
-
LanceDBError lancedb_session_metadata_cache_stats(const LanceDBSession *session, LanceDBSessionCacheStats *out_stats, char **error_message)
Get metadata cache stats for a session.
If error_message is provided and an error occurs, the caller must free the error message with lancedb_free_string().
- Parameters:
session – - pointer to LanceDBSession
out_stats – - pointer to receive session cache statistics
error_message – - optional pointer to receive detailed error message (NULL to ignore)
- Returns:
Error code indicating success or failure
-
void lancedb_session_free(LanceDBSession *session)
Free a Session.
After calling this function, the session pointer must not be used.
- Parameters:
session – - pointer to LanceDBSession
-
LanceDBSession *lancedb_session_new(const LanceDBSessionOptions *options)