Skip to content

Commit

Permalink
Add: Placeholder for bulk import/export tools
Browse files Browse the repository at this point in the history
  • Loading branch information
ashvardanian committed Oct 16, 2022
1 parent 77bf191 commit 7a91352
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/ukv/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ typedef void* ukv_arena_t;
typedef uint8_t* ukv_bytes_ptr_t;
typedef uint8_t const* ukv_bytes_cptr_t;

typedef void* ukv_callback_payload_t;
typedef void (*ukv_callback_t)(ukv_callback_payload_t);

typedef enum {

ukv_options_default_k = 0,
Expand Down
1 change: 1 addition & 0 deletions tools/dataset.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

99 changes: 99 additions & 0 deletions tools/dataset.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@

#pragma once

#ifdef __cplusplus
extern "C" {
#endif

#include <ukv/db.h>

typedef struct ukv_graph_import_t {

ukv_database_t db;
ukv_error_t* error;
ukv_arena_t* arena = NULL;
ukv_options_t options = ukv_options_default_k;

ukv_collection_t collection = ukv_collection_main_k;
ukv_str_view_t paths_pattern = ".*\.(csv|ndjson|parquet)";
ukv_size_t max_batch_size = 1024ul * 1024ul * 1024ul;
ukv_callback_t callback = NULL;
ukv_callback_payload_t callback_payload = NULL;

ukv_str_view_t source_id_field = "source";
ukv_str_view_t target_id_field = "target";
ukv_str_view_t edge_id_field = "edge";

} ukv_graph_import_t;

void ukv_graph_import(ukv_graph_import_t*);

typedef struct ukv_graph_export_t {

ukv_database_t db;
ukv_error_t* error;
ukv_arena_t* arena = NULL;
ukv_options_t options = ukv_options_default_k;

ukv_collection_t collection = ukv_collection_main_k;
ukv_str_view_t paths_extension = ".parquet";
ukv_size_t max_batch_size = 1024ul * 1024ul * 1024ul;
ukv_callback_t callback = NULL;
ukv_callback_payload_t callback_payload = NULL;

ukv_str_view_t source_id_field = "source";
ukv_str_view_t target_id_field = "target";
ukv_str_view_t edge_id_field = "edge";

} ukv_graph_export_t;

void ukv_graph_export(ukv_graph_export_t*);

typedef struct ukv_docs_import_t {

ukv_database_t db;
ukv_error_t* error;
ukv_arena_t* arena = NULL;
ukv_options_t options = ukv_options_default_k;

ukv_collection_t collection = ukv_collection_main_k;
ukv_str_view_t paths_pattern = ".*\.(csv|ndjson|parquet)";
ukv_size_t max_batch_size = 1024ul * 1024ul * 1024ul;
ukv_callback_t callback = NULL;
ukv_callback_payload_t callback_payload = NULL;

ukv_size_t fields_count = 0;
ukv_str_view_t const* fields = NULL;
ukv_size_t fields_stride = 0;

ukv_str_view_t id_field = "_id";

} ukv_docs_import_t;

void ukv_docs_import(ukv_docs_import_t*);

typedef struct ukv_docs_export_t {

ukv_database_t db;
ukv_error_t* error;
ukv_arena_t* arena = NULL;
ukv_options_t options = ukv_options_default_k;

ukv_collection_t collection = ukv_collection_main_k;
ukv_str_view_t paths_extension = ".parquet";
ukv_size_t max_batch_size = 1024ul * 1024ul * 1024ul;
ukv_callback_t callback = NULL;
ukv_callback_payload_t callback_payload = NULL;

ukv_size_t fields_count = 0;
ukv_str_view_t const* fields = NULL;
ukv_size_t fields_stride = 0;

} ukv_docs_export_t;

void ukv_docs_export(ukv_docs_export_t*);

#ifdef __cplusplus
} /* end extern "C" */
#endif

0 comments on commit 7a91352

Please sign in to comment.