Skip to content

Commit

Permalink
CephFS module v0.2
Browse files Browse the repository at this point in the history
Signed-off-by: root <[email protected]>
  • Loading branch information
thmour authored and Theofilos Mouratidis committed Jan 20, 2021
1 parent a7bf52b commit b5e15e8
Show file tree
Hide file tree
Showing 8 changed files with 2,015 additions and 2 deletions.
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/eosgrpchome"
Expand Down
Loading

0 comments on commit b5e15e8

Please sign in to comment.