Class: LS4::TokyoTyrantMDS::HADB
Constant Summary
collapse
- DEFAULT_PORT =
1978
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
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/ls4/service/mds_tt.rb', line 63
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
74
75
76
77
78
79
|
# File 'lib/ls4/service/mds_tt.rb', line 74
def error_result?(db, result)
if FATAL_ERROR.include?(db.ecode)
return db.errmsg(db.ecode)
end
return nil
end
|
#open_db(addr) ⇒ Object
53
54
55
56
57
58
59
60
61
|
# File 'lib/ls4/service/mds_tt.rb', line 53
def open_db(addr)
db = TBL.new
db.instance_eval("@enc = 'ASCII-8BIT'") unless db.open(*addr)
$log.warn "failed to connect TokyoTyrant MDS: #{addr}"
end
db.setindex(COL_KEY, TBL::ITLEXICAL)
db
end
|