129130131132133134135136137138139
try { long pos = findValue(tx, key); Page page = getPage(tx, pos); Value v = readValue(tx, page); RecordMetaData md = buildMetaData(page); return new Record(key, v, md); } catch ( BTreeNotFoundException b ) { } catch ( BTreeException b ) { throw b;
502503504505506507508509510511512513514515516
public static final String[] PARAMS_getValue = {"key"}; public byte[] getValue(String key) throws DBException { Transaction tx = new Transaction(); try { Record rec = col.getRecord(tx, key); if ( rec == null ) throw new DBException(FaultCodes.COL_CANNOT_RETRIEVE, "Record '"+key+"' not found"); return rec.getValue().getData(); } catch ( DBException e ) { tx.cancel(); throw e; }
130131132133134135136137
} public boolean writeRecord(Transaction tx, Key key, Value value) throws DBException { checkOpened(); checkReadOnly(); records.put(key, new Record(key, value)); return true; }
187188189190191192193194195196197
RecordMetaData md = buildMetaData(file); fis.read(valueData); fis.close(); return new Record(key, new Value(valueData), md); } } catch ( Exception e ) { e.printStackTrace(System.err); }