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

nfs: support object store and full-featured sync #3823

Merged
merged 30 commits into from
Oct 7, 2023
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
166b29c
use NFS as object store
davies May 30, 2023
a722148
merge from main
Hexilee Jun 9, 2023
7050d56
upgrade nfs client: file support ReadAt
Hexilee Jun 9, 2023
52b4a7d
merge from origin main
Hexilee Jun 12, 2023
53cd38b
implement List for nfsStore
Hexilee Jun 12, 2023
da32201
remove unused methods
Hexilee Jun 12, 2023
332b0a8
fix nfs store
Hexilee Jun 13, 2023
d3615c7
implement chtimes, chown and chmod
Hexilee Jun 14, 2023
2165e5f
fix list
Hexilee Jun 15, 2023
5ed16ec
fix set mtime
Hexilee Jun 15, 2023
111f57d
fix nfs uid and gid
Hexilee Jun 15, 2023
390e86f
fix needCopyPerms
Hexilee Jun 15, 2023
dae60ef
support symlink
Hexilee Jun 15, 2023
93cc037
fix sort
Hexilee Jun 16, 2023
860e91b
remove test file
Hexilee Jun 16, 2023
95ef6d4
mkdir when parent of symlink not exist
Hexilee Jun 16, 2023
60e8dd6
fix List symlink in symlink
Hexilee Jun 16, 2023
309455b
fix ListAllWithDelimiter
Hexilee Jun 16, 2023
e6b079c
fix symlink
Hexilee Jun 16, 2023
77afe7a
remove test dir
Hexilee Jun 16, 2023
23d3f79
fix symlink chtimes
Hexilee Jun 16, 2023
2146e55
check url
Hexilee Jun 16, 2023
9afd90f
fix building
Hexilee Jun 19, 2023
b49a42e
update nfs client
Hexilee Jun 19, 2023
70934e9
merge from origin main: fix awscli
Hexilee Jun 19, 2023
3c58edf
merge from main
Hexilee Sep 21, 2023
f42ba41
nfs support followLink
Hexilee Sep 21, 2023
261aa5a
fix building with nonfs
Hexilee Sep 21, 2023
e6eda47
skip check sum for symlink
Hexilee Oct 7, 2023
538505b
rollback some unreleted changes
davies Oct 7, 2023
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
3 changes: 2 additions & 1 deletion cmd/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,6 @@ func createSyncStorage(uri string, conf *sync.Config) (object.ObjectStorage, err
secretKey, _ = user.Password()
}
name := strings.ToLower(u.Scheme)

var endpoint string
if name == "file" {
endpoint = u.Path
Expand All @@ -323,6 +322,8 @@ func createSyncStorage(uri string, conf *sync.Config) (object.ObjectStorage, err
if os.Getenv(endpoint) != "" {
conf.Env[endpoint] = os.Getenv(endpoint)
}
} else if name == "nfs" {
endpoint = u.Host + u.Path
} else if !conf.NoHTTPS && supportHTTPS(name, u.Host) {
endpoint = "https://" + u.Host
} else {
Expand Down
8 changes: 8 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ require (
github.com/urfave/cli/v2 v2.19.3
github.com/vbauerster/mpb/v7 v7.0.3
github.com/viki-org/dnscache v0.0.0-20130720023526-c70c1f23c5d8
github.com/vmware/go-nfs-client v0.0.0-20190605212624-d43b92724c1b
github.com/volcengine/ve-tos-golang-sdk/v2 v2.5.3
github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a
go.etcd.io/etcd v3.3.27+incompatible
Expand All @@ -80,6 +81,11 @@ require (
xorm.io/xorm v1.0.7
)

require (
github.com/rasky/go-xdr v0.0.0-20170124162913-1a41d1a06c93 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
)

require (
cloud.google.com/go v0.102.1 // indirect
cloud.google.com/go/iam v0.3.0 // indirect
Expand Down Expand Up @@ -258,3 +264,5 @@ replace xorm.io/xorm v1.0.7 => gitea.com/davies/xorm v1.0.8-0.20220528043536-552
replace github.com/huaweicloud/huaweicloud-sdk-go-obs v3.21.12+incompatible => github.com/juicedata/huaweicloud-sdk-go-obs v3.22.12-0.20230228031208-386e87b5c091+incompatible

replace github.com/urfave/cli/v2 v2.19.3 => github.com/juicedata/cli/v2 v2.19.4-0.20230605075551-9c9c5c0dce83

replace github.com/vmware/go-nfs-client v0.0.0-20190605212624-d43b92724c1b => github.com/juicedata/go-nfs-client v0.0.0-20230619072909-36eec939432b
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,8 @@ github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/juicedata/cli/v2 v2.19.4-0.20230605075551-9c9c5c0dce83 h1:RyHTka3jCnTaUqfRYjlwcQlr53aasmkvHEbYLXthqr8=
github.com/juicedata/cli/v2 v2.19.4-0.20230605075551-9c9c5c0dce83/go.mod h1:1CNUng3PtjQMtRzJO4FMXBQvkGtuYRxxiR9xMa7jMwI=
github.com/juicedata/go-nfs-client v0.0.0-20230619072909-36eec939432b h1:tZixumON7boPNeTPBkaD5ObOUJ8DaES4VL17XMrY0BU=
github.com/juicedata/go-nfs-client v0.0.0-20230619072909-36eec939432b/go.mod h1:xOMqi3lOrcGe9uZLnSzgaq94Vc3oz6VPCNDLJUnXpKs=
github.com/juicedata/go-fuse/v2 v2.1.1-0.20230726081302-124dbfa991d7 h1:4evzoVz1/AZfk9tqxWdzVYTMl2dC7VjEJHfaSFDrKS8=
github.com/juicedata/go-fuse/v2 v2.1.1-0.20230726081302-124dbfa991d7/go.mod h1:B1nGE/6RBFyBRC1RRnf23UpwCdyJ31eukw34oAKukAc=
github.com/juicedata/godaemon v0.0.0-20210629045518-3da5144a127d h1:kpQMvNZJKGY3PTt7OSoahYc4nM0HY67SvK0YyS0GLwA=
Expand Down Expand Up @@ -898,6 +900,8 @@ github.com/qiniu/go-sdk/v7 v7.15.0 h1:vkxZZHM2Ed0qHeIx7NF3unXav+guaVIXlEsCCkpQAw
github.com/qiniu/go-sdk/v7 v7.15.0/go.mod h1:nqoYCNo53ZlGA521RvRethvxUDvXKt4gtYXOwye868w=
github.com/qiniu/x v1.10.5/go.mod h1:03Ni9tj+N2h2aKnAz+6N0Xfl8FwMEDRC2PAlxekASDs=
github.com/rainycape/memcache v0.0.0-20150622160815-1031fa0ce2f2/go.mod h1:7tZKcyumwBO6qip7RNQ5r77yrssm9bfCowcLEBcU5IA=
github.com/rasky/go-xdr v0.0.0-20170124162913-1a41d1a06c93 h1:UVArwN/wkKjMVhh2EQGC0tEc1+FqiLlvYXY5mQ2f8Wg=
github.com/rasky/go-xdr v0.0.0-20170124162913-1a41d1a06c93/go.mod h1:Nfe4efndBz4TibWycNE+lqyJZiMX4ycx+QKV8Ta0f/o=
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/redis/go-redis/v9 v9.0.2 h1:BA426Zqe/7r56kCcvxYLWe1mkaz71LKF77GwgFzSxfE=
github.com/redis/go-redis/v9 v9.0.2/go.mod h1:/xDTe9EF1LM61hek62Poq2nzQSGj0xSrEtEHbBQevps=
Expand Down
6 changes: 3 additions & 3 deletions pkg/object/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ func (d *filestore) Head(key string) (Object, error) {
if err != nil {
return nil, err
}
return d.toFile(key, fi, false), nil
return toFile(key, fi, false), nil
}

func (d *filestore) toFile(key string, fi fs.FileInfo, isSymlink bool) *file {
func toFile(key string, fi fs.FileInfo, isSymlink bool) *file {
size := fi.Size()
if fi.IsDir() {
size = 0
Expand Down Expand Up @@ -299,7 +299,7 @@ func (d *filestore) List(prefix, marker, delimiter string, limit int64, followLi
continue
}
info := e.Info()
f := d.toFile(key, info, e.isSymlink)
f := toFile(key, info, e.isSymlink)
objs = append(objs, f)
if len(objs) == int(limit) {
break
Expand Down
Loading