MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / canCreate

Method canCreate

server/webdav/lock.go:291–313  ·  view source on GitHub ↗
(name string, zeroDepth bool)

Source from the content-addressed store, hash-verified

289}
290
291func (m *memLS) canCreate(name string, zeroDepth bool) bool {
292 return walkToRoot(name, func(name0 string, first bool) bool {
293 n := m.byName[name0]
294 if n == nil {
295 return true
296 }
297 if first {
298 if n.token != "" {
299 // The target node is already locked.
300 return false
301 }
302 if !zeroDepth {
303 // The requested lock depth is infinite, and the fact that n exists
304 // (n != nil) means that a descendent of the target node is locked.
305 return false
306 }
307 } else if n.token != "" && !n.details.ZeroDepth {
308 // An ancestor of the target node is locked with infinite depth.
309 return false
310 }
311 return true
312 })
313}
314
315func (m *memLS) create(name string) (ret *memLSNode) {
316 walkToRoot(name, func(name0 string, first bool) bool {

Callers 2

CreateMethod · 0.95
TestMemLSCanCreateFunction · 0.80

Calls 1

walkToRootFunction · 0.85

Tested by 1

TestMemLSCanCreateFunction · 0.64