Skip to content

Commit

Permalink
Implement basic operations (#7)
Browse files Browse the repository at this point in the history
* Implement basic operations

Signed-off-by: Xuanwo <[email protected]>

* Remove build on windows

Signed-off-by: Xuanwo <[email protected]>

* Fix build

Signed-off-by: Xuanwo <[email protected]>

* Update badger

Signed-off-by: Xuanwo <[email protected]>

* Readdir is work

Signed-off-by: Xuanwo <[email protected]>

* Fix inode not found

Signed-off-by: Xuanwo <[email protected]>
  • Loading branch information
Xuanwo authored Jul 15, 2021
1 parent 236c009 commit 55e6986
Show file tree
Hide file tree
Showing 17 changed files with 1,804 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
matrix:
go: [ "1.15", "1.16" ]
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, macos-latest]

steps:
- name: Set up Go 1.x
Expand Down
32 changes: 14 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,25 @@ help:
@echo " build to create bin directory and build"
@echo " test to run test"

check: vet

format:
@echo "go fmt"
@go fmt ./...
@echo "ok"
go fmt ./...

vet:
@echo "go vet"
@go vet ./...
@echo "ok"
go vet ./...

generate:
go generate ./...

build: tidy format check
@echo "build storage"
@go build -o bin/beyondfs ./cmd/beyondfs
@echo "ok"
build: tidy generate format vet
go build -o bin/beyondfs ./cmd/beyondfs

test:
@echo "run test"
@go test -race -coverprofile=coverage.txt -covermode=atomic -v ./...
@go tool cover -html="coverage.txt" -o "coverage.html"
@echo "ok"
go test -race -coverprofile=coverage.txt -covermode=atomic -v ./...
go tool cover -html="coverage.txt" -o "coverage.html"

tidy:
@go mod tidy
@go mod verify
go mod tidy
go mod verify

clean:
find . -type f -name '*gen*.go' -delete
35 changes: 34 additions & 1 deletion cmd/beyondfs/main.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
package main

import (
"os"

"go.uber.org/zap"

"github.com/beyondstorage/beyond-fs/fuse/hanwen"
"github.com/beyondstorage/beyond-fs/vfs"
)

func main() {
print("Hello, world!")
logger, _ := zap.NewDevelopment()

cfg := &vfs.Config{
StoragePath: os.Getenv("BEYONDFS_UNDER_PATH"),

Logger: logger,
}

fs, err := vfs.NewFS(cfg)
if err != nil {
logger.Error("new fs", zap.Error(err))
return
}

srv, err := hanwen.New(&hanwen.Config{
FileSystem: fs,
MountPoint: os.Getenv("BEYONDFS_MOUNT_PATH"),
Logger: logger,
})
if err != nil {
logger.Error("new hanwen fuse", zap.Error(err))
return
}

srv.Serve()
}
10 changes: 10 additions & 0 deletions fuse/hanwen/const.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package hanwen

import "math"

const (
BlockSize = 4096
MaximumSpace = 1024 * 1024 * 1024 * 1024 * 1024 // Set total space to 1PB
MaximumBlocks = MaximumSpace / BlockSize
MaximumInodes = math.MaxUint64 // Set maximum inodes to max uint64.
)
Loading

0 comments on commit 55e6986

Please sign in to comment.