-
Notifications
You must be signed in to change notification settings - Fork 113
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
ocis storage driver #559
ocis storage driver #559
Conversation
8f73e01
to
817e639
Compare
Move fails with
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments, many already discussed partly
func (fs *Tree) Propagate(ctx context.Context, node *NodeInfo) (err error) { | ||
// generate an etag | ||
bytes := make([]byte, 16) | ||
if _, err := rand.Read(bytes); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I seem to remember you saying that we generate the etag based on mtime ? or was it just an idea ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an idea ... for migrations / backup we need to be able to store an etag. the owncloud driver already has some logic for that.
|
||
node.BecomeParent() | ||
} | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems we don't have mtime propagation here
|
||
var defaultFilePerm = os.FileMode(0664) | ||
|
||
// TODO deprecated ... use tus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
separate ticket or checkbox ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments for latest additions
|
||
_, err = io.Copy(tmp, r) | ||
if err != nil { | ||
return errors.Wrap(err, "ocisfs: error writing to tmp file "+tmp.Name()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete temp file on error or does this happen automatically ? how often ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm ... the put is deprecated ... but yeah we should delete the file in this case
// versions are stored alongside the actual file, so a rename can be efficient and does not cross storage / partition boundaries | ||
versionsPath := filepath.Join(upload.fs.conf.Root, "nodes", n.ID+".REV."+fi.ModTime().UTC().Format(time.RFC3339Nano)) | ||
|
||
if err := os.Rename(targetPath, versionsPath); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a copy might be better in case the below rename fails, in which case the file would disappear completely from view
return err | ||
} | ||
|
||
if err := xattr.Set(targetPath, "user.ocis.parentid", []byte(n.ParentID)); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wondering if we're going too low-level here and whether the upload code should talk to a higher level API, one that simply configures the node correctly, with xattrs and children.
let's get this merged, since the main file operations work follow up for the remaining tasks:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, as discussed 👍
weird results:
so this broke something related to trashbin on OC storage but also fixed other things ?! |
@butonic can you add instructions in the top POST about how to test it ? it is not clear to me what env variables to switch to get the proper working setup |
we might want for #1148 to be merged first |
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
I guess that it needs a rebase. The core commit id to use for tests is embedded in |
the failing tests are related to accessing another user's trashbin.
there is a slight chance that the permission refactoring that happened affects this |
more bad luck striking:
|
okay, so now all tests passed (except litmus hiccup)... so the rebase worked... |
It would be nice to have #1148 merged - that will get the core API test suite having some more accept share scenarios, which are running in the ocis and ocis-reva repos today. I am not sure who is able to review-approve-merge that. Then a rebase here and it should be good. |
we should close this in favor of #1155 |
A traditional filesystem uses paths to organize files in a tree. But path based references are not persistent because they change when a file is renamed or moved.
OCIS needs a persistent fileid to let other services reference files. Shares and favorites for example should not break when a file is moved or renamed.
A naive approach would use the fileid as the key and the path as the value for an efficient lookup. But this leads to n updates in the lookup table when a folder is renamed, because the path of all children changes.
Depending on the underlying storage a fast lookup by inode (btrfs, gpfs) or a truly unique fileid (eos) might be possible. For these a dedicated storage driver should be used. But keep in mind that inodes are reused, which might cause a purely inode based reference to point to a different file. Gpfs has an option to disable reusing inodes.
Ocisfs deconstructs a filesystem to provide a persistent fileid, an efficient file by ID lookup at the cost of more inodes.
Every file and folder is represented by an entry in the nodes folder. Directories have a children subfolder containing symlinks to child nodes. Files have a content file. A versions subfolder contains timestamp content entries.
While this node based layout may look confusing at first sight not everything is lost. The symlink pattern used in the children folder allow navigating the filesystem using the traditional tree hierarchy. In fact it is used to implement the path based lookup.
Why the content and children nodes? Why not use a uuid file or folder? Because we need a parent link? We can store that as an extended attribute instead of the parentname symlink.
We need the filename (changes on rename) and parentid (changes on move). This duplication might cause inconsistencies. Which could be mitigated using a journal with file operations.
The etag is an extended attribute anyway. Additional properties could be stored either in the fs as extended attributes or as an additional file in a root/properties/uuid Json or ini file. Might be an option
Versions could be stored in additional root/versions/uuid/timestamp files.
Basic file management is implemented, but this is missing:
Feedback welcome.