Author: dmeyer
Date: Fri Feb 17 20:19:23 2006
New Revision: 1187

Modified:
   trunk/WIP/vfs/src/client.py
   trunk/WIP/vfs/src/query.py
   trunk/WIP/vfs/src/server.py

Log:
more updates

Modified: trunk/WIP/vfs/src/client.py
==============================================================================
--- trunk/WIP/vfs/src/client.py (original)
+++ trunk/WIP/vfs/src/client.py Fri Feb 17 20:19:23 2006
@@ -89,11 +89,15 @@
         self._queries.append(weakref(result))
         if 'parent' in query:
             query['parent'] = query['parent']._vfs_id
-        OneShotTimer(self._server_monitor, self.id, result.id, query,
-                     __ipc_noproxy_args=True, __ipc_oneway=True).start(0.01)
         return result
     
-
+    def monitor(self, query, status):
+        """
+        Monitor a query
+        """
+        self._server_monitor(self.id, query.id, query._query, status
+                             __ipc_noproxy_args=True, __ipc_oneway=True)
+        
 #     def query(self, **query):
 #         """
 #         Do a query to the databse. This will return a Query object.

Modified: trunk/WIP/vfs/src/query.py
==============================================================================
--- trunk/WIP/vfs/src/query.py  (original)
+++ trunk/WIP/vfs/src/query.py  Fri Feb 17 20:19:23 2006
@@ -55,20 +55,17 @@
         self.id = Query.NEXT_ID
         Query.NEXT_ID += 1
         self._query = query
-        self._monitor = None
+        self._monitor = False
         self._client = client
 
         self.result = self._client.database.query(**query)
     
 
-    def _vfs_connect(self, monitor):
-        """
-        Connect message from server.
-        """
-        print 'CONNECT', monitor
-        self._monitor = monitor
-
-
+    def monitor(status=True):
+        if self._monitor == status:
+            return
+        self._client.monitor(self, status)
+        
     def _vfs_progress(self, pos, max, url):
         """
         Progress message from server.

Modified: trunk/WIP/vfs/src/server.py
==============================================================================
--- trunk/WIP/vfs/src/server.py (original)
+++ trunk/WIP/vfs/src/server.py Fri Feb 17 20:19:23 2006
@@ -132,23 +132,31 @@
         return self._db.register_object_type_attrs('track_%s' % name, **kwargs)
 
 
-    def monitor(self, client_id, request_id, query):
+    def monitor(self, client_id, request_id, status, query):
         """
         Create a monitor object to monitor a query for a client.
         """
-        print 'MONITOR', client_id, request_id, query
+        print 'MONITOR', client_id, request_id, query, status
         if 'parent' in query:
             type, id = query['parent']
             query['parent'] = self._db.query(type=type, id=id)[0]
 
-        for id, client, callback in self._clients:
+        for id, client, callback, monitors in self._clients:
             if id == client_id:
                 break
         else:
             raise AttributeError('Unknown client id %s', client_id)
-        monitor = Monitor(callback, self._db, self, request_id, query)
-        log.debug('create %s' % monitor)
-        callback(request_id, 'connect', monitor)
+        if not status:
+            print 'remove monitor'
+            for m in monitors:
+                if m.id == request_id:
+                    monitors.remove(m)
+                    return None
+            log.error('unable to find monitor %s:%s', client_id, request_id)
+            return None
+            
+        m = Monitor(callback, self._db, self, request_id, query)
+        monitors.append(m)
         return None
     
 
@@ -157,7 +165,7 @@
         Add a mountpoint to the system.
         """
         if self._db.add_mountpoint(device, directory):
-            for id, client, notification in self._clients:
+            for id, client, notification, monitors in self._clients:
                 client.database.add_mountpoint(device, directory, 
__ipc_oneway=True)
 
 
@@ -166,7 +174,7 @@
         Set mountpoint to the given name (e.g. load media)
         """
         if self._db.set_mountpoint(directory, name):
-            for id, client, notification in self._clients:
+            for id, client, notification, monitors in self._clients:
                 client.database.set_mountpoint(directory, name)
             return True
         return False
@@ -177,7 +185,7 @@
         Connect a new client to the server.
         """
         self._next_client += 1
-        self._clients.append((self._next_client, client, callback))
+        self._clients.append((self._next_client, client, callback, []))
         for device, directory, name in self._db.get_mountpoints():
             client.database.add_mountpoint(device, directory)
             client.database.set_mountpoint(directory, name)


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to