summaryrefslogtreecommitdiff
path: root/src/fabric.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/fabric.erl')
-rw-r--r--src/fabric.erl19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/fabric.erl b/src/fabric.erl
index 892673a5..9158b9e9 100644
--- a/src/fabric.erl
+++ b/src/fabric.erl
@@ -23,10 +23,21 @@
% db operations
all_dbs() ->
- fabric_all_databases:all_databases("").
-
-all_dbs(Customer) ->
- fabric_all_databases:all_databases(Customer).
+ all_dbs(<<>>).
+
+all_dbs(Prefix) when is_list(Prefix) ->
+ all_dbs(list_to_binary(Prefix));
+all_dbs(Prefix) when is_binary(Prefix) ->
+ Length = byte_size(Prefix),
+ MatchingDbs = ets:foldl(fun(#shard{dbname=DbName}, Acc) ->
+ case DbName of
+ <<Prefix:Length/binary, _/binary>> ->
+ [DbName | Acc];
+ _ ->
+ Acc
+ end
+ end, [], partitions),
+ {ok, lists:usort(MatchingDbs)}.
get_db_info(DbName) ->
fabric_db_info:go(dbname(DbName)).