#ifndef VGI_RPC_EXTERNAL_H#define VGI_RPC_EXTERNAL_H#include"vgi_rpc/batch.h"#ifdef __cplusplusextern"C"{#endifstructVgiExternalUploadUrl{char*upload_url;char*download_url;int64_texpires_at_us;};structVgiExternalOptions{int64_tthreshold_bytes;int64_tmax_fetch_bytes;int64_tmax_decompressed_bytes;unsignedmax_redirects;unsignedtimeout_seconds;constchar*compression;/* NULL, identity, or zstd. *//* Zero accepts. Called before every fetch, including each redirect hop. * The default permits HTTPS only. Both HTTP and HTTPS need explicit opt-in * through a caller-supplied validator for local/private storage. */int(*validate_url)(void*,constchar*url);void*validate_state;/* Allocate a method-bound URL pair. Return malloc-owned strings, released * by VgiExternalUploadUrlReset, including on failure. */int(*allocate)(void*,conststructArrowSchema*,structVgiExternalUploadUrl*,structArrowError*);void*storage_state;};structVgiExternalRef{char*location;charsha256[65];};voidVgiExternalOptionsInit(structVgiExternalOptions*);voidVgiExternalUploadUrlReset(structVgiExternalUploadUrl*);voidVgiExternalRefReset(structVgiExternalRef*);/* Fetch under independent encoded/decoded caps; digest covers decoded bytes. * out must be empty and initialized. Failed fetches leave it empty. */intVgiExternalFetch(conststructVgiExternalOptions*,constchar*location,constchar*sha256,structArrowBuffer*out,structArrowError*);/* Publish one IPC stream once, then reuse its ref without repeating uploads. * Schema and bytes are borrowed. out must be zero-initialized. */intVgiExternalPublish(conststructVgiExternalOptions*,conststructArrowSchema*,structArrowBufferViewipc,intinclude_sha256,structVgiExternalRef*,structArrowError*);intVgiExternalPointer(conststructArrowSchema*,conststructVgiExternalRef*,structVgiBatch*,structArrowBuffer*metadata,structArrowError*);#ifdef __cplusplus}#endif#endif