diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a40ae4..f41dab6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,25 +10,25 @@ jobs: strategy: matrix: target: - - os: ubuntu-latest - name: linux - cpu: amd64 - lib_ext: so + # - os: ubuntu-latest + # name: linux + # cpu: amd64 + # lib_ext: so - - os: ubuntu-24.04-arm - cpu: arm64 - name: linux - lib_ext: so + # - os: ubuntu-24.04-arm + # cpu: arm64 + # name: linux + # lib_ext: so - os: macos-latest lib_ext: so name: macos cpu: arm64 - - os: windows-latest - cpu: amd64 - name: windows - lib_ext: dll + # - os: windows-latest + # cpu: amd64 + # name: windows + # lib_ext: dll steps: - name: Check out sources @@ -41,11 +41,11 @@ jobs: with: go-version-file: go.mod - - name: Fetch artifacts - env: - OS: ${{ matrix.target.name }} - ARCH: ${{ matrix.target.cpu }} - run: make fetch + # - name: Fetch artifacts + # env: + # OS: ${{ matrix.target.name }} + # ARCH: ${{ matrix.target.cpu }} + # run: make fetch - name: Build run: make build diff --git a/.gitignore b/.gitignore index b8d1a63..5c50bb0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # Ignore artifacts downloaded -libs +# libs # Ignore file downloaded hello.txt diff --git a/libs/libcodex.dylib b/libs/libcodex.dylib new file mode 100755 index 0000000..99fbd9a Binary files /dev/null and b/libs/libcodex.dylib differ diff --git a/libs/libcodex.h b/libs/libcodex.h new file mode 100644 index 0000000..e63c2ad --- /dev/null +++ b/libs/libcodex.h @@ -0,0 +1,200 @@ +/** +* libcodex.h - C Interface for Example Library +* +* This header provides the public API for libcodex +* +* To see the auto-generated header by Nim, run `make libcodex` from the +* repository root. The generated file will be created at: +* nimcache/release/libcodex/libcodex.h +*/ + +#ifndef __libcodex__ +#define __libcodex__ + +#include +#include + +// The possible returned values for the functions that return int +#define RET_OK 0 +#define RET_ERR 1 +#define RET_MISSING_CALLBACK 2 +#define RET_PROGRESS 3 + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (*CodexCallback) (int callerRet, const char* msg, size_t len, void* userData); + +void* codex_new( + const char* configJson, + CodexCallback callback, + void* userData); + +int codex_version( + void* ctx, + CodexCallback callback, + void* userData); + +int codex_revision( + void* ctx, + CodexCallback callback, + void* userData); + +int codex_repo( + void* ctx, + CodexCallback callback, + void* userData); + +int codex_debug( + void* ctx, + CodexCallback callback, + void* userData); + +int codex_spr( + void* ctx, + CodexCallback callback, + void* userData); + +int codex_peer_id( + void* ctx, + CodexCallback callback, + void* userData); + +int codex_log_level( + void* ctx, + const char* logLevel, + CodexCallback callback, + void* userData); + +int codex_connect( + void* ctx, + const char* peerId, + const char** peerAddresses, + size_t peerAddressesSize, + CodexCallback callback, + void* userData); + +int codex_peer_debug( + void* ctx, + const char* peerId, + CodexCallback callback, + void* userData); + + +int codex_upload_init( + void* ctx, + const char* filepath, + size_t chunkSize, + CodexCallback callback, + void* userData); + +int codex_upload_chunk( + void* ctx, + const char* sessionId, + const uint8_t* chunk, + size_t len, + CodexCallback callback, + void* userData); + +int codex_upload_finalize( + void* ctx, + const char* sessionId, + CodexCallback callback, + void* userData); + +int codex_upload_cancel( + void* ctx, + const char* sessionId, + CodexCallback callback, + void* userData); + +int codex_upload_file( + void* ctx, + const char* sessionId, + CodexCallback callback, + void* userData); + +int codex_download_stream( + void* ctx, + const char* cid, + size_t chunkSize, + bool local, + const char* filepath, + CodexCallback callback, + void* userData); + +int codex_download_init( + void* ctx, + const char* cid, + size_t chunkSize, + bool local, + CodexCallback callback, + void* userData); + +int codex_download_chunk( + void* ctx, + const char* cid, + CodexCallback callback, + void* userData); + +int codex_download_cancel( + void* ctx, + const char* cid, + CodexCallback callback, + void* userData); + +int codex_download_manifest( + void* ctx, + const char* cid, + CodexCallback callback, + void* userData); + +int codex_storage_list( + void* ctx, + CodexCallback callback, + void* userData); + +int codex_storage_space( + void* ctx, + CodexCallback callback, + void* userData); + +int codex_storage_delete( + void* ctx, + const char* cid, + CodexCallback callback, + void* userData); + +int codex_storage_fetch( + void* ctx, + const char* cid, + CodexCallback callback, + void* userData); + +int codex_start(void* ctx, + CodexCallback callback, + void* userData); + +int codex_stop(void* ctx, + CodexCallback callback, + void* userData); + +int codex_close(void* ctx, + CodexCallback callback, + void* userData); + +// Destroys an instance of a codex node created with codex_new +int codex_destroy(void* ctx, + CodexCallback callback, + void* userData); + +void codex_set_event_callback(void* ctx, + CodexCallback callback, + void* userData); + +#ifdef __cplusplus +} +#endif + +#endif /* __libcodex__ */ \ No newline at end of file