[Zope-Checkins] CVS: Products/AdaptableStorage/gateway_fs - FSConnection.py:1.9 FSDirectoryItems.py:1.9
Shane Hathaway
shane@zope.com
Tue, 7 Jan 2003 14:10:11 -0500
Update of /cvs-repository/Products/AdaptableStorage/gateway_fs
In directory cvs.zope.org:/tmp/cvs-serv18377/gateway_fs
Modified Files:
FSConnection.py FSDirectoryItems.py
Log Message:
Removed unused features to simplify maintenance
=== Products/AdaptableStorage/gateway_fs/FSConnection.py 1.8 => 1.9 ===
--- Products/AdaptableStorage/gateway_fs/FSConnection.py:1.8 Tue Jan 7 14:03:07 2003
+++ Products/AdaptableStorage/gateway_fs/FSConnection.py Tue Jan 7 14:09:37 2003
@@ -36,12 +36,6 @@
DATA_SECTION = '@data' # Data is a string (file) or list of names (directory)
-# Write modes
-WRITE_UNCONDITIONAL = 0
-WRITE_CONDITIONAL = 1
-WRITE_PRESERVE = 2
-
-
class FSConnection:
"""Reads / writes files with 'sections'.
@@ -63,14 +57,6 @@
# _pending holds the data to be written.
# _pending: { subpath string -> { section_name -> data } }
self._pending = {}
- # _conditional holds data that will be written only if the
- # rest of the data for a subpath is in _pending.
- # _conditional: { subpath string -> { section_name -> data } }
- self._conditional = {}
- # _preserve holds the name of sections that will either be
- # copied or changed by another write operation.
- # _preserve: { subpath string -> { section_name -> 1 } }
- self._preserve = {}
def expandPath(self, subpath):
@@ -93,7 +79,7 @@
assert section_name != DATA_SECTION
- def _write(self, subpath, section_name, data, mode=WRITE_UNCONDITIONAL):
+ def _write(self, subpath, section_name, data):
# XXX We should be checking for '..'
path = self.expandPath(subpath)
# Do some early checking.
@@ -102,13 +88,12 @@
if not v:
raise FSWriteError(
"Can't get write access to %s" % subpath)
- self.queue(subpath, section_name, data, mode)
+ self.queue(subpath, section_name, data)
- def writeSection(self, subpath, section_name, data,
- mode=WRITE_UNCONDITIONAL):
+ def writeSection(self, subpath, section_name, data):
self.checkSectionName(section_name)
- self._write(subpath, section_name, data, mode)
+ self._write(subpath, section_name, data)
def writeNodeType(self, subpath, data):
@@ -126,18 +111,6 @@
self._write(subpath, DATA_SECTION, data)
- def unwriteData(self, subpath):
- m = self._pending
- sections = m.get(subpath)
- if sections is not None:
- if sections.has_key(DATA_SECTION):
- res = sections[DATA_SECTION]
- del sections[DATA_SECTION]
- return res
- # Nothing was written.
- return None
-
-
def readSection(self, subpath, section_name, default=None):
self.checkSectionName(section_name)
path = self.expandPath(subpath)
@@ -307,18 +280,9 @@
% subpath)
- def queue(self, subpath, section_name, data, mode=WRITE_UNCONDITIONAL):
+ def queue(self, subpath, section_name, data):
"""Queues data to be written at commit time"""
- if mode == WRITE_UNCONDITIONAL:
- m = self._pending
- elif mode == WRITE_CONDITIONAL:
- m = self._conditional
- elif mode == WRITE_PRESERVE:
- m = self._preserve
- # The data doesn't matter in this case.
- data = 1
- else:
- raise RuntimeError('Unknown write mode: %d' % mode)
+ m = self._pending
sections = m.get(subpath)
if sections is None:
sections = {}
@@ -354,20 +318,6 @@
This is done while the transaction can still be vetoed safely.
"""
- for subpath, sections in self._conditional.items():
- if self._pending.get(subpath):
- # Add the conditional data.
- for section_name, data in sections.items():
- self.queue(subpath, section_name, data)
- for subpath, sections in self._preserve.items():
- psections = self._pending.get(subpath)
- for section_name, data in sections.items():
- if not psections or not psections.has_key(section_name):
- # Preserve the existing data.
- data = self.readSection(subpath, section_name, '')
- if data:
- self.queue(subpath, section_name, data)
- self._conditional.clear()
items = self._pending.items()
items.sort() # Ensure that base directories come first.
self.beforeWrite(items)
@@ -376,8 +326,6 @@
def reset(self):
self._final = 0
self._pending.clear()
- self._conditional.clear()
- self._preserve.clear()
def abort(self):
self.reset()
=== Products/AdaptableStorage/gateway_fs/FSDirectoryItems.py 1.8 => 1.9 ===
--- Products/AdaptableStorage/gateway_fs/FSDirectoryItems.py:1.8 Tue Dec 31 16:47:44 2002
+++ Products/AdaptableStorage/gateway_fs/FSDirectoryItems.py Tue Jan 7 14:09:37 2003
@@ -19,8 +19,6 @@
from mapper_public import IGateway, RowSequenceSchema
-from FSConnection import WRITE_CONDITIONAL
-
class FSDirectoryItems: