Browse Source

6.12.3 bot top

Namdak Tonpa 5 years ago
parent
commit
a67058b7ea
5 changed files with 11 additions and 11 deletions
  1. 4 4
      man/kvs_stream.htm
  2. 1 1
      mix.exs
  3. 1 1
      src/kvs.app.src
  4. 3 3
      src/layers/kvs_stream.erl
  5. 2 2
      src/stores/kvs_st.erl

+ 4 - 4
man/kvs_stream.htm

@@ -130,11 +130,11 @@
 	<h4 id="save">save(#reader{}) -> #reader{}.</h4>
 	<p>Flushes reader cursor to database.</p>
 
-	<h4 id="top">top(#reader{}) -> #reader{}.</h4>
-	<p>Moves cursor to top of the list.</p>
+	<h4 id="bot">bot(#reader{}) -> #reader{dir = 0}.</h4>
+	<p>Changes the direction of the cursor to take foraward (normal).</p>
 
-	<h4 id="bot">bot(#reader{}) -> #reader{}.</h4>
-	<p>Moves cursor to bottom of the list.</p>
+	<h4 id="top">top(#reader{}) -> #reader{dir = 1}.</h4>
+	<p>Changes the direction of the cursor to take backwards.</p>
     </section>
     <section>
 	<h3>ITER</h3>

+ 1 - 1
mix.exs

@@ -4,7 +4,7 @@ defmodule KVS.Mixfile do
   def project do
     [
       app: :kvs,
-      version: "6.12.2",
+      version: "6.12.3",
       description: "KVS Abstract Chain Database",
       package: package(),
       deps: deps()

+ 1 - 1
src/kvs.app.src

@@ -1,6 +1,6 @@
 {application, kvs,
    [{description, "KVS Abstract Chain Database"},
-    {vsn, "6.12.2"},
+    {vsn, "6.12.3"},
     {registered, []},
     {applications, [kernel,stdlib]},
     {mod, { kvs, []}},

+ 3 - 3
src/layers/kvs_stream.erl

@@ -44,9 +44,9 @@ p({ok,R},C,P)    -> r(kvs:get(tab(R),ep(R)),C,P);
 p({error,X},_,_) -> {error,X}.
 r({ok,R},C,P)    -> C#reader{cache={tab(R),id(R)},pos=P};
 r({error,X},_,_) -> {error,X}.
-w({ok,#writer{first=[]}},bot,C)           -> C#reader{cache=[],pos=1};
-w({ok,#writer{first=B}},bot,C)            -> C#reader{cache={tab(B),id(B)},pos=1};
-w({ok,#writer{cache=B,count=Size}},top,C) -> C#reader{cache={tab(B),id(B)},pos=Size};
+w({ok,#writer{first=[]}},bot,C)           -> C#reader{cache=[],pos=1,dir=0};
+w({ok,#writer{first=B}},bot,C)            -> C#reader{cache={tab(B),id(B)},pos=1,dir=0};
+w({ok,#writer{cache=B,count=Size}},top,C) -> C#reader{cache={tab(B),id(B)},pos=Size,dir=1};
 w({error,X},_,_)                          -> {error,X}.
 
 % section: take, drop

+ 2 - 2
src/stores/kvs_st.erl

@@ -19,8 +19,8 @@ id(T)   -> e(#it.id, T).
 
 % section: next, prev
 
-top  (#reader{}=C) -> C.
-bot  (#reader{}=C) -> C.
+top  (#reader{}=C) -> C#reader{dir=1}.
+bot  (#reader{}=C) -> C#reader{dir=0}.
 
 next (#reader{cache=[]}) -> {error,empty};
 next (#reader{feed=Feed,cache=I}=C) when is_tuple(I) ->