Skip to content

Commit

Permalink
refactor(logic): rename fs to virtual_fs
Browse files Browse the repository at this point in the history
  • Loading branch information
ccamel committed Apr 11, 2023
1 parent a8b2500 commit dd9d132
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
3 changes: 2 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"io"
"io/fs"
"net/http"
"os"
"path/filepath"
Expand Down Expand Up @@ -1061,7 +1062,7 @@ func (app *App) SimulationManager() *module.SimulationManager {

// provideFS is used to provide the virtual file system used for the logic module
// to load external file.
func (app *App) provideFS(ctx context.Context) logicfs.FS {
func (app *App) provideFS(ctx context.Context) fs.FS {
wasmHandler := logicfs.NewWasmHandler(app.WasmKeeper)
return logicfs.NewVirtualFS(ctx, []logicfs.URIHandler{wasmHandler})
}
6 changes: 1 addition & 5 deletions x/logic/fs/fs.go → x/logic/fs/virtual_fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@ import (
"io/fs"
)

type FS interface {
fs.FS
}

// VirtualFS is the custom virtual file system used into the blockchain.
// It will hold a list of handler that can resolve file URI and return the corresponding binary file.
type VirtualFS struct {
ctx goctx.Context
router Router
}

var _ FS = (*VirtualFS)(nil)
var _ fs.FS = (*VirtualFS)(nil)

// NewVirtualFS return a new VirtualFS object that will handle all virtual file on the interpreter.
// File can be provided from different sources like CosmWasm cw-storage smart contract.
Expand Down
2 changes: 1 addition & 1 deletion x/logic/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package keeper
import (
goctx "context"
"fmt"
"io/fs"

"github.com/cometbft/cometbft/libs/log"
"github.com/cosmos/cosmos-sdk/codec"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/okp4/okp4d/x/logic/fs"
"github.com/okp4/okp4d/x/logic/types"
)

Expand Down

0 comments on commit dd9d132

Please sign in to comment.