refactor(enclave): restructure enclave to use go-pdk and support WASM target

This commit is contained in:
2026-01-09 08:19:15 -05:00
parent 842fdc1923
commit 527dfee7f6
4 changed files with 17 additions and 1027 deletions

View File

@@ -170,16 +170,22 @@ if err != nil {
``` ```
motr-enclave/ motr-enclave/
├── main.go # Plugin entry point, exported functions ├── cmd/
├── db/ │ └── enclave/
├── schema.sql # Database schema └── main.go # Plugin entry point (WASM-only, go-pdk imports)
│ ├── query.sql # SQLC query definitions ├── internal/
── *.go # Generated SQLC code ── keybase/ # Database access layer
├── sqlc.yaml # SQLC configuration │ ├── crypto/ # Cryptographic operations
├── Makefile # Build commands │ ├── state/ # Plugin state management (WASM-only)
└── go.mod # Go module │ ├── types/ # Input/output type definitions
│ └── migrations/ # Database migrations
├── sqlc.yaml # SQLC configuration
├── Makefile # Build commands
└── go.mod # Go module
``` ```
Note: Files with `//go:build wasip1` constraint (cmd/enclave/, internal/state/) only compile for WASM target.
## Dependencies ## Dependencies
Install with `make deps`: Install with `make deps`:

View File

@@ -15,7 +15,7 @@ deps:
build: build:
@echo "Building WASM plugin..." @echo "Building WASM plugin..."
@GOOS=wasip1 GOARCH=wasm go build -buildmode=c-shared -o $(BUILD_DIR)/$(BINARY) . @GOOS=wasip1 GOARCH=wasm go build -buildmode=c-shared -o $(BUILD_DIR)/$(BINARY) ./cmd/enclave
@echo "Built $(BUILD_DIR)/$(BINARY)" @echo "Built $(BUILD_DIR)/$(BINARY)"
sdk: sdk:

View File

@@ -1,3 +1,5 @@
//go:build wasip1
// Package state contains the state of the enclave. // Package state contains the state of the enclave.
package state package state

1018
main.go

File diff suppressed because it is too large Load Diff