moneta-rb / moneta

a unified interface to key/value stores
https://github.com/moneta-rb/moneta
MIT License
1.11k stars 87 forks source link

RO BDB and other DB open options #233

Open elico opened 2 years ago

elico commented 2 years ago

Hey,

I want to use TokyoCabinet and BDB in a ReadOnly mode. It's possible in the underlying library but I do not see any example of how to use these options when opening a DB file. An example for BDB and TokyoCabinet would be helpful.

Thanks

asppsa commented 2 years ago

Hi,

Doesn't look like we have an option for that at the moment - we can look at adding it though. In the meantime, you can use the backend option when creating your store to configure TokyoCabinet in the way you would like. For example:

bdb = ::TokyoCabinet::BDB.new
bdb.open('my_database.tch', ::TokyoCabinet::BDB::OREADER) # Sorry if this is not 100% correct
store = Moneta.new(:TokyoCabinet, backend: bdb)
elico commented 2 years ago

great thanks!

בתאריך יום א׳, 28 באוג׳ 2022, 16:00, מאת Alastair Pharo ‏< @.***>:

Hi,

Doesn't look like we have an option for that at the moment - we can look at adding it though. In the meantime, you can use the backend option when creating your store to configure TokyoCabinet in the way you would like. For example:

bdb = ::TokyoCabinet::BDB.newbdb.open('my_database.tch', ::TokyoCabinet::BDB::OREADER) # Sorry if this is not 100% correctstore = Moneta.new(:TokyoCabinet, backend: bdb)

— Reply to this email directly, view it on GitHub https://github.com/moneta-rb/moneta/issues/233#issuecomment-1229452582, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANUHMGGQYBVICYHB5DIZK3V3NPHXANCNFSM57KFYUVA . You are receiving this because you authored the thread.Message ID: @.***>