Guest User

Untitled

a guest
Apr 24th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. var sys = require('sys');
  2.  
  3. var Cache = require('./cache'),
  4. Database = require('./database'),
  5. Resource = require('./resource');
  6.  
  7. Server = function(url) {
  8. Resource.call(this, url);
  9. };
  10.  
  11. sys.inherits(Server, Resource);
  12.  
  13. Server.prototype._all_dbs = function() {
  14. this.get.apply(this, this.arrayify(arguments).concat('_all_dbs'));
  15. };
  16.  
  17. Server.prototype._uuids = function() {
  18. this.get.apply(this, this.arrayify(arguments).concat('_uuids'));
  19. };
  20.  
  21. Server.prototype.database = function(dbName) {
  22. var url = this.uri.appendPath(dbName);
  23. return Database.fetch(url);
  24. };
  25.  
  26. Server.fetch = function(url) {
  27. return Cache.fetch(url, function() {
  28. new Server(url);
  29. });
  30. };
  31.  
  32. process.mixin(exports, Server);
Add Comment
Please, Sign In to add comment