[Zope-CVS] CVS: Products/Ape/lib/apelib/fs - classification.py:1.2.4.1 connection.py:1.3.4.1 structure.py:1.3.2.1
Shane Hathaway
shane@zope.com
Wed, 23 Jul 2003 00:13:21 -0400
Update of /cvs-repository/Products/Ape/lib/apelib/fs
In directory cvs.zope.org:/tmp/cvs-serv21220/lib/apelib/fs
Modified Files:
Tag: ape-scan-branch
classification.py connection.py structure.py
Log Message:
Rough implementation of cache freshness scanning.
This will hopefully enable smoother filesystem storage.
=== Products/Ape/lib/apelib/fs/classification.py 1.2 => 1.2.4.1 ===
--- Products/Ape/lib/apelib/fs/classification.py:1.2 Tue Apr 29 18:11:50 2003
+++ Products/Ape/lib/apelib/fs/classification.py Wed Jul 23 00:12:45 2003
@@ -30,17 +30,17 @@
schema = FieldSchema('classification', 'classification')
def load(self, event):
- c = self.getConnection(event)
+ fs_conn = self.getConnection(event)
p = event.getKey()
- classification = {'node_type': c.readNodeType(p)}
- text = c.readSection(p, 'classification', '')
+ classification = {'node_type': fs_conn.readNodeType(p)}
+ text = fs_conn.readSection(p, 'classification', '')
if text:
lines = text.split('\n')
for line in lines:
if '=' in line:
k, v = line.split('=', 1)
classification[k.strip()] = v.strip()
- classification['extension'] = c.getExtension(p)
+ classification['extension'] = fs_conn.getExtension(p)
return classification, text.strip()
def store(self, event, state):
@@ -58,3 +58,4 @@
text = '\n'.join(text)
fs_conn.writeSection(p, 'classification', text)
return text.strip()
+
=== Products/Ape/lib/apelib/fs/connection.py 1.3 => 1.3.4.1 ===
--- Products/Ape/lib/apelib/fs/connection.py:1.3 Sat May 24 17:51:26 2003
+++ Products/Ape/lib/apelib/fs/connection.py Wed Jul 23 00:12:45 2003
@@ -564,3 +564,30 @@
def close(self):
self.reset()
+
+ def getSources(self, subpath):
+ path = self._expandPath(subpath)
+ props, remainder = self._getPropertyPaths(path)
+ return [(self, (path, props, remainder))]
+
+
+ def freshen(self, d):
+ """ISourceRepository implementation.
+
+ Returns the changed items.
+ """
+ res = {}
+ for source, t in d.items():
+ myself, paths = source
+ assert myself is self
+ new_t = []
+ for path in paths:
+ try:
+ new_t.append(self.ops.getmtime(path))
+ except OSError:
+ new_t.append(None)
+ if t != new_t:
+ res[source] = new_t
+ return res
+
+
=== Products/Ape/lib/apelib/fs/structure.py 1.3 => 1.3.2.1 ===
--- Products/Ape/lib/apelib/fs/structure.py:1.3 Wed Jul 9 11:40:03 2003
+++ Products/Ape/lib/apelib/fs/structure.py Wed Jul 23 00:12:45 2003
@@ -74,12 +74,14 @@
def load(self, event):
id = self.getIdFrom(event)
+ event.addSources(self.getConnection(event).getSources(event.getKey()))
return id, id
def store(self, event, state):
id = self.getIdFrom(event)
if state != id:
raise ValueError('Mismatched file ID')
+ event.addSources(self.getConnection(event).getSources(event.getKey()))
return id