Class: LS4::LocalTokyoCabinetMDS::HADB
Constant Summary
Constants inherited
from BasicHADB
BasicHADB::DEFAULT_WEIGHT
Instance Method Summary
collapse
Methods inherited from BasicHADB
#close, #initialize, #read, #write
Constructor Details
This class inherits a constructor from LS4::BasicHADB
Instance Method Details
#ensure_db(db, addr) ⇒ Object
82
83
84
85
86
87
88
89
90
91
|
# File 'lib/ls4/service/mds_tc.rb', line 82
def ensure_db(db, addr)
if FATAL_ERROR.include?(db.ecode)
db.close rescue nil
db.instance_eval("@ecode = ESUCCESS") db.open(*addr)
end
return db
rescue
return nil
end
|
#error_result?(db, result) ⇒ Boolean
93
94
95
96
97
98
|
# File 'lib/ls4/service/mds_tc.rb', line 93
def error_result?(db, result)
if FATAL_ERROR.include?(db.ecode)
return db.errmsg(db.ecode)
end
return nil
end
|
#open_db(addr) ⇒ Object
72
73
74
75
76
77
78
79
80
|
# File 'lib/ls4/service/mds_tc.rb', line 72
def open_db(addr)
db = TDB.new
db.instance_eval("@enc = 'ASCII-8BIT'") unless db.open(addr, TDB::OCREAT|TDB::OWRITER)
$log.warn "failed to connect local TokyoCabinet MDS: #{addr}"
end
db.setindex(COL_KEY, TDB::ITLEXICAL)
db
end
|
#parse_addr(addr) ⇒ Object
68
69
70
|
# File 'lib/ls4/service/mds_tc.rb', line 68
def parse_addr(addr)
addr
end
|