Namdak Tonpa 7 years ago
parent
commit
281e008327
2 changed files with 16 additions and 18 deletions
  1. 13 7
      man/kvs_stream.htm
  2. 3 11
      src/kvs_stream.erl

+ 13 - 7
man/kvs_stream.htm

@@ -47,12 +47,12 @@
             <li><b><a href="#down">down/1</a></b> &mdash; down from top.</li>
             <li><b><a href="#next">next/1</a></b> &mdash; move reader next.</li>
             <li><b><a href="#prev">prev/1</a></b> &mdash; move reader prev.</li>
-            <li><b><a href="#take">take/2</a></b> &mdash; take N elements staring from reader.</li>
-            <li><b><a href="#drop">drop/2</a></b> &mdash; skip N elements staring from reader.</li>
-            <li><b><a href="#add">add/2</a></b> &mdash; add element to list.</li>
-            <li><b><a href="#remove">remove/2</a></b> &mdash; remove element from list.</li>
-            <li><b><a href="#cons">cons/2</a></b> &mdash; add element to top.</li>
-            <li><b><a href="#snoc">snoc/2</a></b> &mdash; add element to bot.</li>
+            <li><b><a href="#take">take/1</a></b> &mdash; take N elements staring from reader.</li>
+            <li><b><a href="#drop">drop/1</a></b> &mdash; skip N elements staring from reader.</li>
+            <li><b><a href="#add">add/1</a></b> &mdash; add element to list.</li>
+            <li><b><a href="#remove">remove/1</a></b> &mdash; remove element from list.</li>
+            <li><b><a href="#cons">cons/1</a></b> &mdash; add element to top.</li>
+            <li><b><a href="#snoc">snoc/1</a></b> &mdash; add element to bot.</li>
         </ul></p></blockquote></p>
 
     <p>
@@ -81,7 +81,11 @@
           reader= [] :: [] | tuple(),
           writer= [] :: [] | tuple(),
           left=  0 :: integer(),
-          right= 0 :: inetegr() }.
+          right= 0 :: inetegr(),
+          args= [] :: term(),
+          status=[]:: add | remove | save | load
+                    | next | prev | take | drop
+                    | top | bot }.
 
   #iter { id=   [] :: [] | integer(),
           prev= [] :: [] | integer(),
@@ -97,6 +101,8 @@
 <li>dir=1 &mdash; Adding to bottom, reading down from top.</li>
 <li>top &mdash; The top of the list.</li>
 <li>bot &mdash; The bottom of the list.</li>
+<li>args &mdash; integer for take/drop/remove/get, tuple for add/put</li>
+<li>status &mdash; operation</li>
 <li>left &mdash; The distance to top from reader.</li>
 <li>right &mdash; The distance to bottom from reader.</li>
 </ul></p>

+ 3 - 11
src/kvs_stream.erl

@@ -9,17 +9,9 @@
 
 % n2o stream protocol
 
-info(#cur{id=I,status=get}=C,R,S) -> {reply, {bert, kvs_stream:load(I)},   R, S};
-info(#cur{status=put}     =C,R,S) -> {reply, {bert, kvs_stream:save(C)},   R, S};
-info(#cur{status=add}     =C,R,S) -> {reply, {bert, kvs_stream:add(C)},    R, S};
-info(#cur{status=remove}  =C,R,S) -> {reply, {bert, kvs_stream:remove(C)}, R, S};
-info(#cur{status=next}    =C,R,S) -> {reply, {bert, kvs_stream:next(C)},   R, S};
-info(#cur{status=prev}    =C,R,S) -> {reply, {bert, kvs_stream:prev(C)},   R, S};
-info(#cur{status=top}     =C,R,S) -> {reply, {bert, kvs_stream:top(C)},    R, S};
-info(#cur{status=bot}     =C,R,S) -> {reply, {bert, kvs_stream:bot(C)},    R, S};
-info(#cur{status=take}    =C,R,S) -> {reply, {bert, kvs_stream:take(C)},   R, S};
-info(#cur{status=drop}    =C,R,S) -> {reply, {bert, kvs_stream:drop(C)},   R, S};
-info(                      C,R,S) -> {reply, {unknown,C},                  R, S}.
+info(#cur{id=I,status=load}=C,R,S) -> {reply, {bert, kvs_stream:load(I)},   R, S};
+info(#cur{status=Method}   =C,R,S) -> {reply, {bert, kvs_stream:Method(C)}, R, S};
+info(                       C,R,S) -> {reply, {unknown,C},                  R, S}.
 
 % section: kvs_stream prelude