LeveldbException
auto opt = new Options; opt.create_if_missing = true; auto db = new DB(opt, "/my/db/"); // Unsafe banking example auto batch = new WriteBatch; double joe = db.get_slice(Slice("Joe")).as!double; double sally = db.get_slice(Slice("Sally")).as!double; joe -= 10.00; sally += 10.00; if(joe < 0.0) joe -= 30.00; // overdraft fee // submit the put in a single update batch.put(Slice("Joe"), Slice(joe)); batch.put(Slice("Sally"), Slice(sally)); db.write(batch);
Sublmits a BatchWrite to the DB.
Used to do batch writes.