You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Go HTTP client SDK for the Strata Server.
Covers every endpoint and compiles to either a standalone binary (for subprocess IPC from C++) or a shared/static library (for direct cgo linking).
Files
File
Purpose
client.go
Core HTTP client — all API methods
main.go
CLI entry point (binary mode)
cexport.go
cgo C export layer (library mode)
stratasdk.h
C/C++ header with full RAII wrapper
build.go
Build script for all targets
Build
# All targets at once:
go run build.go all
# Or individually:
go run build.go binary # → dist/stratasdk or dist/stratasdk.exe
go run build.go shared # → dist/libstrata.so + dist/stratasdk.h or dist/libstrata.dll + dist/stratasdk.
go run build.go static # → dist/libstrata.a + dist/stratasdk.h or dist/libstrata.lib + dist/stratasdk.h
All output is JSON on stdout. Errors are JSON on stderr with exit code 1.
Usage — Library mode (direct C++ linking)
#include"stratasdk.h"// C++ RAII wrapper (throws strata::StrataError on failure):
strata::Client c("https://strata-api.themrdt.org");
std::string tokens = c.login("user", "pass");
std::string refs = c.listRefs("my-project-id");
// Or raw C API:strataInit("https://strata-api.themrdt.org");
char* result = strataLogin("user", "pass");
if (!result) {
char* err = strataLastError();
fprintf(stderr, "Error: %s\n", err);
strataFree(err);
} else {
printf("%s\n", result);
strataFree(result);
}
Notes
strataLogin() / strataRefresh() automatically store tokens in the global client state — you don't need to call strataSetToken() after a successful login.
strataPullDownloadChunk() returns raw bytes (not JSON). Free the pointer with strataFree().
strataPushUploadChunk() takes raw bytes directly — no base64 encoding needed.
The HTTP client timeout is 10 minutes to accommodate large chunk transfers.
All functions are thread-safe on the token read/write path via sync.RWMutex.