From 422c76f11062572c9a97de8c9284ef371619bb37 Mon Sep 17 00:00:00 2001 From: Arnaud Date: Fri, 6 Mar 2026 10:21:19 +0400 Subject: [PATCH 1/5] Update project to 0.3.1 --- Makefile | 12 ++++++------ README.md | 8 ++++---- go.mod | 2 +- go.sum | 26 ++------------------------ main.go | 27 ++++++++++++++------------- 5 files changed, 27 insertions(+), 48 deletions(-) diff --git a/Makefile b/Makefile index c68a37a..572a502 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ LIBS_DIR := $(abspath ./libs) # Flags for CGO to find the headers and the shared library UNAME_S := $(shell uname -s) CGO_CFLAGS := -I$(LIBS_DIR) -CGO_LDFLAGS := -L$(LIBS_DIR) -lcodex -Wl,-rpath,$(LIBS_DIR) +CGO_LDFLAGS := -L$(LIBS_DIR) -lstorage -Wl,-rpath,$(LIBS_DIR) ifeq ($(OS),Windows_NT) BIN_NAME := example.exe @@ -15,15 +15,15 @@ endif # Configuration for fetching the right binary OS ?= "linux" ARCH ?= "amd64" -VERSION ?= "v0.0.21" -DOWNLOAD_URL := "https://github.com/codex-storage/codex-go-bindings/releases/download/$(VERSION)/codex-${OS}-${ARCH}.zip" +VERSION ?= "v0.3.1" +DOWNLOAD_URL := "https://github.com/logos-storage/logos-storage-nim/releases/download/$(VERSION)/libstorage-${OS}-${ARCH}-$(VERSION).zip" all: run fetch: - @echo "Fetching libcodex from GitHub Actions from: ${DOWNLOAD_URL}" - curl -fSL --create-dirs -o $(LIBS_DIR)/codex-${OS}-${ARCH}.zip ${DOWNLOAD_URL} - unzip -o -qq $(LIBS_DIR)/codex-${OS}-${ARCH}.zip -d $(LIBS_DIR) + @echo "Fetching libstorage from GitHub Actions from: ${DOWNLOAD_URL}" + curl -fSL --create-dirs -o $(LIBS_DIR)/libstorage-${OS}-${ARCH}-$(VERSION).zip ${DOWNLOAD_URL} + unzip -o -qq $(LIBS_DIR)/libstorage-${OS}-${ARCH}-$(VERSION).zip -d $(LIBS_DIR) rm -f $(LIBS_DIR)/*.zip build: diff --git a/README.md b/README.md index 2bfe0aa..5213f5a 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# Example Codex Go Bindings +# Example Logos Storage Go Bindings -This repository demonstrates how to integrate the [Codex Go bindings](https://github.com/codex-storage/codex-go-bindings) into a Go project. +This repository demonstrates how to integrate the [Logos Storage Go bindings](https://github.com/logos-storage/logos-storage-go-bindings/) into a Go project. -The project starts a Codex node, uploads and downloads some data and then stops the node. +The project starts a Logos Storage node, uploads and downloads some data and then stops the node. ## Usage @@ -28,7 +28,7 @@ OS="macos" ARCH="arm64" make fetch You can change the version by providing it as environment variables: ```sh -VERSION="v0.0.21" make fetch +VERSION="v0.3.2" make fetch ``` The default folder is `libs`, you can change it by editing the `Makefile`. diff --git a/go.mod b/go.mod index f9af808..016c212 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module example go 1.25.1 -require github.com/codex-storage/codex-go-bindings v0.0.21 +require github.com/logos-storage/logos-storage-go-bindings v0.0.30 diff --git a/go.sum b/go.sum index 006782d..35c80d0 100644 --- a/go.sum +++ b/go.sum @@ -1,24 +1,2 @@ -github.com/codex-storage/codex-go-bindings v0.0.1 h1:u6Z/Y01Wpxckrg4ATsO/xD/9XVRa6PdHy2AVHYjx9iU= -github.com/codex-storage/codex-go-bindings v0.0.1/go.mod h1:8yC11Vr1Mu5sqZyQ33GaSCr0uUIbQnGkm0aWqZj62Kg= -github.com/codex-storage/codex-go-bindings v0.0.10 h1:szqFD1CWb5ELY+pnlj87PM+nUIiZwjnFYLzTgbiGsDQ= -github.com/codex-storage/codex-go-bindings v0.0.10/go.mod h1:8yC11Vr1Mu5sqZyQ33GaSCr0uUIbQnGkm0aWqZj62Kg= -github.com/codex-storage/codex-go-bindings v0.0.11 h1:mGzkebWuCwtfNinyplNBZ+QFlvlu0Wkg+wQ3fNegCJc= -github.com/codex-storage/codex-go-bindings v0.0.11/go.mod h1:8yC11Vr1Mu5sqZyQ33GaSCr0uUIbQnGkm0aWqZj62Kg= -github.com/codex-storage/codex-go-bindings v0.0.13 h1:svQT3hzH+J5ys5cPqNUXxrPYi57bfoNrzywFZiJZJDE= -github.com/codex-storage/codex-go-bindings v0.0.13/go.mod h1:8yC11Vr1Mu5sqZyQ33GaSCr0uUIbQnGkm0aWqZj62Kg= -github.com/codex-storage/codex-go-bindings v0.0.14 h1:Pk/DDEGW3OGTefEyoBHvw2RUgpAzG6TBtoMmtH1HXI4= -github.com/codex-storage/codex-go-bindings v0.0.14/go.mod h1:8yC11Vr1Mu5sqZyQ33GaSCr0uUIbQnGkm0aWqZj62Kg= -github.com/codex-storage/codex-go-bindings v0.0.15 h1:7usvjbqm5BjRICk7uLu1C+fU69cSLvefcH7rdCy9MTg= -github.com/codex-storage/codex-go-bindings v0.0.15/go.mod h1:8yC11Vr1Mu5sqZyQ33GaSCr0uUIbQnGkm0aWqZj62Kg= -github.com/codex-storage/codex-go-bindings v0.0.16 h1:rDjkcR9NdN6JKVAdnX7RSGkkc5l3/din4QMDRAUJZ7w= -github.com/codex-storage/codex-go-bindings v0.0.16/go.mod h1:8yC11Vr1Mu5sqZyQ33GaSCr0uUIbQnGkm0aWqZj62Kg= -github.com/codex-storage/codex-go-bindings v0.0.17 h1:lKtYBqUIDsZdgEe1f4DGfv/K+ANx9b7VUtfIu8YOT6A= -github.com/codex-storage/codex-go-bindings v0.0.17/go.mod h1:8yC11Vr1Mu5sqZyQ33GaSCr0uUIbQnGkm0aWqZj62Kg= -github.com/codex-storage/codex-go-bindings v0.0.18 h1:0l9XEoH9O5Akg7KCJreZq5jQxdky8Y79T/2TopHdBIY= -github.com/codex-storage/codex-go-bindings v0.0.18/go.mod h1:8yC11Vr1Mu5sqZyQ33GaSCr0uUIbQnGkm0aWqZj62Kg= -github.com/codex-storage/codex-go-bindings v0.0.19 h1:zhEhwzcavvYdfkHpB5BH+PaqYvQ4VonIKhebS1vbKh0= -github.com/codex-storage/codex-go-bindings v0.0.19/go.mod h1:8yC11Vr1Mu5sqZyQ33GaSCr0uUIbQnGkm0aWqZj62Kg= -github.com/codex-storage/codex-go-bindings v0.0.20 h1:vK9jU8vafSJkMpOEHdPiQ9S8owSGUaPGVUxb7hKaIck= -github.com/codex-storage/codex-go-bindings v0.0.20/go.mod h1:8yC11Vr1Mu5sqZyQ33GaSCr0uUIbQnGkm0aWqZj62Kg= -github.com/codex-storage/codex-go-bindings v0.0.21 h1:DAwXw2Xq7wyKyI5j3Jk8ZYBruFP9dOpqEeVMOyEsJxA= -github.com/codex-storage/codex-go-bindings v0.0.21/go.mod h1:8yC11Vr1Mu5sqZyQ33GaSCr0uUIbQnGkm0aWqZj62Kg= +github.com/logos-storage/logos-storage-go-bindings v0.0.30 h1:9shX7u87WjsZKwUVzWxafpNSd/X5ii33WvYLjo5vTBs= +github.com/logos-storage/logos-storage-go-bindings v0.0.30/go.mod h1:5NzkHakOYX0iwgJk9X6NKN3AoDIvr8JTwpnl5SWdPVg= diff --git a/main.go b/main.go index 149fbe8..ee29e1b 100644 --- a/main.go +++ b/main.go @@ -2,34 +2,35 @@ package main import ( "bytes" + "context" "log" "os" - "github.com/codex-storage/codex-go-bindings/codex" + "github.com/logos-storage/logos-storage-go-bindings/storage" ) func main() { - node, err := codex.New(codex.Config{ + node, err := storage.New(storage.Config{ BlockRetries: 5, }) if err != nil { - log.Fatalf("Failed to create Codex node: %v", err) + log.Fatalf("Failed to create Logos Storage node: %v", err) } version, err := node.Version() if err != nil { - log.Fatalf("Failed to get Codex version: %v", err) + log.Fatalf("Failed to get Logos Storage version: %v", err) } - log.Printf("Codex version: %s", version) + log.Printf("Logos Storage version: %s", version) if err := node.Start(); err != nil { - log.Fatalf("Failed to start Codex node: %v", err) + log.Fatalf("Failed to start Logos Storage node: %v", err) } - log.Println("Codex node started") + log.Println("Logos Storage node started") buf := bytes.NewBuffer([]byte("Hello World!")) len := buf.Len() - cid, err := node.UploadReader(codex.UploadOptions{Filepath: "hello.txt"}, buf) + cid, err := node.UploadReader(context.Background(), storage.UploadOptions{Filepath: "hello.txt"}, buf) if err != nil { log.Fatalf("Failed to upload data: %v", err) } @@ -41,11 +42,11 @@ func main() { } defer f.Close() - opt := codex.DownloadStreamOptions{ + opt := storage.DownloadStreamOptions{ Writer: f, } - if err := node.DownloadStream(cid, opt); err != nil { + if err := node.DownloadStream(context.Background(), cid, opt); err != nil { log.Fatalf("Failed to download data: %v", err) } @@ -57,11 +58,11 @@ func main() { // <-ch if err := node.Stop(); err != nil { - log.Fatalf("Failed to stop Codex node: %v", err) + log.Fatalf("Failed to stop Logos Storage node: %v", err) } - log.Println("Codex node stopped") + log.Println("Logos Storage node stopped") if err := node.Destroy(); err != nil { - log.Fatalf("Failed to destroy Codex node: %v", err) + log.Fatalf("Failed to destroy Logos Storage node: %v", err) } } From fd0452e3ccf8b6a62c58fdf0a4587dace16657d6 Mon Sep 17 00:00:00 2001 From: Arnaud Date: Fri, 6 Mar 2026 10:32:39 +0400 Subject: [PATCH 2/5] Use darwin instead of macos --- .github/workflows/ci.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8e727c5..85ef735 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: name: linux - os: macos-latest - name: macos + name: darwin cpu: arm64 - os: windows-latest diff --git a/README.md b/README.md index 5213f5a..8c52349 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ The default `OS` is `linux` and the default `ARCH` is `amd64`. You can provide them as environment variables: ```sh -OS="macos" ARCH="arm64" make fetch +OS="darwin" ARCH="arm64" make fetch ``` You can change the version by providing it as environment variables: From 96b9f6715016520cd35c72973a1bf763cf9d668b Mon Sep 17 00:00:00 2001 From: Arnaud Date: Wed, 18 Mar 2026 12:13:22 +0400 Subject: [PATCH 3/5] Update Makefile --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 572a502..549d749 100644 --- a/Makefile +++ b/Makefile @@ -15,12 +15,12 @@ endif # Configuration for fetching the right binary OS ?= "linux" ARCH ?= "amd64" -VERSION ?= "v0.3.1" -DOWNLOAD_URL := "https://github.com/logos-storage/logos-storage-nim/releases/download/$(VERSION)/libstorage-${OS}-${ARCH}-$(VERSION).zip" +VERSION ?= "v0.3.2" +DOWNLOAD_URL := "https://github.com/logos-storage/logos-storage-nim/releases/download/$(VERSION)/libstorage-${OS}-${ARCH}-$(VERSION).zip" all: run -fetch: +fetch: @echo "Fetching libstorage from GitHub Actions from: ${DOWNLOAD_URL}" curl -fSL --create-dirs -o $(LIBS_DIR)/libstorage-${OS}-${ARCH}-$(VERSION).zip ${DOWNLOAD_URL} unzip -o -qq $(LIBS_DIR)/libstorage-${OS}-${ARCH}-$(VERSION).zip -d $(LIBS_DIR) @@ -38,4 +38,4 @@ endif clean: rm -f $(BIN_NAME) - rm -Rf $(LIBS_DIR)/* \ No newline at end of file + rm -Rf $(LIBS_DIR)/* From 24aee88e9dc0959a6ea8a17092a815a9bfd8c210 Mon Sep 17 00:00:00 2001 From: Arnaud Date: Wed, 18 Mar 2026 12:16:40 +0400 Subject: [PATCH 4/5] Update version --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 016c212..d10c119 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module example go 1.25.1 -require github.com/logos-storage/logos-storage-go-bindings v0.0.30 +require github.com/logos-storage/logos-storage-go-bindings v0.3.2 diff --git a/go.sum b/go.sum index 35c80d0..12caacf 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,2 @@ -github.com/logos-storage/logos-storage-go-bindings v0.0.30 h1:9shX7u87WjsZKwUVzWxafpNSd/X5ii33WvYLjo5vTBs= -github.com/logos-storage/logos-storage-go-bindings v0.0.30/go.mod h1:5NzkHakOYX0iwgJk9X6NKN3AoDIvr8JTwpnl5SWdPVg= +github.com/logos-storage/logos-storage-go-bindings v0.3.2 h1:pG2j+sPyhb4u04qK12F1Rpo02HxKy22ENIGvXzbgMMM= +github.com/logos-storage/logos-storage-go-bindings v0.3.2/go.mod h1:5NzkHakOYX0iwgJk9X6NKN3AoDIvr8JTwpnl5SWdPVg= From 76ca7ed86d8d1cd3dfb31fee38245c245d655244 Mon Sep 17 00:00:00 2001 From: Arnaud Date: Wed, 18 Mar 2026 12:19:00 +0400 Subject: [PATCH 5/5] Update version usage --- main.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index ee29e1b..870c5fb 100644 --- a/main.go +++ b/main.go @@ -17,10 +17,8 @@ func main() { log.Fatalf("Failed to create Logos Storage node: %v", err) } - version, err := node.Version() - if err != nil { - log.Fatalf("Failed to get Logos Storage version: %v", err) - } + version := node.Version() + log.Printf("Logos Storage version: %s", version) if err := node.Start(); err != nil {