-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: tmourati <[email protected]>
- Loading branch information
Showing
9 changed files
with
2,020 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Reva CephFS module v0.2 | ||
|
||
This is a work-in-progress module for a CephFS backend. Currently we support snapshot file versions and ctime propagation. | ||
|
||
https://github.com/cs3org/reva/pull/1209 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.