1#![allow(non_camel_case_types)]
40
41use std::ffi::{c_char, c_void};
42
43pub type antfly_error_code = i32;
50
51pub const ANTFLY_OK: antfly_error_code = 0;
52pub const ANTFLY_INVALID_ARGUMENT: antfly_error_code = 1;
53pub const ANTFLY_NOT_FOUND: antfly_error_code = 2;
54pub const ANTFLY_VERSION_CONFLICT: antfly_error_code = 3;
55pub const ANTFLY_INTENT_CONFLICT: antfly_error_code = 4;
56pub const ANTFLY_TXN_NOT_FOUND: antfly_error_code = 5;
57pub const ANTFLY_BUSY: antfly_error_code = 6;
58pub const ANTFLY_OUTCOME_UNKNOWN: antfly_error_code = 7;
59pub const ANTFLY_UNSUPPORTED: antfly_error_code = 8;
60pub const ANTFLY_STALLED: antfly_error_code = 9;
61pub const ANTFLY_CANCELLED: antfly_error_code = 10;
64pub const ANTFLY_INTERNAL: antfly_error_code = 255;
65
66#[repr(C)]
75pub struct antfly_db {
76 _private: [u8; 0],
77}
78
79#[repr(C)]
90pub struct antfly_inference {
91 _private: [u8; 0],
92}
93
94#[repr(C)]
99#[derive(Copy, Clone, Debug)]
100pub struct antfly_inference_options {
101 pub abi_size: u32,
102 pub flags: u32,
104 pub models_dir: antfly_slice,
107 pub host_budget_mb: u32,
110 pub backend_budget_mb: u32,
111 pub process_memory_budget_mb: u32,
112 pub combined_budget_mb: u32,
113 pub kv_budget_mb: u32,
114 pub scratch_budget_mb: u32,
115 pub call_timeout_ms: u64,
117 pub reserved: [u64; 8],
118}
119
120#[repr(C)]
124#[derive(Copy, Clone, Debug)]
125pub struct antfly_inference_pull_progress {
126 pub abi_size: u32,
127 pub reserved0: u32,
128 pub model: antfly_slice,
130 pub file: antfly_slice,
131 pub bytes_downloaded: u64,
132 pub total_bytes: u64,
134 pub files_done: u64,
135 pub files_total: u64,
136 pub cached: bool,
138}
139
140pub type antfly_inference_pull_progress_fn = Option<
147 unsafe extern "C" fn(
148 context: *mut c_void,
149 progress: *const antfly_inference_pull_progress,
150 ) -> bool,
151>;
152
153pub type antfly_inference_stream_fn =
159 Option<unsafe extern "C" fn(context: *mut c_void, chunk_json: antfly_slice) -> bool>;
160
161pub type antfly_txn_status = u8;
169
170pub const ANTFLY_TXN_PENDING: antfly_txn_status = 0;
171pub const ANTFLY_TXN_COMMITTED: antfly_txn_status = 1;
172pub const ANTFLY_TXN_ABORTED: antfly_txn_status = 2;
173
174pub const ANTFLY_OUTCOME_RECEIPT_APPLIED: u8 = 1;
176pub const ANTFLY_OUTCOME_RECEIPT_NOT_APPLIED: u8 = 2;
178
179pub const ANTFLY_OPEN_MODE_WRITER: u32 = 0;
184pub const ANTFLY_OPEN_MODE_READONLY: u32 = 1;
185pub const ANTFLY_OPEN_MODE_STATUS_ONLY: u32 = 2;
186
187pub const ANTFLY_STORAGE_KIND_DIRECTORY: u32 = 0;
188pub const ANTFLY_STORAGE_KIND_LITE: u32 = 1;
189
190pub const ANTFLY_PROFILE_NATIVE: u32 = 0;
191pub const ANTFLY_PROFILE_HOSTED: u32 = 1;
192
193pub const ANTFLY_OPEN_FLAG_NO_SYNC: u32 = 1 << 0;
194pub const ANTFLY_OPEN_FLAG_TTL_CLEANUP: u32 = 1 << 1;
195pub const ANTFLY_OPEN_FLAG_REMOTE_PROVIDER_CONFIGURED: u32 = 1 << 2;
196pub const ANTFLY_OPEN_FLAG_LOCAL_RUNTIME_CONFIGURED: u32 = 1 << 3;
197pub const ANTFLY_OPEN_FLAG_GENERATED_ENRICHMENT_REPLAY: u32 = 1 << 4;
198
199pub const ANTFLY_INFERENCE_MODE_CALLER_SUPPLIED_OR_DISABLED: &str = "caller_supplied_or_disabled";
201pub const ANTFLY_INFERENCE_MODE_CALLER_SUPPLIED_ARTIFACTS: &str = "caller_supplied_artifacts";
202pub const ANTFLY_INFERENCE_MODE_REMOTE_PROVIDER: &str = "remote_provider";
203pub const ANTFLY_INFERENCE_MODE_LOCAL_EMBEDDED: &str = "local_embedded";
204pub const ANTFLY_INFERENCE_MODE_MANUAL_MAINTENANCE: &str = "manual_maintenance";
205pub const ANTFLY_INFERENCE_MODE_DISABLED_DEFERRED: &str = "disabled_deferred";
206
207pub const ANTFLY_THREADING_SERIALIZED: u32 = 1;
209
210pub const ANTFLY_MIN_THREAD_STACK_SIZE: usize = 8 * 1024 * 1024;
213
214pub const ANTFLY_GRAPH_DIRECTION_OUT: u8 = 0;
217pub const ANTFLY_GRAPH_DIRECTION_IN: u8 = 1;
218pub const ANTFLY_GRAPH_DIRECTION_BOTH: u8 = 2;
219
220#[repr(C)]
225#[derive(Copy, Clone, Debug)]
226pub struct antfly_slice {
227 pub ptr: *const u8,
228 pub len: usize,
229}
230
231impl Default for antfly_slice {
232 fn default() -> Self {
233 antfly_slice {
234 ptr: std::ptr::null(),
235 len: 0,
236 }
237 }
238}
239
240#[repr(C)]
241#[derive(Copy, Clone, Debug)]
242pub struct antfly_buffer {
243 pub ptr: *mut u8,
244 pub len: usize,
245}
246
247impl Default for antfly_buffer {
248 fn default() -> Self {
249 antfly_buffer {
250 ptr: std::ptr::null_mut(),
251 len: 0,
252 }
253 }
254}
255
256#[repr(C)]
263#[derive(Copy, Clone, Debug)]
264pub struct antfly_open_options {
265 pub abi_size: u32,
266 pub storage_kind: u32,
267 pub open_mode: u32,
268 pub profile: u32,
269 pub flags: u32,
270 pub reserved0: u32,
271 pub map_size: u64,
272 pub ttl_cleanup_enabled: bool,
273 pub ttl_cleanup_lease_owned: bool,
274 pub ttl_cleanup_batch_size: u32,
275 pub ttl_cleanup_owner_id: antfly_slice,
276 pub ttl_cleanup_lease_ttl_ms: u64,
277 pub ttl_cleanup_interval_ms: u64,
278 pub ttl_cleanup_grace_period_ns: u64,
279 pub inference_host_budget_mb: u32,
283 pub inference_backend_budget_mb: u32,
284 pub inference_process_memory_budget_mb: u32,
285 pub inference_combined_budget_mb: u32,
286 pub inference_kv_budget_mb: u32,
287 pub inference_scratch_budget_mb: u32,
288 pub busy_timeout_ms: u64,
293 pub reserved: [u64; 6],
294 pub models_dir: antfly_slice,
295}
296
297#[repr(C)]
298#[derive(Copy, Clone, Debug)]
299pub struct antfly_write_intent {
300 pub key: antfly_slice,
301 pub value: antfly_slice,
302 pub is_delete: bool,
303}
304
305#[repr(C)]
306#[derive(Copy, Clone, Debug)]
307pub struct antfly_version_predicate {
308 pub key: antfly_slice,
309 pub expected_version: u64,
310}
311
312#[repr(C)]
313#[derive(Copy, Clone, Debug)]
314pub struct antfly_dense_search_hit {
315 pub id_ptr: *mut u8,
316 pub id_len: usize,
317 pub score: f32,
318}
319
320#[repr(C)]
321#[derive(Copy, Clone, Debug)]
322pub struct antfly_dense_search_result {
323 pub hits_ptr: *mut antfly_dense_search_hit,
324 pub hit_count: usize,
325 pub total_hits: u32,
326 pub identity_read_generation: u64,
327}
328
329impl Default for antfly_dense_search_result {
330 fn default() -> Self {
331 antfly_dense_search_result {
332 hits_ptr: std::ptr::null_mut(),
333 hit_count: 0,
334 total_hits: 0,
335 identity_read_generation: 0,
336 }
337 }
338}
339
340#[repr(C)]
341#[derive(Copy, Clone, Debug)]
342pub struct antfly_packed_dense_search_hit {
343 pub id_offset: usize,
344 pub id_len: usize,
345 pub score: f32,
346}
347
348#[repr(C)]
349#[derive(Copy, Clone, Debug)]
350pub struct antfly_packed_dense_search_result {
351 pub hits_ptr: *mut antfly_packed_dense_search_hit,
352 pub hit_count: usize,
353 pub total_hits: u32,
354 pub ids_ptr: *mut u8,
355 pub ids_len: usize,
356 pub identity_read_generation: u64,
357}
358
359impl Default for antfly_packed_dense_search_result {
360 fn default() -> Self {
361 antfly_packed_dense_search_result {
362 hits_ptr: std::ptr::null_mut(),
363 hit_count: 0,
364 total_hits: 0,
365 ids_ptr: std::ptr::null_mut(),
366 ids_len: 0,
367 identity_read_generation: 0,
368 }
369 }
370}
371
372#[repr(C)]
373#[derive(Copy, Clone, Debug, Default)]
374pub struct antfly_dense_search_profile {
375 pub total_ns: u64,
376 pub index_lookup_ns: u64,
377 pub search_ns: u64,
378 pub hits_ns: u64,
379 pub fallback_ns: u64,
380 pub hbc_total_ns: u64,
381 pub hbc_setup_ns: u64,
382 pub hbc_root_load_ns: u64,
383 pub hbc_node_cache_miss_ns: u64,
384 pub hbc_node_cache_misses: u64,
385 pub hbc_quantized_cache_miss_ns: u64,
386 pub hbc_quantized_cache_misses: u64,
387 pub hbc_child_expand_ns: u64,
388 pub hbc_leaf_score_ns: u64,
389 pub hbc_rerank_ns: u64,
390 pub hbc_rerank_vector_load_ns: u64,
391 pub hbc_rerank_distance_ns: u64,
392 pub hbc_nodes_visited: u64,
393 pub hbc_leaves_explored: u64,
394 pub hbc_reranked_vectors: u64,
395 pub hit_count: u32,
396 pub total_hits: u32,
397 pub used_fast_path: bool,
398}
399
400#[repr(C)]
401#[derive(Copy, Clone, Debug, Default)]
402pub struct antfly_dense_wire_search_profile {
403 pub total_ns: u64,
404 pub decode_ns: u64,
405 pub search_ns: u64,
406 pub resolve_ns: u64,
407 pub encode_ns: u64,
408 pub fallback_ns: u64,
409 pub hbc_total_ns: u64,
410 pub hbc_setup_ns: u64,
411 pub hbc_root_load_ns: u64,
412 pub hbc_node_cache_miss_ns: u64,
413 pub hbc_node_cache_misses: u64,
414 pub hbc_quantized_cache_miss_ns: u64,
415 pub hbc_quantized_cache_misses: u64,
416 pub hbc_child_expand_ns: u64,
417 pub hbc_leaf_score_ns: u64,
418 pub hbc_rerank_ns: u64,
419 pub hbc_rerank_vector_load_ns: u64,
420 pub hbc_rerank_distance_ns: u64,
421 pub hbc_nodes_visited: u64,
422 pub hbc_leaves_explored: u64,
423 pub hbc_reranked_vectors: u64,
424 pub hit_count: u32,
425 pub total_hits: u32,
426 pub used_fast_path: bool,
427}
428
429#[repr(C)]
430#[derive(Copy, Clone, Debug)]
431pub struct antfly_scan_hash_entry {
432 pub id_ptr: *mut u8,
433 pub id_len: usize,
434 pub hash: u64,
435}
436
437#[repr(C)]
438#[derive(Copy, Clone, Debug)]
439pub struct antfly_scan_hash_result {
440 pub entries_ptr: *mut antfly_scan_hash_entry,
441 pub entry_count: usize,
442}
443
444impl Default for antfly_scan_hash_result {
445 fn default() -> Self {
446 antfly_scan_hash_result {
447 entries_ptr: std::ptr::null_mut(),
448 entry_count: 0,
449 }
450 }
451}
452
453unsafe extern "C" {
458 pub fn antfly_abi_version() -> u32;
459 pub fn antfly_open_options_size() -> u32;
460 pub fn antfly_last_error_detail() -> *const c_char;
461 pub fn antfly_last_error_code() -> antfly_error_code;
462 pub fn antfly_error_code_name(code: antfly_error_code) -> *const c_char;
463 pub fn antfly_error_code_description(code: antfly_error_code) -> *const c_char;
464 pub fn antfly_open_options_init(options: *mut antfly_open_options) -> antfly_error_code;
465
466 pub fn antfly_threading_mode() -> u32;
467
468 pub fn antfly_db_open(path: *const c_char, out_db: *mut *mut antfly_db) -> antfly_error_code;
469 pub fn antfly_db_open_with_options(
470 path: *const c_char,
471 options: *const antfly_open_options,
472 out_db: *mut *mut antfly_db,
473 ) -> antfly_error_code;
474 pub fn antfly_db_create_with_options(
475 path: *const c_char,
476 options: *const antfly_open_options,
477 out_db: *mut *mut antfly_db,
478 ) -> antfly_error_code;
479 pub fn antfly_db_close(db: *mut antfly_db);
480
481 pub fn antfly_lite_open(path: *const c_char, out_db: *mut *mut antfly_db) -> antfly_error_code;
482 pub fn antfly_lite_create(
483 path: *const c_char,
484 out_db: *mut *mut antfly_db,
485 ) -> antfly_error_code;
486 pub fn antfly_lite_open_hosted(
487 path: *const c_char,
488 out_db: *mut *mut antfly_db,
489 ) -> antfly_error_code;
490 pub fn antfly_lite_create_hosted(
491 path: *const c_char,
492 out_db: *mut *mut antfly_db,
493 ) -> antfly_error_code;
494 pub fn antfly_lite_open_readonly(
495 path: *const c_char,
496 out_db: *mut *mut antfly_db,
497 ) -> antfly_error_code;
498 pub fn antfly_lite_open_status_only(
499 path: *const c_char,
500 out_db: *mut *mut antfly_db,
501 ) -> antfly_error_code;
502
503 pub fn antfly_db_status_json(db: *mut antfly_db, out: *mut antfly_buffer) -> antfly_error_code;
504 pub fn antfly_db_capabilities_json(
505 db: *mut antfly_db,
506 out: *mut antfly_buffer,
507 ) -> antfly_error_code;
508
509 pub fn antfly_db_backup(db: *mut antfly_db, out: *mut antfly_buffer) -> antfly_error_code;
510 pub fn antfly_db_backup_json(
511 db: *mut antfly_db,
512 options: antfly_slice,
513 out: *mut antfly_buffer,
514 ) -> antfly_error_code;
515 pub fn antfly_db_import_backup(db: *mut antfly_db, backup: antfly_slice) -> antfly_error_code;
516 pub fn antfly_restore_backup_json(
517 dest_path: *const c_char,
518 options: *const antfly_open_options,
519 backup: antfly_slice,
520 replace: bool,
521 out: *mut antfly_buffer,
522 ) -> antfly_error_code;
523 pub fn antfly_restore_backup_file_json(
524 dest_path: *const c_char,
525 options: *const antfly_open_options,
526 backup_path: *const c_char,
527 replace: bool,
528 out: *mut antfly_buffer,
529 ) -> antfly_error_code;
530
531 pub fn antfly_lite_check_json(db: *mut antfly_db, out: *mut antfly_buffer)
532 -> antfly_error_code;
533 pub fn antfly_lite_check_file_json(
534 path: *const c_char,
535 out: *mut antfly_buffer,
536 ) -> antfly_error_code;
537 pub fn antfly_lite_copy_stable_snapshot_json(
538 db: *mut antfly_db,
539 dest_path: *const c_char,
540 replace: bool,
541 out: *mut antfly_buffer,
542 ) -> antfly_error_code;
543 pub fn antfly_lite_copy_stable_snapshot_file_json(
544 src_path: *const c_char,
545 dest_path: *const c_char,
546 replace: bool,
547 out: *mut antfly_buffer,
548 ) -> antfly_error_code;
549 pub fn antfly_lite_compact_json(
550 db: *mut antfly_db,
551 out: *mut antfly_buffer,
552 ) -> antfly_error_code;
553 pub fn antfly_lite_vacuum_json(
554 db: *mut antfly_db,
555 out: *mut antfly_buffer,
556 ) -> antfly_error_code;
557
558 pub fn antfly_buffer_free(buffer: *mut antfly_buffer);
559 pub fn antfly_buffer_free_zero(buffer: *mut antfly_buffer);
560 pub fn antfly_dense_search_result_free(result: *mut antfly_dense_search_result);
561 pub fn antfly_packed_dense_search_result_free(result: *mut antfly_packed_dense_search_result);
562 pub fn antfly_scan_hash_result_free(result: *mut antfly_scan_hash_result);
563
564 pub fn antfly_db_batch(
565 db: *mut antfly_db,
566 writes: *const antfly_write_intent,
567 write_count: usize,
568 predicates: *const antfly_version_predicate,
569 predicate_count: usize,
570 timestamp_ns: u64,
571 sync_level: u8,
572 ) -> antfly_error_code;
573 pub fn antfly_db_batch_json(
574 db: *mut antfly_db,
575 request_json: antfly_slice,
576 out: *mut antfly_buffer,
577 ) -> antfly_error_code;
578 pub fn antfly_last_error_outcome_receipt(out: *mut antfly_buffer) -> antfly_error_code;
582 pub fn antfly_db_batch_with_receipt(
586 db: *mut antfly_db,
587 writes: *const antfly_write_intent,
588 write_count: usize,
589 predicates: *const antfly_version_predicate,
590 predicate_count: usize,
591 timestamp_ns: u64,
592 sync_level: u8,
593 receipt_out: *mut antfly_buffer,
594 ) -> antfly_error_code;
595 pub fn antfly_db_batch_json_with_receipt(
596 db: *mut antfly_db,
597 request_json: antfly_slice,
598 out: *mut antfly_buffer,
599 receipt_out: *mut antfly_buffer,
600 ) -> antfly_error_code;
601 pub fn antfly_db_outcome_receipt_status(
602 db: *mut antfly_db,
603 receipt: antfly_slice,
604 out_status: *mut u8,
605 ) -> antfly_error_code;
606 pub fn antfly_db_outcome_receipt_forget(
607 db: *mut antfly_db,
608 receipt: antfly_slice,
609 ) -> antfly_error_code;
610 pub fn antfly_db_begin_transaction_with_id(
611 db: *mut antfly_db,
612 txn_id: *const [u8; 16],
613 timestamp_ns: u64,
614 participants: *const antfly_slice,
615 participant_count: usize,
616 ) -> antfly_error_code;
617 pub fn antfly_db_write_transaction(
618 db: *mut antfly_db,
619 txn_id: *const [u8; 16],
620 writes: *const antfly_write_intent,
621 write_count: usize,
622 predicates: *const antfly_version_predicate,
623 predicate_count: usize,
624 ) -> antfly_error_code;
625 pub fn antfly_db_resolve_intents(
626 db: *mut antfly_db,
627 txn_id: *const [u8; 16],
628 status: u8,
629 commit_version: u64,
630 ) -> antfly_error_code;
631 pub fn antfly_db_get_transaction_status(
632 db: *mut antfly_db,
633 txn_id: *const [u8; 16],
634 out_status: *mut u8,
635 ) -> antfly_error_code;
636 pub fn antfly_db_get_commit_version(
637 db: *mut antfly_db,
638 txn_id: *const [u8; 16],
639 out_commit_version: *mut u64,
640 ) -> antfly_error_code;
641 pub fn antfly_db_get_timestamp(
642 db: *mut antfly_db,
643 key: antfly_slice,
644 out_timestamp: *mut u64,
645 ) -> antfly_error_code;
646 pub fn antfly_db_lookup_json(
647 db: *mut antfly_db,
648 key: antfly_slice,
649 out: *mut antfly_buffer,
650 ) -> antfly_error_code;
651 pub fn antfly_db_get_raw(
652 db: *mut antfly_db,
653 key: antfly_slice,
654 out: *mut antfly_buffer,
655 ) -> antfly_error_code;
656 pub fn antfly_db_get_schema_json(
657 db: *mut antfly_db,
658 out: *mut antfly_buffer,
659 ) -> antfly_error_code;
660 pub fn antfly_db_set_schema_json(
661 db: *mut antfly_db,
662 schema_json: antfly_slice,
663 ) -> antfly_error_code;
664 pub fn antfly_db_run_until_idle(db: *mut antfly_db) -> antfly_error_code;
665 pub fn antfly_db_run_until_idle_json(
666 db: *mut antfly_db,
667 out: *mut antfly_buffer,
668 ) -> antfly_error_code;
669 pub fn antfly_db_pending_work_stats_json(
670 db: *mut antfly_db,
671 out: *mut antfly_buffer,
672 ) -> antfly_error_code;
673 pub fn antfly_db_replay_generated_enrichments_json(
674 db: *mut antfly_db,
675 out: *mut antfly_buffer,
676 ) -> antfly_error_code;
677 pub fn antfly_db_list_indexes_json(
678 db: *mut antfly_db,
679 out: *mut antfly_buffer,
680 ) -> antfly_error_code;
681 pub fn antfly_db_render_resolver_key_json(
682 db: *mut antfly_db,
683 resolver_name: antfly_slice,
684 mention_json: antfly_slice,
685 out: *mut antfly_buffer,
686 ) -> antfly_error_code;
687 pub fn antfly_db_memory_json(
688 db: *mut antfly_db,
689 space: antfly_slice,
690 request_json: antfly_slice,
691 out_json: *mut antfly_buffer,
692 ) -> antfly_error_code;
693 pub fn antfly_db_resolve_query_json(
694 db: *mut antfly_db,
695 resolver_name: antfly_slice,
696 request_json: antfly_slice,
697 out: *mut antfly_buffer,
698 ) -> antfly_error_code;
699 pub fn antfly_db_merge_resolver_keys_json(
700 db: *mut antfly_db,
701 resolver_name: antfly_slice,
702 merge_json: antfly_slice,
703 ) -> antfly_error_code;
704 pub fn antfly_db_unmerge_resolver_key_json(
705 db: *mut antfly_db,
706 resolver_name: antfly_slice,
707 request_json: antfly_slice,
708 out: *mut antfly_buffer,
709 ) -> antfly_error_code;
710 pub fn antfly_db_suppress_resolver_keys_json(
711 db: *mut antfly_db,
712 resolver_name: antfly_slice,
713 request_json: antfly_slice,
714 out: *mut antfly_buffer,
715 ) -> antfly_error_code;
716 pub fn antfly_db_unsuppress_resolver_key_json(
717 db: *mut antfly_db,
718 resolver_name: antfly_slice,
719 request_json: antfly_slice,
720 out: *mut antfly_buffer,
721 ) -> antfly_error_code;
722 pub fn antfly_db_resolver_reviews_json(
723 db: *mut antfly_db,
724 request_json: antfly_slice,
725 out: *mut antfly_buffer,
726 ) -> antfly_error_code;
727 pub fn antfly_db_propose_curation_json(
728 db: *mut antfly_db,
729 entity_table: antfly_slice,
730 request_json: antfly_slice,
731 out: *mut antfly_buffer,
732 ) -> antfly_error_code;
733 pub fn antfly_db_list_curation_proposals_json(
734 db: *mut antfly_db,
735 entity_table: antfly_slice,
736 request_json: antfly_slice,
737 out: *mut antfly_buffer,
738 ) -> antfly_error_code;
739 pub fn antfly_db_get_curation_proposal_json(
740 db: *mut antfly_db,
741 entity_table: antfly_slice,
742 proposal_id: antfly_slice,
743 out: *mut antfly_buffer,
744 ) -> antfly_error_code;
745 pub fn antfly_db_decide_curation_proposal_json(
746 db: *mut antfly_db,
747 entity_table: antfly_slice,
748 proposal_id: antfly_slice,
749 request_json: antfly_slice,
750 out: *mut antfly_buffer,
751 ) -> antfly_error_code;
752 pub fn antfly_db_curate_entity_json(
753 db: *mut antfly_db,
754 entity_table: antfly_slice,
755 entity_key: antfly_slice,
756 request_json: antfly_slice,
757 out: *mut antfly_buffer,
758 ) -> antfly_error_code;
759 pub fn antfly_db_entity_merge_json(
760 db: *mut antfly_db,
761 entity_table: antfly_slice,
762 entity_key: antfly_slice,
763 request_json: antfly_slice,
764 out: *mut antfly_buffer,
765 ) -> antfly_error_code;
766 pub fn antfly_db_entity_unmerge_json(
767 db: *mut antfly_db,
768 entity_table: antfly_slice,
769 entity_key: antfly_slice,
770 request_json: antfly_slice,
771 out: *mut antfly_buffer,
772 ) -> antfly_error_code;
773 pub fn antfly_db_entity_suppress_json(
774 db: *mut antfly_db,
775 entity_table: antfly_slice,
776 entity_key: antfly_slice,
777 request_json: antfly_slice,
778 out: *mut antfly_buffer,
779 ) -> antfly_error_code;
780 pub fn antfly_db_entity_unsuppress_json(
781 db: *mut antfly_db,
782 entity_table: antfly_slice,
783 entity_key: antfly_slice,
784 request_json: antfly_slice,
785 out: *mut antfly_buffer,
786 ) -> antfly_error_code;
787 pub fn antfly_db_entity_redirects_json(
788 db: *mut antfly_db,
789 entity_table: antfly_slice,
790 entity_key: antfly_slice,
791 request_json: antfly_slice,
792 out: *mut antfly_buffer,
793 ) -> antfly_error_code;
794 pub fn antfly_db_resolver_curation_json(
795 db: *mut antfly_db,
796 resolver_name: antfly_slice,
797 out: *mut antfly_buffer,
798 ) -> antfly_error_code;
799 pub fn antfly_db_list_resolver_identities_json(
800 db: *mut antfly_db,
801 out: *mut antfly_buffer,
802 ) -> antfly_error_code;
803 pub fn antfly_db_drop_resolver_identity(
804 db: *mut antfly_db,
805 name: antfly_slice,
806 out_deleted: *mut bool,
807 ) -> antfly_error_code;
808 pub fn antfly_db_set_resolver_namespace_json(
809 db: *mut antfly_db,
810 resolver_name: antfly_slice,
811 request_json: antfly_slice,
812 ) -> antfly_error_code;
813 pub fn antfly_db_add_index_json(
814 db: *mut antfly_db,
815 config_json: antfly_slice,
816 ) -> antfly_error_code;
817 pub fn antfly_db_delete_index(
818 db: *mut antfly_db,
819 name: antfly_slice,
820 out_deleted: *mut bool,
821 ) -> antfly_error_code;
822 pub fn antfly_db_cancel_replacement(
823 db: *mut antfly_db,
824 name: antfly_slice,
825 out_deleted: *mut bool,
826 ) -> antfly_error_code;
827 pub fn antfly_db_list_enrichments_json(
828 db: *mut antfly_db,
829 out: *mut antfly_buffer,
830 ) -> antfly_error_code;
831 pub fn antfly_db_add_enrichment_json(
832 db: *mut antfly_db,
833 config_json: antfly_slice,
834 ) -> antfly_error_code;
835 pub fn antfly_db_delete_enrichment(
836 db: *mut antfly_db,
837 kind: antfly_slice,
838 name: antfly_slice,
839 out_deleted: *mut bool,
840 ) -> antfly_error_code;
841 pub fn antfly_db_scan_json(
842 db: *mut antfly_db,
843 request_json: antfly_slice,
844 out: *mut antfly_buffer,
845 ) -> antfly_error_code;
846 pub fn antfly_db_scan_hashes(
847 db: *mut antfly_db,
848 request_json: antfly_slice,
849 out_result: *mut antfly_scan_hash_result,
850 ) -> antfly_error_code;
851 pub fn antfly_db_stats_json(db: *mut antfly_db, out: *mut antfly_buffer) -> antfly_error_code;
852 pub fn antfly_db_search_json(
853 db: *mut antfly_db,
854 request_json: antfly_slice,
855 out: *mut antfly_buffer,
856 ) -> antfly_error_code;
857 pub fn antfly_db_open_table(
858 db: *mut antfly_db,
859 name: antfly_slice,
860 out: *mut *mut antfly_db,
861 ) -> antfly_error_code;
862 pub fn antfly_db_create_table_json(
863 db: *mut antfly_db,
864 name: antfly_slice,
865 schema: antfly_slice,
866 ) -> antfly_error_code;
867 pub fn antfly_db_drop_table(db: *mut antfly_db, name: antfly_slice) -> antfly_error_code;
868 pub fn antfly_db_list_tables_json(
869 db: *mut antfly_db,
870 out: *mut antfly_buffer,
871 ) -> antfly_error_code;
872 pub fn antfly_db_sql_describe_json(
873 db: *mut antfly_db,
874 request: antfly_slice,
875 out: *mut antfly_buffer,
876 ) -> antfly_error_code;
877 pub fn antfly_db_sql_session_open(db: *mut antfly_db, out: *mut u64) -> antfly_error_code;
878 pub fn antfly_db_sql_session_close(db: *mut antfly_db, id: u64) -> antfly_error_code;
879 pub fn antfly_db_sql_open_cursor_json(
880 db: *mut antfly_db,
881 request: antfly_slice,
882 id: *mut u64,
883 out: *mut antfly_buffer,
884 ) -> antfly_error_code;
885 pub fn antfly_db_sql_fetch_cursor_json(
886 db: *mut antfly_db,
887 id: u64,
888 rows: u32,
889 out: *mut antfly_buffer,
890 ) -> antfly_error_code;
891 pub fn antfly_db_sql_close_cursor(db: *mut antfly_db, id: u64) -> antfly_error_code;
892 pub fn antfly_db_sql_json(
893 db: *mut antfly_db,
894 request_json: antfly_slice,
895 out: *mut antfly_buffer,
896 ) -> antfly_error_code;
897 pub fn antfly_db_graph_catalog_json(
898 db: *mut antfly_db,
899 request_json: antfly_slice,
900 out: *mut antfly_buffer,
901 ) -> antfly_error_code;
902 pub fn antfly_db_cypher_json(
903 db: *mut antfly_db,
904 graph_name: antfly_slice,
905 request_json: antfly_slice,
906 out: *mut antfly_buffer,
907 ) -> antfly_error_code;
908 pub fn antfly_db_graph_write_status_json(
909 db: *mut antfly_db,
910 transaction_id: antfly_slice,
911 out: *mut antfly_buffer,
912 ) -> antfly_error_code;
913 pub fn antfly_db_search_dense(
914 db: *mut antfly_db,
915 index_name: antfly_slice,
916 vector_ptr: *const f32,
917 vector_len: usize,
918 k: u32,
919 limit: u32,
920 offset: u32,
921 out_result: *mut antfly_packed_dense_search_result,
922 ) -> antfly_error_code;
923 pub fn antfly_db_search_dense_profile(
924 db: *mut antfly_db,
925 index_name: antfly_slice,
926 vector_ptr: *const f32,
927 vector_len: usize,
928 k: u32,
929 limit: u32,
930 offset: u32,
931 out_profile: *mut antfly_dense_search_profile,
932 ) -> antfly_error_code;
933 pub fn antfly_db_search_dense_wire(
934 db: *mut antfly_db,
935 request_buf: antfly_slice,
936 out: *mut antfly_buffer,
937 ) -> antfly_error_code;
938 pub fn antfly_db_search_dense_wire_profile(
939 db: *mut antfly_db,
940 request_buf: antfly_slice,
941 out: *mut antfly_buffer,
942 out_profile: *mut antfly_dense_wire_search_profile,
943 ) -> antfly_error_code;
944 pub fn antfly_db_search_text_match(
945 db: *mut antfly_db,
946 index_name: antfly_slice,
947 field: antfly_slice,
948 text: antfly_slice,
949 limit: u32,
950 offset: u32,
951 out_result: *mut antfly_dense_search_result,
952 ) -> antfly_error_code;
953 pub fn antfly_db_search_text_match_wire(
954 db: *mut antfly_db,
955 request_buf: antfly_slice,
956 out: *mut antfly_buffer,
957 ) -> antfly_error_code;
958 pub fn antfly_db_search_text_term_wire(
959 db: *mut antfly_db,
960 request_buf: antfly_slice,
961 out: *mut antfly_buffer,
962 ) -> antfly_error_code;
963 pub fn antfly_db_search_text_match_phrase_wire(
964 db: *mut antfly_db,
965 request_buf: antfly_slice,
966 out: *mut antfly_buffer,
967 ) -> antfly_error_code;
968 pub fn antfly_db_search_hits_json(
969 db: *mut antfly_db,
970 request_json: antfly_slice,
971 out_result: *mut antfly_dense_search_result,
972 ) -> antfly_error_code;
973 pub fn antfly_db_aggregate_hits_json(
974 db: *mut antfly_db,
975 request_json: antfly_slice,
976 out: *mut antfly_buffer,
977 ) -> antfly_error_code;
978 pub fn antfly_db_lookup_artifact_json(
979 db: *mut antfly_db,
980 artifact_id_b64: antfly_slice,
981 out: *mut antfly_buffer,
982 ) -> antfly_error_code;
983 pub fn antfly_decode_artifact_id_json(
984 artifact_id_b64: antfly_slice,
985 out: *mut antfly_buffer,
986 ) -> antfly_error_code;
987 pub fn antfly_db_extract_enrichments_json(
988 db: *mut antfly_db,
989 request_json: antfly_slice,
990 out: *mut antfly_buffer,
991 ) -> antfly_error_code;
992 pub fn antfly_db_compute_enrichments_json(
993 db: *mut antfly_db,
994 request_json: antfly_slice,
995 out: *mut antfly_buffer,
996 ) -> antfly_error_code;
997
998 pub fn antfly_db_get_edges_json(
999 db: *mut antfly_db,
1000 index_name: antfly_slice,
1001 key: antfly_slice,
1002 edge_type: antfly_slice,
1003 direction: u8,
1004 out: *mut antfly_buffer,
1005 ) -> antfly_error_code;
1006 pub fn antfly_db_traverse_edges_json(
1007 db: *mut antfly_db,
1008 request_json: antfly_slice,
1009 out: *mut antfly_buffer,
1010 ) -> antfly_error_code;
1011 pub fn antfly_db_execute_graph_queries_json(
1012 db: *mut antfly_db,
1013 request_json: antfly_slice,
1014 out: *mut antfly_buffer,
1015 ) -> antfly_error_code;
1016 pub fn antfly_db_get_neighbors_json(
1017 db: *mut antfly_db,
1018 index_name: antfly_slice,
1019 key: antfly_slice,
1020 edge_type: antfly_slice,
1021 direction: u8,
1022 out: *mut antfly_buffer,
1023 ) -> antfly_error_code;
1024 pub fn antfly_db_find_shortest_path_json(
1025 db: *mut antfly_db,
1026 request_json: antfly_slice,
1027 out: *mut antfly_buffer,
1028 ) -> antfly_error_code;
1029 pub fn antfly_db_find_k_shortest_paths_json(
1030 db: *mut antfly_db,
1031 request_json: antfly_slice,
1032 out: *mut antfly_buffer,
1033 ) -> antfly_error_code;
1034 pub fn antfly_db_match_pattern_json(
1035 db: *mut antfly_db,
1036 request_json: antfly_slice,
1037 out: *mut antfly_buffer,
1038 ) -> antfly_error_code;
1039
1040 pub fn antfly_inference_options_size() -> u32;
1043 pub fn antfly_inference_options_init(
1044 options: *mut antfly_inference_options,
1045 ) -> antfly_error_code;
1046 pub fn antfly_inference_open(
1048 options: *const antfly_inference_options,
1049 out_inference: *mut *mut antfly_inference,
1050 ) -> antfly_error_code;
1051 pub fn antfly_inference_close(inference: *mut antfly_inference);
1052
1053 pub fn antfly_inference_embed_json(
1054 inference: *mut antfly_inference,
1055 request_json: antfly_slice,
1056 out: *mut antfly_buffer,
1057 ) -> antfly_error_code;
1058 pub fn antfly_inference_rerank_json(
1059 inference: *mut antfly_inference,
1060 request_json: antfly_slice,
1061 out: *mut antfly_buffer,
1062 ) -> antfly_error_code;
1063 pub fn antfly_inference_chunk_json(
1064 inference: *mut antfly_inference,
1065 request_json: antfly_slice,
1066 out: *mut antfly_buffer,
1067 ) -> antfly_error_code;
1068 pub fn antfly_inference_generate_json(
1069 inference: *mut antfly_inference,
1070 request_json: antfly_slice,
1071 out: *mut antfly_buffer,
1072 ) -> antfly_error_code;
1073 pub fn antfly_inference_generate_stream_json(
1083 inference: *mut antfly_inference,
1084 request_json: antfly_slice,
1085 on_chunk: antfly_inference_stream_fn,
1086 chunk_context: *mut c_void,
1087 out: *mut antfly_buffer,
1088 ) -> antfly_error_code;
1089 pub fn antfly_inference_generate_batch_json(
1092 inference: *mut antfly_inference,
1093 request_json: antfly_slice,
1094 out: *mut antfly_buffer,
1095 ) -> antfly_error_code;
1096 pub fn antfly_inference_rewrite_json(
1097 inference: *mut antfly_inference,
1098 request_json: antfly_slice,
1099 out: *mut antfly_buffer,
1100 ) -> antfly_error_code;
1101 pub fn antfly_inference_decide_json(
1103 inference: *mut antfly_inference,
1104 request_json: antfly_slice,
1105 out: *mut antfly_buffer,
1106 ) -> antfly_error_code;
1107 pub fn antfly_inference_extract_json(
1108 inference: *mut antfly_inference,
1109 request_json: antfly_slice,
1110 out: *mut antfly_buffer,
1111 ) -> antfly_error_code;
1112 pub fn antfly_inference_read_json(
1113 inference: *mut antfly_inference,
1114 request_json: antfly_slice,
1115 out: *mut antfly_buffer,
1116 ) -> antfly_error_code;
1117 pub fn antfly_inference_list_models_json(
1119 inference: *mut antfly_inference,
1120 out: *mut antfly_buffer,
1121 ) -> antfly_error_code;
1122
1123 pub fn antfly_inference_pull_json(
1128 inference: *mut antfly_inference,
1129 request_json: antfly_slice,
1130 progress: antfly_inference_pull_progress_fn,
1131 progress_context: *mut c_void,
1132 out: *mut antfly_buffer,
1133 ) -> antfly_error_code;
1134}
1135
1136pub const ANTFLY_REPLACEMENT_FAILED: antfly_error_code = 11;
1137pub const ANTFLY_REPLACEMENT_PENDING: antfly_error_code = 12;
1138pub const ANTFLY_REPLACEMENT_CONFIGURATION_MISMATCH: antfly_error_code = 13;