Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement basic operations #7

Merged
merged 6 commits into from
Jul 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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