Skip to content

Commit

Permalink
CephFS Reva v0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
thmour committed Oct 14, 2020
1 parent 3645f8b commit e7c0010
Show file tree
Hide file tree
Showing 9 changed files with 1,978 additions and 2 deletions.
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ github.com/cs3org/go-cs3apis v0.0.0-20200810113633-b00aca449666 h1:E7VsSSN/2YZLS
github.com/cs3org/go-cs3apis v0.0.0-20200810113633-b00aca449666/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY=
github.com/cs3org/go-cs3apis v0.0.0-20200903142434-7dfeb0059208 h1:EnNRlx2qlHh1l4rLIdlA2QVwvHyKT1KFZxRyDqm0NNQ=
github.com/cs3org/go-cs3apis v0.0.0-20200903142434-7dfeb0059208/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY=
github.com/cs3org/go-cs3apis v0.0.0-20200929101248-821df597ec8d h1:YDnGz3eTIYQDXzJd/zefEsl0qbz/P63e8KWjSjYlb5Q=
github.com/cs3org/go-cs3apis v0.0.0-20200929101248-821df597ec8d/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down
61 changes: 61 additions & 0 deletions pkg/storage/fs/cephfs/cephfs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Copyright 2018-2020 CERN
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// In applying this license, CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

package cephfs

import (
"github.com/cs3org/reva/pkg/storage"
"github.com/cs3org/reva/pkg/storage/fs/registry"
"github.com/cs3org/reva/pkg/storage/utils/cephfs"
"github.com/mitchellh/mapstructure"
"github.com/pkg/errors"
)

func init() {
registry.Register("cephfs", New)
}

type config struct {
Root string `mapstructure:"root" docs:"/var/tmp/reva/;Path of root directory for user storage."`
ShareFolder string `mapstructure:"share_folder" docs:"/MyShares;Path for storing share references."`
}

func parseConfig(m map[string]interface{}) (*config, error) {
c := &config{}
if err := mapstructure.Decode(m, c); err != nil {
err = errors.Wrap(err, "error decoding conf")
return nil, err
}
return c, nil
}

// New returns an implementation to of the storage.FS interface that talks to
// a ceph filesystem with user homes disabled.
func New(m map[string]interface{}) (storage.FS, error) {
c, err := parseConfig(m)
if err != nil {
return nil, err
}

conf := cephfs.Config{
Root: c.Root,
ShareFolder: c.ShareFolder,
DisableHome: false,
}
return cephfs.NewCephFS(&conf)
}
1 change: 1 addition & 0 deletions pkg/storage/fs/loader/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package loader

import (
// Load core storage filesystem backends.
_ "github.com/cs3org/reva/pkg/storage/fs/cephfs"
_ "github.com/cs3org/reva/pkg/storage/fs/eos"
_ "github.com/cs3org/reva/pkg/storage/fs/eosgrpc"
_ "github.com/cs3org/reva/pkg/storage/fs/eoshome"
Expand Down
Loading

0 comments on commit e7c0010

Please sign in to comment.