Permalink
Browse files

added api_rename and api_mrename

  • Loading branch information...
1 parent df51f6f commit bf2618c73550b056d153427a2a4ba03670d40e1a @stevedekorte committed Oct 6, 2011
Showing with 53 additions and 98 deletions.
  1. +1 −1 lib/Vertex/PDB.js
  2. +33 −0 lib/Vertex/Vertex.js
  3. +19 −97 vertex.js.tmproj
View
@@ -30,7 +30,7 @@ PDB = Proto.clone().newSlots({
{
if(this._nodePoolCount > this._nodePoolHighWaterMark)
{
- // replace this with a LRU linked list
+ // replace this with a LRU linked list
var newPool = {};
var count = 0;
for(k in this._nodePool)
View
@@ -631,6 +631,22 @@ if(elapsed > 1000)
return null;
},
+
+ api_rename: function(path, oldName, newName)
+ {
+ if(oldName == newName) { return null; }
+
+ var destNode = this.validNode(path.removePrefix("/"));
+ if (!destNode.isWritableByUser(this.user()))
+ {
+ writeln("api_mwrite invalid write permissions");
+ throw new Error("invalid write permissions");
+ }
+
+ destNode.rename(oldName, newName);
+ return null;
+ },
+
api_link: function(destPath, slotName, sourcePath)
{
@@ -739,6 +755,23 @@ if(elapsed > 1000)
// meta API
+ api_mrename: function(path, oldName, newName)
+ {
+ if(oldName == newName) { return null; }
+
+ var destNode = this.validNode(path.removePrefix("/"));
+ if (!destNode.isWritableByUser(this.user()))
+ {
+ writeln("api_mwrite invalid write permissions");
+ throw new Error("invalid write permissions");
+ }
+ var r = destNode.mRecord();
+ var value = r.at(oldName);
+ r.atPut(newName, value);
+ r.removeAt(oldName);
+ return null;
+ },
+
api_mwrite: function(path, name, value)
{
var destNode = this.validNode(path.removePrefix("/"));
View
@@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>currentDocument</key>
- <string>lib/Vertex/PRecord.js</string>
+ <string>server.js</string>
<key>documents</key>
<array>
<dict>
@@ -70,44 +70,14 @@
<key>caret</key>
<dict>
<key>column</key>
- <integer>38</integer>
- <key>line</key>
- <integer>420</integer>
- </dict>
- <key>columnSelection</key>
- <false/>
- <key>firstVisibleColumn</key>
- <integer>0</integer>
- <key>firstVisibleLine</key>
- <integer>409</integer>
- <key>selectFrom</key>
- <dict>
- <key>column</key>
- <integer>25</integer>
- <key>line</key>
- <integer>420</integer>
- </dict>
- <key>selectTo</key>
- <dict>
- <key>column</key>
- <integer>38</integer>
+ <integer>3</integer>
<key>line</key>
<integer>420</integer>
</dict>
- </dict>
- <key>addons/VertexUI/LBInboxView.js</key>
- <dict>
- <key>caret</key>
- <dict>
- <key>column</key>
- <integer>4</integer>
- <key>line</key>
- <integer>104</integer>
- </dict>
<key>firstVisibleColumn</key>
<integer>0</integer>
<key>firstVisibleLine</key>
- <integer>73</integer>
+ <integer>433</integer>
</dict>
<key>addons/VertexUI/ListView.js</key>
<dict>
@@ -151,36 +121,6 @@
<key>firstVisibleLine</key>
<integer>0</integer>
</dict>
- <key>addons/VertexUI/TableView.js</key>
- <dict>
- <key>caret</key>
- <dict>
- <key>column</key>
- <integer>1</integer>
- <key>line</key>
- <integer>65</integer>
- </dict>
- <key>columnSelection</key>
- <false/>
- <key>firstVisibleColumn</key>
- <integer>0</integer>
- <key>firstVisibleLine</key>
- <integer>38</integer>
- <key>selectFrom</key>
- <dict>
- <key>column</key>
- <integer>19</integer>
- <key>line</key>
- <integer>65</integer>
- </dict>
- <key>selectTo</key>
- <dict>
- <key>column</key>
- <integer>1</integer>
- <key>line</key>
- <integer>65</integer>
- </dict>
- </dict>
<key>addons/VertexUI/VertexUI.js</key>
<dict>
<key>caret</key>
@@ -281,36 +221,6 @@
<integer>68</integer>
</dict>
</dict>
- <key>lib/NodeCrux/String+Path.js</key>
- <dict>
- <key>caret</key>
- <dict>
- <key>column</key>
- <integer>12</integer>
- <key>line</key>
- <integer>13</integer>
- </dict>
- <key>columnSelection</key>
- <false/>
- <key>firstVisibleColumn</key>
- <integer>0</integer>
- <key>firstVisibleLine</key>
- <integer>0</integer>
- <key>selectFrom</key>
- <dict>
- <key>column</key>
- <integer>1</integer>
- <key>line</key>
- <integer>13</integer>
- </dict>
- <key>selectTo</key>
- <dict>
- <key>column</key>
- <integer>14</integer>
- <key>line</key>
- <integer>13</integer>
- </dict>
- </dict>
<key>lib/NodeCrux/Url.js</key>
<dict>
<key>caret</key>
@@ -459,6 +369,20 @@
<integer>331</integer>
</dict>
</dict>
+ <key>server.js</key>
+ <dict>
+ <key>caret</key>
+ <dict>
+ <key>column</key>
+ <integer>25</integer>
+ <key>line</key>
+ <integer>3</integer>
+ </dict>
+ <key>firstVisibleColumn</key>
+ <integer>0</integer>
+ <key>firstVisibleLine</key>
+ <integer>0</integer>
+ </dict>
</dict>
<key>openDocuments</key>
<array>
@@ -471,23 +395,21 @@
<string>addons/VertexUI/ButtonView.js</string>
<string>addons/VertexUI/ListView.js</string>
<string>addons/VertexUI/HtmlView.js</string>
+ <string>server.js</string>
<string>README</string>
<string>addons/VertexUI/NodeView.js</string>
<string>lib/Crux/Proto.js</string>
<string>lib/Crux/Object.js</string>
- <string>addons/VertexUI/LBInboxView.js</string>
- <string>lib/NodeCrux/String+Path.js</string>
<string>lib/Crux/String+Path.js</string>
<string>addons/VertexUI/PathView.js</string>
<string>lib/Vertex/PDB.js</string>
- <string>addons/VertexUI/TableView.js</string>
<string>lib/Crux/String.js</string>
<string>lib/Crux/Array.js</string>
<string>lib/NodeCrux/Url.js</string>
</array>
<key>showFileHierarchyDrawer</key>
<true/>
<key>windowFrame</key>
- <string>{{433, 0}, {1247, 1028}}</string>
+ <string>{{652, 419}, {952, 642}}</string>
</dict>
</plist>

0 comments on commit bf2618c

Please sign in to comment.