You are viewing a plain text version of this content. The canonical link for it is here.
Posted to nuvem-commits@incubator.apache.org by js...@apache.org on 2011/04/04 08:03:59 UTC

svn commit: r1088497 - in /incubator/nuvem/trunk/nuvem-parallel/nuvem: delete.py filedb.py get.py gmap.py gsearch.py gweather.py nosqldb.py post.py put.py sqldb.py

Author: jsdelfino
Date: Mon Apr  4 08:03:58 2011
New Revision: 1088497

URL: http://svn.apache.org/viewvc?rev=1088497&view=rev
Log:
Add database and search components.

Added:
    incubator/nuvem/trunk/nuvem-parallel/nuvem/delete.py
    incubator/nuvem/trunk/nuvem-parallel/nuvem/filedb.py
    incubator/nuvem/trunk/nuvem-parallel/nuvem/get.py
    incubator/nuvem/trunk/nuvem-parallel/nuvem/gmap.py
    incubator/nuvem/trunk/nuvem-parallel/nuvem/gsearch.py
    incubator/nuvem/trunk/nuvem-parallel/nuvem/gweather.py
    incubator/nuvem/trunk/nuvem-parallel/nuvem/nosqldb.py
    incubator/nuvem/trunk/nuvem-parallel/nuvem/post.py
    incubator/nuvem/trunk/nuvem-parallel/nuvem/put.py
    incubator/nuvem/trunk/nuvem-parallel/nuvem/sqldb.py

Added: incubator/nuvem/trunk/nuvem-parallel/nuvem/delete.py
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/nuvem-parallel/nuvem/delete.py?rev=1088497&view=auto
==============================================================================
--- incubator/nuvem/trunk/nuvem-parallel/nuvem/delete.py (added)
+++ incubator/nuvem/trunk/nuvem-parallel/nuvem/delete.py Mon Apr  4 08:03:58 2011
@@ -0,0 +1,28 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#    
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+
+def get(r, coll, id):
+    def isList(v):
+        if getattr(v, '__iter__', False) == False:
+            return False
+        if isinstance(v, basestring) or isinstance(v, dict):
+            return False
+        return True
+
+    idv = id.get(r)
+    return coll.delete(idv if isList(idv) else (idv,))
+

Added: incubator/nuvem/trunk/nuvem-parallel/nuvem/filedb.py
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/nuvem-parallel/nuvem/filedb.py?rev=1088497&view=auto
==============================================================================
--- incubator/nuvem/trunk/nuvem-parallel/nuvem/filedb.py (added)
+++ incubator/nuvem/trunk/nuvem-parallel/nuvem/filedb.py Mon Apr  4 08:03:58 2011
@@ -0,0 +1,29 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#    
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+
+def get(id, db, host):
+    return db.get((host.eval(),) + id)
+
+def post(id, val, db, host):
+    return db.post((host.eval(),) + id, val)
+
+def put(id, val, db, host):
+    return db.put((host.eval(),) + id, val)
+
+def delete(id, db, host):
+    return db.delete((host.eval(),) + id)
+

Added: incubator/nuvem/trunk/nuvem-parallel/nuvem/get.py
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/nuvem-parallel/nuvem/get.py?rev=1088497&view=auto
==============================================================================
--- incubator/nuvem/trunk/nuvem-parallel/nuvem/get.py (added)
+++ incubator/nuvem/trunk/nuvem-parallel/nuvem/get.py Mon Apr  4 08:03:58 2011
@@ -0,0 +1,28 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#    
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+
+def get(r, coll, id):
+    def isList(v):
+        if getattr(v, '__iter__', False) == False:
+            return False
+        if isinstance(v, basestring) or isinstance(v, dict):
+            return False
+        return True
+
+    idv = id.get(r)
+    return coll.get(idv if isList(idv) else (idv,))
+

Added: incubator/nuvem/trunk/nuvem-parallel/nuvem/gmap.py
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/nuvem-parallel/nuvem/gmap.py?rev=1088497&view=auto
==============================================================================
--- incubator/nuvem/trunk/nuvem-parallel/nuvem/gmap.py (added)
+++ incubator/nuvem/trunk/nuvem-parallel/nuvem/gmap.py Mon Apr  4 08:03:58 2011
@@ -0,0 +1,35 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#    
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+
+import string
+
+def get(r, markers, s):
+
+    def ismarker(m):
+        from sys import stderr
+        print >> stderr, "####", m
+        return m[1] is not None
+
+    def marker(m):
+        # expecting (label, (color, loc))
+        label = m[0][1:]
+        color = m[1][0]
+        loc = string.join(map(str, m[1][1:3]), ',')
+        return ("'markers", 'color:{0}|label:{1}|{2}'.format(color, label, loc))
+    
+    return s.get((("'size", '480x480'), ("'maptype", 'roadmap'), ("'sensor", 'false')) + tuple(map(marker, filter(ismarker, markers.get(r)))))
+

Added: incubator/nuvem/trunk/nuvem-parallel/nuvem/gsearch.py
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/nuvem-parallel/nuvem/gsearch.py?rev=1088497&view=auto
==============================================================================
--- incubator/nuvem/trunk/nuvem-parallel/nuvem/gsearch.py (added)
+++ incubator/nuvem/trunk/nuvem-parallel/nuvem/gsearch.py Mon Apr  4 08:03:58 2011
@@ -0,0 +1,20 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#    
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+
+def get(r, q, s):
+    return s.get((("'v", '1.0'), ("'q", q.get(r))))
+

Added: incubator/nuvem/trunk/nuvem-parallel/nuvem/gweather.py
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/nuvem-parallel/nuvem/gweather.py?rev=1088497&view=auto
==============================================================================
--- incubator/nuvem/trunk/nuvem-parallel/nuvem/gweather.py (added)
+++ incubator/nuvem/trunk/nuvem-parallel/nuvem/gweather.py Mon Apr  4 08:03:58 2011
@@ -0,0 +1,20 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#    
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+
+def get(r, zip, w):
+    return w.get((("'weather", zip.get(r)),))
+

Added: incubator/nuvem/trunk/nuvem-parallel/nuvem/nosqldb.py
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/nuvem-parallel/nuvem/nosqldb.py?rev=1088497&view=auto
==============================================================================
--- incubator/nuvem/trunk/nuvem-parallel/nuvem/nosqldb.py (added)
+++ incubator/nuvem/trunk/nuvem-parallel/nuvem/nosqldb.py Mon Apr  4 08:03:58 2011
@@ -0,0 +1,29 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#    
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+
+def get(id, db, host):
+    return db.get((host.eval(),) + id);
+
+def post(id, val, db, host):
+    return db.post((host.eval(),) + id, val);
+
+def put(id, val, db, host):
+    return db.put((host.eval(),) + id, val);
+
+def delete(id, db, host):
+    return db.delete((host.eval(),) + id);
+

Added: incubator/nuvem/trunk/nuvem-parallel/nuvem/post.py
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/nuvem-parallel/nuvem/post.py?rev=1088497&view=auto
==============================================================================
--- incubator/nuvem/trunk/nuvem-parallel/nuvem/post.py (added)
+++ incubator/nuvem/trunk/nuvem-parallel/nuvem/post.py Mon Apr  4 08:03:58 2011
@@ -0,0 +1,28 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#    
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+
+def get(r, coll, id, val):
+    def isList(v):
+        if getattr(v, '__iter__', False) == False:
+            return False
+        if isinstance(v, basestring) or isinstance(v, dict):
+            return False
+        return True
+
+    idv = id.get(r)
+    return coll.post(idv if isList(idv) else (idv,), val.get(r))
+

Added: incubator/nuvem/trunk/nuvem-parallel/nuvem/put.py
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/nuvem-parallel/nuvem/put.py?rev=1088497&view=auto
==============================================================================
--- incubator/nuvem/trunk/nuvem-parallel/nuvem/put.py (added)
+++ incubator/nuvem/trunk/nuvem-parallel/nuvem/put.py Mon Apr  4 08:03:58 2011
@@ -0,0 +1,28 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#    
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+
+def get(r, coll, id, val):
+    def isList(v):
+        if getattr(v, '__iter__', False) == False:
+            return False
+        if isinstance(v, basestring) or isinstance(v, dict):
+            return False
+        return True
+
+    idv = id.get(r)
+    return coll.put(idv if isList(idv) else (idv,), val.get(r))
+

Added: incubator/nuvem/trunk/nuvem-parallel/nuvem/sqldb.py
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/nuvem-parallel/nuvem/sqldb.py?rev=1088497&view=auto
==============================================================================
--- incubator/nuvem/trunk/nuvem-parallel/nuvem/sqldb.py (added)
+++ incubator/nuvem/trunk/nuvem-parallel/nuvem/sqldb.py Mon Apr  4 08:03:58 2011
@@ -0,0 +1,29 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#    
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+
+def get(id, db, host):
+    return db.get((host.eval(),) + id);
+
+def post(id, val, db, host):
+    return db.post((host.eval(),) + id, val);
+
+def put(id, val, db, host):
+    return db.put((host.eval(),) + id, val);
+
+def delete(id, db, host):
+    return db.delete((host.eval(),) + id);
+