WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Remove unused XendDB.py.

# HG changeset patch
# User emellor@ewan
# Node ID 5805b47583ba651e5778c4964bbc319f9b88deb5
# Parent  0e2fdfe6b2bccfd8afb64ff96946ee70c09bf206
Remove unused XendDB.py.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>

diff -r 0e2fdfe6b2bc -r 5805b47583ba tools/python/xen/xend/XendDB.py
--- a/tools/python/xen/xend/XendDB.py   Fri Sep 23 15:04:43 2005
+++ /dev/null   Fri Sep 23 15:05:37 2005
@@ -1,127 +0,0 @@
-#============================================================================
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of version 2.1 of the GNU Lesser General Public
-# License as published by the Free Software Foundation.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-#============================================================================
-# Copyright (C) 2004, 2005 Mike Wray <mike.wray@xxxxxx>
-#============================================================================
-
-import os
-import os.path
-import errno
-import dircache
-import time
-
-import sxp
-import XendRoot
-xroot = XendRoot.instance()
-
-class XendDB:
-    """Persistence for Xend. Stores data in files and directories.
-    """
-
-    def __init__(self, path=None):
-        self.dbpath = xroot.get_dbroot()
-        if path:
-            self.dbpath = os.path.join(self.dbpath, path)
-        pass
-
-    def listdir(self, dpath):
-        try:
-            return dircache.listdir(dpath)
-        except:
-            return []
-
-    def filepath(self, path):
-        return os.path.join(self.dbpath, path)
-        
-    def fetch(self, path):
-        fpath = self.filepath(path)
-        return self.fetchfile(fpath)
-
-    def fetchfile(self, fpath):
-        pin = sxp.Parser()
-        fin = file(fpath, "rb")
-        try:
-            while 1:
-                try:
-                    buf = fin.read(1024)
-                except IOError, ex:
-                    if ex.errno == errno.EINTR:
-                        continue
-                    else:
-                        raise
-                pin.input(buf)
-                if buf == '':
-                    pin.input_eof()
-                    break
-        finally:
-            fin.close()
-        return pin.get_val()
-
-    def save(self, path, sxpr):
-        fpath = self.filepath(path)
-        return self.savefile(fpath, sxpr)
-    
-    def savefile(self, fpath, sxpr):
-        backup = False
-        fdir = os.path.dirname(fpath)
-        if not os.path.isdir(fdir):
-            os.makedirs(fdir)
-        if os.path.exists(fpath):
-            backup = True
-            real_fpath = fpath
-            fpath += ".new."
-            
-        fout = file(fpath, "wb+")
-        try:
-            try:
-                t = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
-                fout.write("# %s %s\n" % (fpath, t))
-                sxp.show(sxpr, out=fout)
-            finally:
-                fout.close()
-        except:
-            if backup:
-                try:
-                    os.unlink(fpath)
-                except:
-                    pass
-                raise
-        if backup:
-            os.rename(fpath, real_fpath)
-
-    def fetchall(self, path):
-        dpath = self.filepath(path)
-        d = {}
-        for k in self.listdir(dpath):
-            try:
-                v = self.fetchfile(os.path.join(dpath, k))
-                d[k] = v
-            except:
-                pass
-        return d
-
-    def saveall(self, path, d):
-        for (k, v) in d.items():
-            self.save(os.path.join(path, k), v)
-
-    def delete(self, path):
-        dpath = self.filepath(path)
-        os.unlink(dpath)
-
-    def ls(self, path):
-        dpath = self.filepath(path)
-        return self.listdir(dpath)
-        
-
-        

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Remove unused XendDB.py., Xen patchbot -unstable <=