Skip to content

Commit

Permalink
th
Browse files Browse the repository at this point in the history
Signed-off-by: root <root@cephdev8.cern.ch>
  • Loading branch information
thmour authored and root committed Oct 14, 2020
1 parent faf4ccf commit 6fc7282
Show file tree
Hide file tree
Showing 11 changed files with 2,090 additions and 2 deletions.
26 changes: 26 additions & 0 deletions docs/content/en/docs/config/packages/storage/fs/ceph/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: "ceph"
linkTitle: "ceph"
weight: 10
description: >
Configuration for the ceph service
---

# _struct: config_

{{% dir name="root" type="string" default="/var/tmp/reva/" %}}
Path of root directory for user storage. [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/storage/fs/ceph/ceph.go#L34)
{{< highlight toml >}}
[storage.fs.ceph]
root = "/var/tmp/reva/"
{{< /highlight >}}
{{% /dir %}}

{{% dir name="share_folder" type="string" default="/MyShares" %}}
Path for storing share references. [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/storage/fs/ceph/ceph.go#L35)
{{< highlight toml >}}
[storage.fs.ceph]
share_folder = "/MyShares"
{{< /highlight >}}
{{% /dir %}}

26 changes: 26 additions & 0 deletions docs/content/en/docs/config/packages/storage/fs/cephfs/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: "cephfs"
linkTitle: "cephfs"
weight: 10
description: >
Configuration for the cephfs service
---

# _struct: config_

{{% dir name="root" type="string" default="/var/tmp/reva/" %}}
Path of root directory for user storage. [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/storage/fs/cephfs/cephfs.go#L34)
{{< highlight toml >}}
[storage.fs.cephfs]
root = "/var/tmp/reva/"
{{< /highlight >}}
{{% /dir %}}

{{% dir name="share_folder" type="string" default="/MyShares" %}}
Path for storing share references. [[Ref]](https://github.com/cs3org/reva/tree/master/pkg/storage/fs/cephfs/cephfs.go#L35)
{{< highlight toml >}}
[storage.fs.cephfs]
share_folder = "/MyShares"
{{< /highlight >}}
{{% /dir %}}

61 changes: 61 additions & 0 deletions pkg/storage/fs/ceph/ceph.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 ceph

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("ceph", 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)
}
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 6fc7282

Please sign in to comment.