summaryrefslogtreecommitdiff
path: root/src/fabric/src/fabric_view_changes.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/fabric/src/fabric_view_changes.erl')
-rw-r--r--src/fabric/src/fabric_view_changes.erl18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/fabric/src/fabric_view_changes.erl b/src/fabric/src/fabric_view_changes.erl
index beeaecee1..5115004ad 100644
--- a/src/fabric/src/fabric_view_changes.erl
+++ b/src/fabric/src/fabric_view_changes.erl
@@ -18,6 +18,9 @@
%% exported for upgrade purposes.
-export([keep_sending_changes/8]).
+%% exported for testing and remsh debugging
+-export([unpack_seqs/1]).
+
-include_lib("fabric/include/fabric.hrl").
-include_lib("mem3/include/mem3.hrl").
-include_lib("couch/include/couch_db.hrl").
@@ -410,6 +413,21 @@ unpack_seq_decode_term(Opaque) ->
binary_to_term(couch_util:decodeBase64Url(Opaque)).
+% This is used for testing and for remsh debugging
+%
+% Unlike unpack_seqs/2 it returns just the unpacked list of sequences from the
+% `10-g1A...` format. The result might look like [{Node, [Begin, End], {SeqNum,
+% Uuid, EpochNode}}, ...] or just [{Node, [Begin, End], SeqNum}, ...]
+-spec unpack_seqs(binary()) -> [tuple()].
+unpack_seqs(Packed) ->
+ Opaque = unpack_seq_regex_match(Packed),
+ unpack_seq_decode_term(Opaque).
+
+
+% Returns fabric_dict with {Shard, Seq} entries
+%
+-spec unpack_seqs(pos_integer() | list() | binary(), binary()) ->
+ orddict:orddict().
unpack_seqs(0, DbName) ->
fabric_dict:init(mem3:shards(DbName), 0);