summaryrefslogtreecommitdiff
path: root/src/mem3/src/mem3.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem3/src/mem3.erl')
-rw-r--r--src/mem3/src/mem3.erl11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mem3/src/mem3.erl b/src/mem3/src/mem3.erl
index 7151a3ec1..63778dc6f 100644
--- a/src/mem3/src/mem3.erl
+++ b/src/mem3/src/mem3.erl
@@ -33,6 +33,7 @@
-export([get_placement/1]).
-export([ping/1, ping/2]).
-export([db_is_current/1]).
+-export([shard_creation_time/1]).
%% For mem3 use only.
-export([name/1, node/1, range/1, engine/1]).
@@ -198,6 +199,16 @@ shard_suffix(DbName0) when is_binary(DbName0) ->
shard_suffix(Db) ->
shard_suffix(couch_db:name(Db)).
+shard_creation_time(DbName0) ->
+ Shard = hd(shards(DbName0)),
+ case Shard#shard.name of
+ <<"shards/", _:8/binary, "-", _:8/binary, "/", DbName/binary>> ->
+ [$. | Time] = filename:extension(binary_to_list(DbName)),
+ list_to_binary(Time);
+ _ ->
+ <<"0">>
+ end.
+
fold_shards(Fun, Acc) ->
mem3_shards:fold(Fun, Acc).