eiri commented on pull request #2885:
URL: https://github.com/apache/couchdb/pull/2885#issuecomment-628628922
@rnewson Can you take a look, please, if you have time?
In "real" key manger this could be used with something like this:
```erlang
get_db_info(#{} = Db) ->
#{
tx := Tx,
db_prefix := DbPrefix
} = Db,
{Start, End} = erlfdb_tuple:range({?WRAPPED_KEY}, DbPrefix),
Range = erlfdb:get_range(Tx, Start, End),
lists:foldl(fun({K, V}, Acc) ->
case erlfdb_tuple:unpack(K, DbPrefix) of
{?WRAPPED_KEY, <<"wrapped_key">>} -> Acc;
{?WRAPPED_KEY, Key} -> [{Key, V} | Acc]
end
end, [{encrypted, true}], Range).
```
I have two things I'm not sure about:
1. Do we want to set info from aegis key manager into special namespace in
db_info, something like this:
```json
"disk_size": 0,
"instance_start_time": "0",
"purge_seq": 0,
"aegis": {
"encrypted": true,
"crk": ...
}
...
```
Right now this is totally up to key manager.
2. Do we want to make callback `get_db_info/1` optional on
`aegis_key_manger` behaviour? Then `aegis:get_db_info/1` can just check if it's
exported and return `[]` otherwise, so nothing will be added to db_info.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]