Browse Source

take 1 kvs merge pair programming XP waterfall

tonpa 4 years ago
parent
commit
d13ca7b172
1 changed files with 2 additions and 10 deletions
  1. 2 10
      src/stores/kvs_rocks.erl

+ 2 - 10
src/stores/kvs_rocks.erl

@@ -17,15 +17,7 @@ tb(T) when is_binary(T) -> T;
 tb(T)      -> term_to_binary(T).
 
 fmt([]) -> [];
-fmt(K) ->
-  B = tb(K),
-  S = if byte_size(B) > 1 -> 2;true -> byte_size(B) end,
-  B1 = binary:split(B,[<<"/">>,<<"//">>], [{scope,{0,S}},trim_all]),
-  B2 = case B1 of [] -> <<>>;[X|_] -> X end,
-  S1 = if byte_size(B2) > 1 -> -2; true -> 0 end,
-  B3 = binary:split(B2,[<<"/">>,<<"//">>], [{scope,{byte_size(B2),S1}},trim_all]),
-  B4 = case B3 of [] -> <<>>;[X1|_] -> X1 end,
-  B4.
+fmt(K) -> tb(K).
 
 key(R)     when is_tuple(R) andalso tuple_size(R) > 1 -> key(e(1,R), e(2,R));
 key(R)     -> key(R,[]).
@@ -33,7 +25,7 @@ key(Tab,R) when is_tuple(R) andalso tuple_size(R) > 1 -> key(Tab, e(2,R));
 key(Tab,R) -> iolist_to_binary([lists:join(<<"/">>, lists:flatten([<<>>, fmt(Tab), fmt(R)]))]).
 
 fd(Key) ->
-  B = lists:reverse(binary:split(tb(Key), [<<"/">>, <<"//">>], [global, trim_all])),
+  B = lists:reverse(binary:split(tb(Key), [<<"/">>], [global, trim_all])),
   B1 = lists:reverse(case B of [] -> [];[X] -> [X];[_|T] -> T end),
   iolist_to_binary(lists:join(<<"/">>, [<<>>]++B1)).