Skip to content
This repository
Browse code

Removed remote.rb and all references to it (in code that is used, at …

…least).
  • Loading branch information...
commit 5e45bfba3fd78e31c2e4d40d35218b38b7b31e68 1 parent c52e296
Daniel Lamando authored January 17, 2010
8  lib/delta.rb
@@ -332,10 +332,10 @@ def commit!
332 332
 			end
333 333
 		end
334 334
 		
335  
-		if @wave.participants.include?('echoey@danopia.net') && @author != 'echoey@danopia.net'
336  
-			puts 'poking Echoey'
337  
-			Echoey.new.handle $remote, @wave, @operations.select {|op| op.is_a? Operations::Mutate }.map {|op| @wave.blip(op.document_id) }.uniq.first
338  
-		end
  335
+		#if @wave.participants.include?('echoey@danopia.net') && @author != 'echoey@danopia.net'
  336
+			#puts 'poking Echoey'
  337
+			#Echoey.new.handle $remote, @wave, @operations.select {|op| op.is_a? Operations::Mutate }.map {|op| @wave.blip(op.document_id) }.uniq.first
  338
+		#end
339 339
 	end
340 340
 	
341 341
 end # class
2  lib/protocol/server_client.rb
@@ -22,7 +22,7 @@ def self.login username, password, server=nil
22 22
     if check_login username, password
23 23
       self.new nil, server, username, "#{username}@danopia.net"
24 24
     else
25  
-      nil # TODO: Raise error
  25
+      nil # TODO: Raise error (or at least something)
26 26
     end
27 27
   end
28 28
 end # class
9  lib/provider.rb
@@ -4,7 +4,7 @@ module Sails
4 4
 # Most popular class. Represents the local server and the waves on it, and
5 5
 # keeps a list of external servers.
6 6
 class Provider
7  
-	attr_accessor :sock, :servers, :key, :domain, :name, :local, :packet_ids, :ready, :remote
  7
+	attr_accessor :sock, :servers, :key, :domain, :name, :local, :packet_ids, :ready
8 8
 	
9 9
 	# Create a new provider.
10 10
 	def initialize(domain, subdomain='wave', sock=nil)
@@ -31,7 +31,6 @@ def ready!
31 31
 		return if ready?
32 32
 		@ready = true
33 33
 		flush
34  
-		start_remote unless @remote
35 34
 	end
36 35
 	
37 36
 	# Load the provider's certificate from a file.
@@ -48,12 +47,6 @@ def load_key(path)
48 47
 	def sign(data)
49 48
 		@key.sign OpenSSL::Digest::SHA1.new, data
50 49
 	end
51  
-	
52  
-	# Start up a new SailsRemote
53  
-	def start_remote bind=':9000'
54  
-		@remote = Remote.serve self, bind
55  
-		puts "DRb server running at #{@remote.uri}"
56  
-	end
57 50
 
58 51
 	# Create a socket to the XMPP server.
59 52
 	def connect_sock(host='localhost', port=5275)
94  lib/remote.rb
... ...
@@ -1,94 +0,0 @@
1  
-require 'drb'
2  
-
3  
-module Sails
4  
-
5  
-# A class that's focused for use with DRb. There are a few methods that just
6  
-# call deeper methods, since DRb only sends method calls to the server if
7  
-# called on the main DRbObject. If it weren't for these methods, a DRb client
8  
-# wouldn't be able to do much.
9  
-class Remote
10  
-	attr_accessor :drb, :provider
11  
-	
12  
-	class << self
13  
-		attr_reader :provider, :remote # Current remote/provider
14  
-	end
15  
-	
16  
-	# Serve a remote up
17  
-	def self.serve provider, host=':9000'
18  
-		@remote = Sails::Remote.new provider
19  
-		@remote.drb = DRb.start_service "druby://#{host}", @remote
20  
-		
21  
-		@provider = provider
22  
-		@remote
23  
-	end
24  
-	
25  
-	# Connect to a remote
26  
-	def self.connect host=':9000'
27  
-		DRb.start_service
28  
-		@remote = DRbObject.new nil, "druby://#{host}"
29  
-		
30  
-		@provider = @remote.provider
31  
-		@remote
32  
-	end
33  
-	
34  
-	# Create a remote for the provider
35  
-	def initialize provider
36  
-		@provider = provider
37  
-		@drb = nil
38  
-	end
39  
-	
40  
-	# DRb's URI
41  
-	def uri
42  
-		@drb.uri if @drb
43  
-	end
44  
-	
45  
-	# Shuts down the DRb server
46  
-	def stop_service
47  
-		@drb.stop_service if @drb
48  
-		@drb = nil
49  
-	end
50  
-	
51  
-	# Returns a list of waves from all servers
52  
-	def all_waves
53  
-		waves = []
54  
-		@provider.servers.each_value do |server|
55  
-			waves += server.waves.values
56  
-		end
57  
-		waves.uniq
58  
-	end
59  
-	
60  
-	# Look up and return a wave
61  
-	def [] name
62  
-		@provider[name]
63  
-	end
64  
-	
65  
-	# Add a delta or wave
66  
-	def << item
67  
-		if item.is_a? Wave
68  
-			@provider << item
69  
-		elsif item.is_a? Delta
70  
-			wave = self[item.wave.name]
71  
-			add_delta wave, item
72  
-		else
73  
-			raise Sails::Error, "unexpected object passed"
74  
-		end
75  
-	end
76  
-	
77  
-	# Add a delta to a wave (faster to give the wave's name). Also propagates the
78  
-	# delta.
79  
-	def add_delta(wave, delta)
80  
-		if wave.is_a? Wave
81  
-			wave << delta# unless wave.deltas.include?(delta)
82  
-			wave = wave.name
83  
-		end
84  
-		self[wave] << delta
85  
-	end
86  
-	
87  
-	def new_local_wave
88  
-		wave = Wave.new @provider
89  
-		self << wave
90  
-		wave
91  
-	end
92  
-end # class
93  
-
94  
-end # module

0 notes on commit 5e45bfb

Please sign in to comment.
Something went wrong with that request. Please try again.