Module: Qwe::DB
- Defined in:
- lib/qwe/db.rb,
lib/qwe/db/record.rb,
lib/qwe/db/server.rb,
lib/qwe/db/worker.rb,
lib/qwe/db/commits_file.rb
Defined Under Namespace
Classes: CommitsFile, Record, Server, Worker
Class Method Summary
collapse
Class Method Details
.[](id) ⇒ Object
40
41
42
|
# File 'lib/qwe/db.rb', line 40
def self.[](id)
server[id]
end
|
.connect(uri = Server.default_uri) ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/qwe/db.rb', line 23
def self.connect(uri = Server.default_uri)
@@server = DRbObject.new_with_uri(uri)
300.times do
if server.ready?
return server
end
sleep 0.1
rescue
sleep 0.1
end
raise "Couldn't connect to server in more than 30s"
end
|
.create ⇒ Object
44
45
46
|
# File 'lib/qwe/db.rb', line 44
def self.create(...)
server.create(...)
end
|
.destroy ⇒ Object
48
49
50
|
# File 'lib/qwe/db.rb', line 48
def self.destroy(...)
server.destroy(...)
end
|
.destroy! ⇒ Object
52
53
54
|
# File 'lib/qwe/db.rb', line 52
def self.destroy!(...)
server.destroy!(...)
end
|
.detach(id) ⇒ Object
56
57
58
59
|
# File 'lib/qwe/db.rb', line 56
def self.detach(id)
server.detach(id)
nil
end
|
.serve(*a1, **a2) ⇒ Object
12
13
14
15
|
# File 'lib/qwe/db.rb', line 12
def self.serve(*a1, **a2)
@@srv = Server.new(*a1, **a2)
@@srv.start
end
|
.server ⇒ Object
36
37
38
|
# File 'lib/qwe/db.rb', line 36
def self.server
@@server ||= DRbObject.new_with_uri(Server.default_uri)
end
|
.stop ⇒ Object
17
18
19
|
# File 'lib/qwe/db.rb', line 17
def self.stop
@@srv.stop
end
|