How to retrieve data written using java api from `fdbcli`

Hi, I used java api to store k,v to fdb, how to retrieve it from fdbcli ? Thank you very much for your help in advance.
like
private static void addDbInfo(TransactionContext db, String dbname, final DatabaseInfo dbInfo)
{
db.run((Transaction tr) -> {
tr.set(Tuple.from("dbInfo", dbname).pack(), ObjectByteUtil.objectToByteArray(dbInfo));
return null;
});
}
method ObjectByteUtil.objectToByteArray(dbInfo) is to convert dbInfo into byte[]
the key is dbname, right?
like i added dbname1

fdb> get dbname1
`dbname1’: not found

The code you posted above writes a key that’s encoded using the tuple layer. Fdbcli doesn’t know about the tuple layer, so there isn’t an easy way to read such keys. One thing you can do if you just want to look at the raw keys and your database is small (say during development) is fdbcli --exec 'getrange "" \xff', which will show the (default first 25) key value pairs in your db.

Here’s way too much detail on the tuple layer: foundationdb/tuple.md at master · apple/foundationdb · GitHub.

1 Like