Conversation
| // server. | ||
| type Handler struct { | ||
| FileSystem FileSystem | ||
|
|
There was a problem hiding this comment.
I apologize for coming uninvited; I am somewhat certain this is not the best practice. The ideal implementation should be to fully determine the Locks interface first, and then implement b := backend{FileSystem: h.FileSystem, LockSystem: h.LockSystem} here. Additionally, h.LockSystem should default to MemoryLockSystem (a new independently implemented struct that conforms to the LockSystem interface).
There was a problem hiding this comment.
On IRC @emersion suggested that ideally webdav.FileSystem should implement locking. I'm not sure which design would be better. I think we should also mind how other WebDAV RFCs would be implemented. For example ACLs (RFC 3744). Should we bubble everything to webdav.FileSystem?
There was a problem hiding this comment.
Should we bubble everything to webdav.FileSystem?
This approach is reasonable, but I believe we should still retain the ability to inject custom lockers to enhance extensibility. For instance, users might want to implement a locker using Redis to synchronize state across multiple gateway services accessing the same storage backend. However, if we expect users to inject an entire file system with built-in locking capabilities from the start, that would be a different matter entirely.
Without implementing MarshalText, these elements are marshaled as integers, so no "Second-xx" or "infinity".
Lock refresh requests have an empty body, so we shouldn't return error on empty lockscope or locktype.
Supersedes: #187
This is my attempt to partially implement exclusive resource locks to make some clients happy.
Included in this PR: LOCK and UNLOCK methods (partially, see below), lock checking on write operations.
Not included in this PR: locking unmapped URLs, collection locking (indirect locks, lock depth), lock timeouts, active lock discovery, preserving owner information, shared locks, checking if current principal matches lock creator, complex If header conditions.
I've tested this using Windows Explorer and litmus through sogogi (full report). I also added some test cases for the bugs I encountered along the way.
Litmus test summary
PROPPATCHfails because it's not implemented.I'm not sure about introducing
github.com/google/uuiddependency for generating lock tokens. Please let me know if there's a better way to do this.