Class: Node

Inherits:
CouchRest::ExtendedDocument
  • Object
show all
Defined in:
lib/adhd/models/node_doc.rb

Instance Method Summary collapse

Instance Method Details

#get_content_db(shard_db_name) ⇒ Object



27
28
29
30
# File 'lib/adhd/models/node_doc.rb', line 27

def get_content_db(shard_db_name)
  server = CouchRest.new("#{url}")
  db = server.database!("#{name}_#{shard_db_name}_content_db")
end

#get_node_dbObject



17
18
19
20
# File 'lib/adhd/models/node_doc.rb', line 17

def get_node_db
  server = CouchRest.new("#{url}")
  db = server.database!("#{name}_node_db")
end

#get_shard_dbObject



22
23
24
25
# File 'lib/adhd/models/node_doc.rb', line 22

def get_shard_db
  server = CouchRest.new("#{url}")
  db = server.database!("#{name}_shard_db")
end

#replicate_from(local_db, other_node, remote_db) ⇒ Object



41
42
43
# File 'lib/adhd/models/node_doc.rb', line 41

def replicate_from(local_db, other_node, remote_db)
  replicate_to_or_from(local_db, other_node, remote_db, false)
end

#replicate_to(local_db, other_node, remote_db) ⇒ Object

Replicating databases and marking nodes as unavailable In the future we should hook these into a “replication manager” for databases. The manager should set up continuous replication across databases, and only do a replication after some time lapses.



37
38
39
# File 'lib/adhd/models/node_doc.rb', line 37

def replicate_to(local_db, other_node, remote_db)
  replicate_to_or_from(local_db, other_node, remote_db, true)
end