API Quick Reference
detailed API documentation
API Quick Reference
Package layout
github.com/Ratio1/edge_sdk_go/pkg/cstore– CStore client (key/value + hash operations)github.com/Ratio1/edge_sdk_go/pkg/r1fs– R1FS client (file/object helpers)
Bootstrap (recommended)
Both clients can be initialised from the standard Ratio1 env vars:
EE_CHAINSTORE_API_URLfor CStoreEE_R1FS_API_URLfor R1FS
cs, err := cstore.NewFromEnv()
fs, err := r1fs.NewFromEnv()
Error and “not found” semantics
- Most methods return Go
errorvalues for transport/protocol failures. - When the upstream returns
nullfor missing data, the SDK returns anilitem/document (witherr == nil).- CStore:
Get/HGetcan returnnil - R1FS:
GetYAMLcan returnnil
- CStore:
CStore highlights
Set(ctx, key, value, opts)– store JSON-serialisable valuesGet(ctx, key, out)– fetch and decode valuesHSet(ctx, hash, field, value, opts)– set a field inside a hash keyHGet(ctx, hash, field, out)/HGetAll(ctx, hash)– retrieve hash dataGetStatus(ctx)– lightweight connectivity/status call
R1FS highlights
AddFileBase64(ctx, r, opts)/GetFileBase64(ctx, cid, secret)– store and retrieve contentAddFile(ctx, r, opts)/GetFile(ctx, cid, secret)– multipart upload + metadata lookupAddYAML(ctx, data, opts)/GetYAML(ctx, cid, secret, out)– YAML convenience helpersCalculateJSONCID(ctx, data, seed, opts)/CalculatePickleCID(...)– compute content IDs without storingAddJSON(ctx, data, opts)/AddPickle(ctx, data, opts)– store structured payloads directlyDeleteFile(ctx, cid, opts)/DeleteFiles(ctx, cids, opts)– remove stored content
R1FS options
r1fs.DataOptions (used by upload/calculate endpoints):
Filename– name associated with the uploaded payloadFilePath– virtual path to store the payload underSecret– optional access secret (forwarded to the manager)Nonce– optional integer used by endpoints that support deterministic CID calculation
r1fs.DeleteOptions (used by delete endpoints):
UnpinRemote– request unpin on remote pinning backendsRunGC– request garbage collection (run_gc/run_gc_after_all)CleanupLocalFiles– request local cleanup on the node
Next steps
- See CStore Integration for a step-by-step KV flow.
- See R1FS Integration for uploads/downloads.
- Back to Go.