repo.or.cz
/
metropolis.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
tc/hdb: add exclusive mode, lock disabling
[metropolis.git]
/
lib
/
metropolis
/
tc
/
hdb
/
ex.rb
blob
5bc7f3961487338b7f09982e10baa8a86f119731
1
module Metropolis::TC::HDB::EX
2
def self.extended(obj)
3
obj.instance_eval do
4
@wr_flags |= @rd_flags
5
@rd_flags = nil
6
@dbv.each { |(hdb, path)|
7
hdb.open(path, @wr_flags) or ex!(:open, hdb)
8
}
9
@ex_dbv = @dbv.map { |(hdb,_)| hdb }
10
end
11
end
12
13
def reader(key)
14
yield @ex_dbv[key.hash % @nr_slots]
15
end
16
17
alias_method :writer, :reader
18
end