scripts: Renamed lookupleaf -> lookupnext_ to match lfs3.c
- lookupleaf -> lookupnext_ - namelookupleaf -> namelookup_ I want to move away from lookupleaf usage in general in the dbg scripts, like we have in lfs3.c, but I also just really don't want to touch these scripts again unless I need to. They've been useful, but also a big time sink. Maybe I should actually learn Python's new type system. That would probably help here...
This commit is contained in:
+30
-30
@@ -1171,7 +1171,7 @@ class Btree:
|
|||||||
shrub = Rbyd.fetchshrub(rbyd, trunk)
|
shrub = Rbyd.fetchshrub(rbyd, trunk)
|
||||||
return cls(bd, shrub)
|
return cls(bd, shrub)
|
||||||
|
|
||||||
def lookupleaf(self, bid, *,
|
def lookupnext_(self, bid, *,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
if not self or bid >= self.weight:
|
if not self or bid >= self.weight:
|
||||||
@@ -1230,7 +1230,7 @@ class Btree:
|
|||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
# just discard the rbyd info
|
# just discard the rbyd info
|
||||||
r = self.lookupleaf(bid,
|
r = self.lookupnext_(bid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -1250,11 +1250,11 @@ class Btree:
|
|||||||
#
|
#
|
||||||
# note this function expects bid to be known, use lookupnext
|
# note this function expects bid to be known, use lookupnext
|
||||||
# first if you don't care about the exact bid (or better yet,
|
# first if you don't care about the exact bid (or better yet,
|
||||||
# lookupleaf and call lookup on the returned rbyd)
|
# lookupnext_ and call lookup on the returned rbyd)
|
||||||
#
|
#
|
||||||
# this matches rbyd's lookup behavior, which needs a known rid
|
# this matches rbyd's lookup behavior, which needs a known rid
|
||||||
# to avoid a double lookup
|
# to avoid a double lookup
|
||||||
r = self.lookupleaf(bid,
|
r = self.lookupnext_(bid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -1295,7 +1295,7 @@ class Btree:
|
|||||||
|
|
||||||
bid = 0
|
bid = 0
|
||||||
while True:
|
while True:
|
||||||
r = self.lookupleaf(bid,
|
r = self.lookupnext_(bid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if r:
|
if r:
|
||||||
@@ -1390,7 +1390,7 @@ class Btree:
|
|||||||
else:
|
else:
|
||||||
yield bid_, rattr
|
yield bid_, rattr
|
||||||
else:
|
else:
|
||||||
r = self.lookupleaf(bid,
|
r = self.lookupnext_(bid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -1413,7 +1413,7 @@ class Btree:
|
|||||||
yield rattr
|
yield rattr
|
||||||
|
|
||||||
# lookup by name
|
# lookup by name
|
||||||
def namelookupleaf(self, did, name, *,
|
def namelookup_(self, did, name, *,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
rbyd = self.rbyd
|
rbyd = self.rbyd
|
||||||
@@ -1461,7 +1461,7 @@ class Btree:
|
|||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
# just discard the rbyd info
|
# just discard the rbyd info
|
||||||
r = self.namelookupleaf(did, name,
|
r = self.namelookup_(did, name,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -1875,7 +1875,7 @@ class Mtree:
|
|||||||
return cls(bd, mrootchain, mtree,
|
return cls(bd, mrootchain, mtree,
|
||||||
mbits=mbits)
|
mbits=mbits)
|
||||||
|
|
||||||
def _lookupleaf(self, mid, *,
|
def _lookupnext_(self, mid, *,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
if not isinstance(mid, Mid):
|
if not isinstance(mid, Mid):
|
||||||
@@ -1910,8 +1910,8 @@ class Mtree:
|
|||||||
|
|
||||||
# mtree? lookup in mtree
|
# mtree? lookup in mtree
|
||||||
else:
|
else:
|
||||||
# need to do two steps here in case lookupleaf stops early
|
# need to do two steps here in case lookupnext_ stops early
|
||||||
r = self.mtree.lookupleaf(mid.mid,
|
r = self.mtree.lookupnext_(mid.mid,
|
||||||
path=path or depth,
|
path=path or depth,
|
||||||
depth=depth-len(path_) if depth else None)
|
depth=depth-len(path_) if depth else None)
|
||||||
if path or depth:
|
if path or depth:
|
||||||
@@ -1955,13 +1955,13 @@ class Mtree:
|
|||||||
else:
|
else:
|
||||||
return mdir
|
return mdir
|
||||||
|
|
||||||
def lookupleaf(self, mid, *,
|
def lookupnext_(self, mid, *,
|
||||||
mdirs_only=True,
|
mdirs_only=True,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
# most of the logic is in _lookupleaf, this just helps
|
# most of the logic is in _lookupnext_, this just helps
|
||||||
# deduplicate the mdirs_only logic
|
# deduplicate the mdirs_only logic
|
||||||
r = self._lookupleaf(mid,
|
r = self._lookupnext_(mid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -1987,7 +1987,7 @@ class Mtree:
|
|||||||
mid = self.mid(mid)
|
mid = self.mid(mid)
|
||||||
|
|
||||||
# lookup the relevant mdir
|
# lookup the relevant mdir
|
||||||
r = self.lookupleaf(mid,
|
r = self.lookupnext_(mid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -2047,7 +2047,7 @@ class Mtree:
|
|||||||
|
|
||||||
mid = self.mid(0)
|
mid = self.mid(0)
|
||||||
while True:
|
while True:
|
||||||
r = self.lookupleaf(mid,
|
r = self.lookupnext_(mid,
|
||||||
mdirs_only=False,
|
mdirs_only=False,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
@@ -2225,7 +2225,7 @@ class Mtree:
|
|||||||
if not isinstance(mid, Mid):
|
if not isinstance(mid, Mid):
|
||||||
mid = self.mid(mid)
|
mid = self.mid(mid)
|
||||||
|
|
||||||
r = self.lookupleaf(mid,
|
r = self.lookupnext_(mid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -2251,7 +2251,7 @@ class Mtree:
|
|||||||
yield rattr
|
yield rattr
|
||||||
|
|
||||||
# lookup by name
|
# lookup by name
|
||||||
def _namelookupleaf(self, did, name, *,
|
def _namelookup_(self, did, name, *,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
if path or depth:
|
if path or depth:
|
||||||
@@ -2277,8 +2277,8 @@ class Mtree:
|
|||||||
|
|
||||||
# mtree? find name in mtree
|
# mtree? find name in mtree
|
||||||
else:
|
else:
|
||||||
# need to do two steps here in case namelookupleaf stops early
|
# need to do two steps here in case namelookup_ stops early
|
||||||
r = self.mtree.namelookupleaf(did, name,
|
r = self.mtree.namelookup_(did, name,
|
||||||
path=path or depth,
|
path=path or depth,
|
||||||
depth=depth-len(path_) if depth else None)
|
depth=depth-len(path_) if depth else None)
|
||||||
if path or depth:
|
if path or depth:
|
||||||
@@ -2322,13 +2322,13 @@ class Mtree:
|
|||||||
else:
|
else:
|
||||||
return mdir
|
return mdir
|
||||||
|
|
||||||
def namelookupleaf(self, did, name, *,
|
def namelookup_(self, did, name, *,
|
||||||
mdirs_only=True,
|
mdirs_only=True,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
# most of the logic is in _namelookupleaf, this just helps
|
# most of the logic is in _namelookup_, this just helps
|
||||||
# deduplicate the mdirs_only logic
|
# deduplicate the mdirs_only logic
|
||||||
r = self._namelookupleaf(did, name,
|
r = self._namelookup_(did, name,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -2351,7 +2351,7 @@ class Mtree:
|
|||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
# lookup the relevant mdir
|
# lookup the relevant mdir
|
||||||
r = self.namelookupleaf(did, name,
|
r = self.namelookup_(did, name,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -3322,7 +3322,7 @@ class Lfs3:
|
|||||||
mbid, mrid = mid.mbid, mid.mrid + 1
|
mbid, mrid = mid.mbid, mid.mrid + 1
|
||||||
if mrid == mdir.weight:
|
if mrid == mdir.weight:
|
||||||
mbid, mrid = mbid + (1 << self.mbits), 0
|
mbid, mrid = mbid + (1 << self.mbits), 0
|
||||||
mdir = self.mtree.lookupleaf(mbid)
|
mdir = self.mtree.lookupnext_(mbid)
|
||||||
if mdir is None:
|
if mdir is None:
|
||||||
break
|
break
|
||||||
# lookup name and adjust rid if necessary, you don't
|
# lookup name and adjust rid if necessary, you don't
|
||||||
@@ -3546,7 +3546,7 @@ class Lfs3:
|
|||||||
yield from self.sattrs()
|
yield from self.sattrs()
|
||||||
|
|
||||||
# lookup data in the underlying bshrub
|
# lookup data in the underlying bshrub
|
||||||
def _lookupleaf(self, pos, *,
|
def _lookupnext_(self, pos, *,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
# no bshrub?
|
# no bshrub?
|
||||||
@@ -3557,7 +3557,7 @@ class Lfs3:
|
|||||||
return None, None
|
return None, None
|
||||||
|
|
||||||
# lookup data in our bshrub
|
# lookup data in our bshrub
|
||||||
r = self.bshrub.lookupleaf(pos,
|
r = self.bshrub.lookupnext_(pos,
|
||||||
path=path or depth,
|
path=path or depth,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path or depth:
|
if path or depth:
|
||||||
@@ -3606,11 +3606,11 @@ class Lfs3:
|
|||||||
else:
|
else:
|
||||||
return bid-(rattr.weight-1), rattr
|
return bid-(rattr.weight-1), rattr
|
||||||
|
|
||||||
def lookupleaf(self, pos, *,
|
def lookupnext_(self, pos, *,
|
||||||
data_only=True,
|
data_only=True,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
r = self._lookupleaf(pos,
|
r = self._lookupnext_(pos,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -3634,7 +3634,7 @@ class Lfs3:
|
|||||||
depth=None):
|
depth=None):
|
||||||
pos = 0
|
pos = 0
|
||||||
while True:
|
while True:
|
||||||
r = self.lookupleaf(pos,
|
r = self.lookupnext_(pos,
|
||||||
data_only=False,
|
data_only=False,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
|
|||||||
+30
-30
@@ -1201,7 +1201,7 @@ class Btree:
|
|||||||
shrub = Rbyd.fetchshrub(rbyd, trunk)
|
shrub = Rbyd.fetchshrub(rbyd, trunk)
|
||||||
return cls(bd, shrub)
|
return cls(bd, shrub)
|
||||||
|
|
||||||
def lookupleaf(self, bid, *,
|
def lookupnext_(self, bid, *,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
if not self or bid >= self.weight:
|
if not self or bid >= self.weight:
|
||||||
@@ -1260,7 +1260,7 @@ class Btree:
|
|||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
# just discard the rbyd info
|
# just discard the rbyd info
|
||||||
r = self.lookupleaf(bid,
|
r = self.lookupnext_(bid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -1280,11 +1280,11 @@ class Btree:
|
|||||||
#
|
#
|
||||||
# note this function expects bid to be known, use lookupnext
|
# note this function expects bid to be known, use lookupnext
|
||||||
# first if you don't care about the exact bid (or better yet,
|
# first if you don't care about the exact bid (or better yet,
|
||||||
# lookupleaf and call lookup on the returned rbyd)
|
# lookupnext_ and call lookup on the returned rbyd)
|
||||||
#
|
#
|
||||||
# this matches rbyd's lookup behavior, which needs a known rid
|
# this matches rbyd's lookup behavior, which needs a known rid
|
||||||
# to avoid a double lookup
|
# to avoid a double lookup
|
||||||
r = self.lookupleaf(bid,
|
r = self.lookupnext_(bid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -1325,7 +1325,7 @@ class Btree:
|
|||||||
|
|
||||||
bid = 0
|
bid = 0
|
||||||
while True:
|
while True:
|
||||||
r = self.lookupleaf(bid,
|
r = self.lookupnext_(bid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if r:
|
if r:
|
||||||
@@ -1420,7 +1420,7 @@ class Btree:
|
|||||||
else:
|
else:
|
||||||
yield bid_, rattr
|
yield bid_, rattr
|
||||||
else:
|
else:
|
||||||
r = self.lookupleaf(bid,
|
r = self.lookupnext_(bid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -1443,7 +1443,7 @@ class Btree:
|
|||||||
yield rattr
|
yield rattr
|
||||||
|
|
||||||
# lookup by name
|
# lookup by name
|
||||||
def namelookupleaf(self, did, name, *,
|
def namelookup_(self, did, name, *,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
rbyd = self.rbyd
|
rbyd = self.rbyd
|
||||||
@@ -1491,7 +1491,7 @@ class Btree:
|
|||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
# just discard the rbyd info
|
# just discard the rbyd info
|
||||||
r = self.namelookupleaf(did, name,
|
r = self.namelookup_(did, name,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -1905,7 +1905,7 @@ class Mtree:
|
|||||||
return cls(bd, mrootchain, mtree,
|
return cls(bd, mrootchain, mtree,
|
||||||
mbits=mbits)
|
mbits=mbits)
|
||||||
|
|
||||||
def _lookupleaf(self, mid, *,
|
def _lookupnext_(self, mid, *,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
if not isinstance(mid, Mid):
|
if not isinstance(mid, Mid):
|
||||||
@@ -1940,8 +1940,8 @@ class Mtree:
|
|||||||
|
|
||||||
# mtree? lookup in mtree
|
# mtree? lookup in mtree
|
||||||
else:
|
else:
|
||||||
# need to do two steps here in case lookupleaf stops early
|
# need to do two steps here in case lookupnext_ stops early
|
||||||
r = self.mtree.lookupleaf(mid.mid,
|
r = self.mtree.lookupnext_(mid.mid,
|
||||||
path=path or depth,
|
path=path or depth,
|
||||||
depth=depth-len(path_) if depth else None)
|
depth=depth-len(path_) if depth else None)
|
||||||
if path or depth:
|
if path or depth:
|
||||||
@@ -1985,13 +1985,13 @@ class Mtree:
|
|||||||
else:
|
else:
|
||||||
return mdir
|
return mdir
|
||||||
|
|
||||||
def lookupleaf(self, mid, *,
|
def lookupnext_(self, mid, *,
|
||||||
mdirs_only=True,
|
mdirs_only=True,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
# most of the logic is in _lookupleaf, this just helps
|
# most of the logic is in _lookupnext_, this just helps
|
||||||
# deduplicate the mdirs_only logic
|
# deduplicate the mdirs_only logic
|
||||||
r = self._lookupleaf(mid,
|
r = self._lookupnext_(mid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -2017,7 +2017,7 @@ class Mtree:
|
|||||||
mid = self.mid(mid)
|
mid = self.mid(mid)
|
||||||
|
|
||||||
# lookup the relevant mdir
|
# lookup the relevant mdir
|
||||||
r = self.lookupleaf(mid,
|
r = self.lookupnext_(mid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -2077,7 +2077,7 @@ class Mtree:
|
|||||||
|
|
||||||
mid = self.mid(0)
|
mid = self.mid(0)
|
||||||
while True:
|
while True:
|
||||||
r = self.lookupleaf(mid,
|
r = self.lookupnext_(mid,
|
||||||
mdirs_only=False,
|
mdirs_only=False,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
@@ -2255,7 +2255,7 @@ class Mtree:
|
|||||||
if not isinstance(mid, Mid):
|
if not isinstance(mid, Mid):
|
||||||
mid = self.mid(mid)
|
mid = self.mid(mid)
|
||||||
|
|
||||||
r = self.lookupleaf(mid,
|
r = self.lookupnext_(mid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -2281,7 +2281,7 @@ class Mtree:
|
|||||||
yield rattr
|
yield rattr
|
||||||
|
|
||||||
# lookup by name
|
# lookup by name
|
||||||
def _namelookupleaf(self, did, name, *,
|
def _namelookup_(self, did, name, *,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
if path or depth:
|
if path or depth:
|
||||||
@@ -2307,8 +2307,8 @@ class Mtree:
|
|||||||
|
|
||||||
# mtree? find name in mtree
|
# mtree? find name in mtree
|
||||||
else:
|
else:
|
||||||
# need to do two steps here in case namelookupleaf stops early
|
# need to do two steps here in case namelookup_ stops early
|
||||||
r = self.mtree.namelookupleaf(did, name,
|
r = self.mtree.namelookup_(did, name,
|
||||||
path=path or depth,
|
path=path or depth,
|
||||||
depth=depth-len(path_) if depth else None)
|
depth=depth-len(path_) if depth else None)
|
||||||
if path or depth:
|
if path or depth:
|
||||||
@@ -2352,13 +2352,13 @@ class Mtree:
|
|||||||
else:
|
else:
|
||||||
return mdir
|
return mdir
|
||||||
|
|
||||||
def namelookupleaf(self, did, name, *,
|
def namelookup_(self, did, name, *,
|
||||||
mdirs_only=True,
|
mdirs_only=True,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
# most of the logic is in _namelookupleaf, this just helps
|
# most of the logic is in _namelookup_, this just helps
|
||||||
# deduplicate the mdirs_only logic
|
# deduplicate the mdirs_only logic
|
||||||
r = self._namelookupleaf(did, name,
|
r = self._namelookup_(did, name,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -2381,7 +2381,7 @@ class Mtree:
|
|||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
# lookup the relevant mdir
|
# lookup the relevant mdir
|
||||||
r = self.namelookupleaf(did, name,
|
r = self.namelookup_(did, name,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -3352,7 +3352,7 @@ class Lfs3:
|
|||||||
mbid, mrid = mid.mbid, mid.mrid + 1
|
mbid, mrid = mid.mbid, mid.mrid + 1
|
||||||
if mrid == mdir.weight:
|
if mrid == mdir.weight:
|
||||||
mbid, mrid = mbid + (1 << self.mbits), 0
|
mbid, mrid = mbid + (1 << self.mbits), 0
|
||||||
mdir = self.mtree.lookupleaf(mbid)
|
mdir = self.mtree.lookupnext_(mbid)
|
||||||
if mdir is None:
|
if mdir is None:
|
||||||
break
|
break
|
||||||
# lookup name and adjust rid if necessary, you don't
|
# lookup name and adjust rid if necessary, you don't
|
||||||
@@ -3576,7 +3576,7 @@ class Lfs3:
|
|||||||
yield from self.sattrs()
|
yield from self.sattrs()
|
||||||
|
|
||||||
# lookup data in the underlying bshrub
|
# lookup data in the underlying bshrub
|
||||||
def _lookupleaf(self, pos, *,
|
def _lookupnext_(self, pos, *,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
# no bshrub?
|
# no bshrub?
|
||||||
@@ -3587,7 +3587,7 @@ class Lfs3:
|
|||||||
return None, None
|
return None, None
|
||||||
|
|
||||||
# lookup data in our bshrub
|
# lookup data in our bshrub
|
||||||
r = self.bshrub.lookupleaf(pos,
|
r = self.bshrub.lookupnext_(pos,
|
||||||
path=path or depth,
|
path=path or depth,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path or depth:
|
if path or depth:
|
||||||
@@ -3636,11 +3636,11 @@ class Lfs3:
|
|||||||
else:
|
else:
|
||||||
return bid-(rattr.weight-1), rattr
|
return bid-(rattr.weight-1), rattr
|
||||||
|
|
||||||
def lookupleaf(self, pos, *,
|
def lookupnext_(self, pos, *,
|
||||||
data_only=True,
|
data_only=True,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
r = self._lookupleaf(pos,
|
r = self._lookupnext_(pos,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -3664,7 +3664,7 @@ class Lfs3:
|
|||||||
depth=None):
|
depth=None):
|
||||||
pos = 0
|
pos = 0
|
||||||
while True:
|
while True:
|
||||||
r = self.lookupleaf(pos,
|
r = self.lookupnext_(pos,
|
||||||
data_only=False,
|
data_only=False,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
|
|||||||
+8
-8
@@ -1029,7 +1029,7 @@ class Btree:
|
|||||||
shrub = Rbyd.fetchshrub(rbyd, trunk)
|
shrub = Rbyd.fetchshrub(rbyd, trunk)
|
||||||
return cls(bd, shrub)
|
return cls(bd, shrub)
|
||||||
|
|
||||||
def lookupleaf(self, bid, *,
|
def lookupnext_(self, bid, *,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
if not self or bid >= self.weight:
|
if not self or bid >= self.weight:
|
||||||
@@ -1088,7 +1088,7 @@ class Btree:
|
|||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
# just discard the rbyd info
|
# just discard the rbyd info
|
||||||
r = self.lookupleaf(bid,
|
r = self.lookupnext_(bid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -1108,11 +1108,11 @@ class Btree:
|
|||||||
#
|
#
|
||||||
# note this function expects bid to be known, use lookupnext
|
# note this function expects bid to be known, use lookupnext
|
||||||
# first if you don't care about the exact bid (or better yet,
|
# first if you don't care about the exact bid (or better yet,
|
||||||
# lookupleaf and call lookup on the returned rbyd)
|
# lookupnext_ and call lookup on the returned rbyd)
|
||||||
#
|
#
|
||||||
# this matches rbyd's lookup behavior, which needs a known rid
|
# this matches rbyd's lookup behavior, which needs a known rid
|
||||||
# to avoid a double lookup
|
# to avoid a double lookup
|
||||||
r = self.lookupleaf(bid,
|
r = self.lookupnext_(bid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -1153,7 +1153,7 @@ class Btree:
|
|||||||
|
|
||||||
bid = 0
|
bid = 0
|
||||||
while True:
|
while True:
|
||||||
r = self.lookupleaf(bid,
|
r = self.lookupnext_(bid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if r:
|
if r:
|
||||||
@@ -1248,7 +1248,7 @@ class Btree:
|
|||||||
else:
|
else:
|
||||||
yield bid_, rattr
|
yield bid_, rattr
|
||||||
else:
|
else:
|
||||||
r = self.lookupleaf(bid,
|
r = self.lookupnext_(bid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -1271,7 +1271,7 @@ class Btree:
|
|||||||
yield rattr
|
yield rattr
|
||||||
|
|
||||||
# lookup by name
|
# lookup by name
|
||||||
def namelookupleaf(self, did, name, *,
|
def namelookup_(self, did, name, *,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
rbyd = self.rbyd
|
rbyd = self.rbyd
|
||||||
@@ -1319,7 +1319,7 @@ class Btree:
|
|||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
# just discard the rbyd info
|
# just discard the rbyd info
|
||||||
r = self.namelookupleaf(did, name,
|
r = self.namelookup_(did, name,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
|
|||||||
+30
-30
@@ -1096,7 +1096,7 @@ class Btree:
|
|||||||
shrub = Rbyd.fetchshrub(rbyd, trunk)
|
shrub = Rbyd.fetchshrub(rbyd, trunk)
|
||||||
return cls(bd, shrub)
|
return cls(bd, shrub)
|
||||||
|
|
||||||
def lookupleaf(self, bid, *,
|
def lookupnext_(self, bid, *,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
if not self or bid >= self.weight:
|
if not self or bid >= self.weight:
|
||||||
@@ -1155,7 +1155,7 @@ class Btree:
|
|||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
# just discard the rbyd info
|
# just discard the rbyd info
|
||||||
r = self.lookupleaf(bid,
|
r = self.lookupnext_(bid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -1175,11 +1175,11 @@ class Btree:
|
|||||||
#
|
#
|
||||||
# note this function expects bid to be known, use lookupnext
|
# note this function expects bid to be known, use lookupnext
|
||||||
# first if you don't care about the exact bid (or better yet,
|
# first if you don't care about the exact bid (or better yet,
|
||||||
# lookupleaf and call lookup on the returned rbyd)
|
# lookupnext_ and call lookup on the returned rbyd)
|
||||||
#
|
#
|
||||||
# this matches rbyd's lookup behavior, which needs a known rid
|
# this matches rbyd's lookup behavior, which needs a known rid
|
||||||
# to avoid a double lookup
|
# to avoid a double lookup
|
||||||
r = self.lookupleaf(bid,
|
r = self.lookupnext_(bid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -1220,7 +1220,7 @@ class Btree:
|
|||||||
|
|
||||||
bid = 0
|
bid = 0
|
||||||
while True:
|
while True:
|
||||||
r = self.lookupleaf(bid,
|
r = self.lookupnext_(bid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if r:
|
if r:
|
||||||
@@ -1315,7 +1315,7 @@ class Btree:
|
|||||||
else:
|
else:
|
||||||
yield bid_, rattr
|
yield bid_, rattr
|
||||||
else:
|
else:
|
||||||
r = self.lookupleaf(bid,
|
r = self.lookupnext_(bid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -1338,7 +1338,7 @@ class Btree:
|
|||||||
yield rattr
|
yield rattr
|
||||||
|
|
||||||
# lookup by name
|
# lookup by name
|
||||||
def namelookupleaf(self, did, name, *,
|
def namelookup_(self, did, name, *,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
rbyd = self.rbyd
|
rbyd = self.rbyd
|
||||||
@@ -1386,7 +1386,7 @@ class Btree:
|
|||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
# just discard the rbyd info
|
# just discard the rbyd info
|
||||||
r = self.namelookupleaf(did, name,
|
r = self.namelookup_(did, name,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -1800,7 +1800,7 @@ class Mtree:
|
|||||||
return cls(bd, mrootchain, mtree,
|
return cls(bd, mrootchain, mtree,
|
||||||
mbits=mbits)
|
mbits=mbits)
|
||||||
|
|
||||||
def _lookupleaf(self, mid, *,
|
def _lookupnext_(self, mid, *,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
if not isinstance(mid, Mid):
|
if not isinstance(mid, Mid):
|
||||||
@@ -1835,8 +1835,8 @@ class Mtree:
|
|||||||
|
|
||||||
# mtree? lookup in mtree
|
# mtree? lookup in mtree
|
||||||
else:
|
else:
|
||||||
# need to do two steps here in case lookupleaf stops early
|
# need to do two steps here in case lookupnext_ stops early
|
||||||
r = self.mtree.lookupleaf(mid.mid,
|
r = self.mtree.lookupnext_(mid.mid,
|
||||||
path=path or depth,
|
path=path or depth,
|
||||||
depth=depth-len(path_) if depth else None)
|
depth=depth-len(path_) if depth else None)
|
||||||
if path or depth:
|
if path or depth:
|
||||||
@@ -1880,13 +1880,13 @@ class Mtree:
|
|||||||
else:
|
else:
|
||||||
return mdir
|
return mdir
|
||||||
|
|
||||||
def lookupleaf(self, mid, *,
|
def lookupnext_(self, mid, *,
|
||||||
mdirs_only=True,
|
mdirs_only=True,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
# most of the logic is in _lookupleaf, this just helps
|
# most of the logic is in _lookupnext_, this just helps
|
||||||
# deduplicate the mdirs_only logic
|
# deduplicate the mdirs_only logic
|
||||||
r = self._lookupleaf(mid,
|
r = self._lookupnext_(mid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -1912,7 +1912,7 @@ class Mtree:
|
|||||||
mid = self.mid(mid)
|
mid = self.mid(mid)
|
||||||
|
|
||||||
# lookup the relevant mdir
|
# lookup the relevant mdir
|
||||||
r = self.lookupleaf(mid,
|
r = self.lookupnext_(mid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -1972,7 +1972,7 @@ class Mtree:
|
|||||||
|
|
||||||
mid = self.mid(0)
|
mid = self.mid(0)
|
||||||
while True:
|
while True:
|
||||||
r = self.lookupleaf(mid,
|
r = self.lookupnext_(mid,
|
||||||
mdirs_only=False,
|
mdirs_only=False,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
@@ -2150,7 +2150,7 @@ class Mtree:
|
|||||||
if not isinstance(mid, Mid):
|
if not isinstance(mid, Mid):
|
||||||
mid = self.mid(mid)
|
mid = self.mid(mid)
|
||||||
|
|
||||||
r = self.lookupleaf(mid,
|
r = self.lookupnext_(mid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -2176,7 +2176,7 @@ class Mtree:
|
|||||||
yield rattr
|
yield rattr
|
||||||
|
|
||||||
# lookup by name
|
# lookup by name
|
||||||
def _namelookupleaf(self, did, name, *,
|
def _namelookup_(self, did, name, *,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
if path or depth:
|
if path or depth:
|
||||||
@@ -2202,8 +2202,8 @@ class Mtree:
|
|||||||
|
|
||||||
# mtree? find name in mtree
|
# mtree? find name in mtree
|
||||||
else:
|
else:
|
||||||
# need to do two steps here in case namelookupleaf stops early
|
# need to do two steps here in case namelookup_ stops early
|
||||||
r = self.mtree.namelookupleaf(did, name,
|
r = self.mtree.namelookup_(did, name,
|
||||||
path=path or depth,
|
path=path or depth,
|
||||||
depth=depth-len(path_) if depth else None)
|
depth=depth-len(path_) if depth else None)
|
||||||
if path or depth:
|
if path or depth:
|
||||||
@@ -2247,13 +2247,13 @@ class Mtree:
|
|||||||
else:
|
else:
|
||||||
return mdir
|
return mdir
|
||||||
|
|
||||||
def namelookupleaf(self, did, name, *,
|
def namelookup_(self, did, name, *,
|
||||||
mdirs_only=True,
|
mdirs_only=True,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
# most of the logic is in _namelookupleaf, this just helps
|
# most of the logic is in _namelookup_, this just helps
|
||||||
# deduplicate the mdirs_only logic
|
# deduplicate the mdirs_only logic
|
||||||
r = self._namelookupleaf(did, name,
|
r = self._namelookup_(did, name,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -2276,7 +2276,7 @@ class Mtree:
|
|||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
# lookup the relevant mdir
|
# lookup the relevant mdir
|
||||||
r = self.namelookupleaf(did, name,
|
r = self.namelookup_(did, name,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -3247,7 +3247,7 @@ class Lfs3:
|
|||||||
mbid, mrid = mid.mbid, mid.mrid + 1
|
mbid, mrid = mid.mbid, mid.mrid + 1
|
||||||
if mrid == mdir.weight:
|
if mrid == mdir.weight:
|
||||||
mbid, mrid = mbid + (1 << self.mbits), 0
|
mbid, mrid = mbid + (1 << self.mbits), 0
|
||||||
mdir = self.mtree.lookupleaf(mbid)
|
mdir = self.mtree.lookupnext_(mbid)
|
||||||
if mdir is None:
|
if mdir is None:
|
||||||
break
|
break
|
||||||
# lookup name and adjust rid if necessary, you don't
|
# lookup name and adjust rid if necessary, you don't
|
||||||
@@ -3471,7 +3471,7 @@ class Lfs3:
|
|||||||
yield from self.sattrs()
|
yield from self.sattrs()
|
||||||
|
|
||||||
# lookup data in the underlying bshrub
|
# lookup data in the underlying bshrub
|
||||||
def _lookupleaf(self, pos, *,
|
def _lookupnext_(self, pos, *,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
# no bshrub?
|
# no bshrub?
|
||||||
@@ -3482,7 +3482,7 @@ class Lfs3:
|
|||||||
return None, None
|
return None, None
|
||||||
|
|
||||||
# lookup data in our bshrub
|
# lookup data in our bshrub
|
||||||
r = self.bshrub.lookupleaf(pos,
|
r = self.bshrub.lookupnext_(pos,
|
||||||
path=path or depth,
|
path=path or depth,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path or depth:
|
if path or depth:
|
||||||
@@ -3531,11 +3531,11 @@ class Lfs3:
|
|||||||
else:
|
else:
|
||||||
return bid-(rattr.weight-1), rattr
|
return bid-(rattr.weight-1), rattr
|
||||||
|
|
||||||
def lookupleaf(self, pos, *,
|
def lookupnext_(self, pos, *,
|
||||||
data_only=True,
|
data_only=True,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
r = self._lookupleaf(pos,
|
r = self._lookupnext_(pos,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -3559,7 +3559,7 @@ class Lfs3:
|
|||||||
depth=None):
|
depth=None):
|
||||||
pos = 0
|
pos = 0
|
||||||
while True:
|
while True:
|
||||||
r = self.lookupleaf(pos,
|
r = self.lookupnext_(pos,
|
||||||
data_only=False,
|
data_only=False,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
|
|||||||
+24
-24
@@ -1044,7 +1044,7 @@ class Btree:
|
|||||||
shrub = Rbyd.fetchshrub(rbyd, trunk)
|
shrub = Rbyd.fetchshrub(rbyd, trunk)
|
||||||
return cls(bd, shrub)
|
return cls(bd, shrub)
|
||||||
|
|
||||||
def lookupleaf(self, bid, *,
|
def lookupnext_(self, bid, *,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
if not self or bid >= self.weight:
|
if not self or bid >= self.weight:
|
||||||
@@ -1103,7 +1103,7 @@ class Btree:
|
|||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
# just discard the rbyd info
|
# just discard the rbyd info
|
||||||
r = self.lookupleaf(bid,
|
r = self.lookupnext_(bid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -1123,11 +1123,11 @@ class Btree:
|
|||||||
#
|
#
|
||||||
# note this function expects bid to be known, use lookupnext
|
# note this function expects bid to be known, use lookupnext
|
||||||
# first if you don't care about the exact bid (or better yet,
|
# first if you don't care about the exact bid (or better yet,
|
||||||
# lookupleaf and call lookup on the returned rbyd)
|
# lookupnext_ and call lookup on the returned rbyd)
|
||||||
#
|
#
|
||||||
# this matches rbyd's lookup behavior, which needs a known rid
|
# this matches rbyd's lookup behavior, which needs a known rid
|
||||||
# to avoid a double lookup
|
# to avoid a double lookup
|
||||||
r = self.lookupleaf(bid,
|
r = self.lookupnext_(bid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -1168,7 +1168,7 @@ class Btree:
|
|||||||
|
|
||||||
bid = 0
|
bid = 0
|
||||||
while True:
|
while True:
|
||||||
r = self.lookupleaf(bid,
|
r = self.lookupnext_(bid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if r:
|
if r:
|
||||||
@@ -1263,7 +1263,7 @@ class Btree:
|
|||||||
else:
|
else:
|
||||||
yield bid_, rattr
|
yield bid_, rattr
|
||||||
else:
|
else:
|
||||||
r = self.lookupleaf(bid,
|
r = self.lookupnext_(bid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -1286,7 +1286,7 @@ class Btree:
|
|||||||
yield rattr
|
yield rattr
|
||||||
|
|
||||||
# lookup by name
|
# lookup by name
|
||||||
def namelookupleaf(self, did, name, *,
|
def namelookup_(self, did, name, *,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
rbyd = self.rbyd
|
rbyd = self.rbyd
|
||||||
@@ -1334,7 +1334,7 @@ class Btree:
|
|||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
# just discard the rbyd info
|
# just discard the rbyd info
|
||||||
r = self.namelookupleaf(did, name,
|
r = self.namelookup_(did, name,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -1748,7 +1748,7 @@ class Mtree:
|
|||||||
return cls(bd, mrootchain, mtree,
|
return cls(bd, mrootchain, mtree,
|
||||||
mbits=mbits)
|
mbits=mbits)
|
||||||
|
|
||||||
def _lookupleaf(self, mid, *,
|
def _lookupnext_(self, mid, *,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
if not isinstance(mid, Mid):
|
if not isinstance(mid, Mid):
|
||||||
@@ -1783,8 +1783,8 @@ class Mtree:
|
|||||||
|
|
||||||
# mtree? lookup in mtree
|
# mtree? lookup in mtree
|
||||||
else:
|
else:
|
||||||
# need to do two steps here in case lookupleaf stops early
|
# need to do two steps here in case lookupnext_ stops early
|
||||||
r = self.mtree.lookupleaf(mid.mid,
|
r = self.mtree.lookupnext_(mid.mid,
|
||||||
path=path or depth,
|
path=path or depth,
|
||||||
depth=depth-len(path_) if depth else None)
|
depth=depth-len(path_) if depth else None)
|
||||||
if path or depth:
|
if path or depth:
|
||||||
@@ -1828,13 +1828,13 @@ class Mtree:
|
|||||||
else:
|
else:
|
||||||
return mdir
|
return mdir
|
||||||
|
|
||||||
def lookupleaf(self, mid, *,
|
def lookupnext_(self, mid, *,
|
||||||
mdirs_only=True,
|
mdirs_only=True,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
# most of the logic is in _lookupleaf, this just helps
|
# most of the logic is in _lookupnext_, this just helps
|
||||||
# deduplicate the mdirs_only logic
|
# deduplicate the mdirs_only logic
|
||||||
r = self._lookupleaf(mid,
|
r = self._lookupnext_(mid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -1860,7 +1860,7 @@ class Mtree:
|
|||||||
mid = self.mid(mid)
|
mid = self.mid(mid)
|
||||||
|
|
||||||
# lookup the relevant mdir
|
# lookup the relevant mdir
|
||||||
r = self.lookupleaf(mid,
|
r = self.lookupnext_(mid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -1920,7 +1920,7 @@ class Mtree:
|
|||||||
|
|
||||||
mid = self.mid(0)
|
mid = self.mid(0)
|
||||||
while True:
|
while True:
|
||||||
r = self.lookupleaf(mid,
|
r = self.lookupnext_(mid,
|
||||||
mdirs_only=False,
|
mdirs_only=False,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
@@ -2098,7 +2098,7 @@ class Mtree:
|
|||||||
if not isinstance(mid, Mid):
|
if not isinstance(mid, Mid):
|
||||||
mid = self.mid(mid)
|
mid = self.mid(mid)
|
||||||
|
|
||||||
r = self.lookupleaf(mid,
|
r = self.lookupnext_(mid,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -2124,7 +2124,7 @@ class Mtree:
|
|||||||
yield rattr
|
yield rattr
|
||||||
|
|
||||||
# lookup by name
|
# lookup by name
|
||||||
def _namelookupleaf(self, did, name, *,
|
def _namelookup_(self, did, name, *,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
if path or depth:
|
if path or depth:
|
||||||
@@ -2150,8 +2150,8 @@ class Mtree:
|
|||||||
|
|
||||||
# mtree? find name in mtree
|
# mtree? find name in mtree
|
||||||
else:
|
else:
|
||||||
# need to do two steps here in case namelookupleaf stops early
|
# need to do two steps here in case namelookup_ stops early
|
||||||
r = self.mtree.namelookupleaf(did, name,
|
r = self.mtree.namelookup_(did, name,
|
||||||
path=path or depth,
|
path=path or depth,
|
||||||
depth=depth-len(path_) if depth else None)
|
depth=depth-len(path_) if depth else None)
|
||||||
if path or depth:
|
if path or depth:
|
||||||
@@ -2195,13 +2195,13 @@ class Mtree:
|
|||||||
else:
|
else:
|
||||||
return mdir
|
return mdir
|
||||||
|
|
||||||
def namelookupleaf(self, did, name, *,
|
def namelookup_(self, did, name, *,
|
||||||
mdirs_only=True,
|
mdirs_only=True,
|
||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
# most of the logic is in _namelookupleaf, this just helps
|
# most of the logic is in _namelookup_, this just helps
|
||||||
# deduplicate the mdirs_only logic
|
# deduplicate the mdirs_only logic
|
||||||
r = self._namelookupleaf(did, name,
|
r = self._namelookup_(did, name,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
@@ -2224,7 +2224,7 @@ class Mtree:
|
|||||||
path=False,
|
path=False,
|
||||||
depth=None):
|
depth=None):
|
||||||
# lookup the relevant mdir
|
# lookup the relevant mdir
|
||||||
r = self.namelookupleaf(did, name,
|
r = self.namelookup_(did, name,
|
||||||
path=path,
|
path=path,
|
||||||
depth=depth)
|
depth=depth)
|
||||||
if path:
|
if path:
|
||||||
|
|||||||
Reference in New Issue
Block a user