arkency / http_event_store

HttpEventStore is a HTTP connector to the Greg's Event Store.
http://httpeventstore.arkency.com
MIT License
42 stars 11 forks source link

Possible bug in reading events direction #23

Open paneq opened 7 years ago

paneq commented 7 years ago
2.4.1 :178 > client.read_events_forward(stream_name, 0, 20).first.position
 => 1 

2.4.1 :179 > client.read_all_events_forward(stream_name).first.position
 => 0 

2.4.1 :183 >   client.read_events_forward(stream_name, 0, 20)
 => [
#<struct Event type="ProductSupplied", data={"store_id"=>1, "sku"=>"WORKSHOP", "quantity"=>30}, source_event_uri="http://localhost:2113/streams/Product-1-WORKSHOP/1", event_id="91d2266a-bb8b-4e8a-9db0-0f15732cfecc", id=1, position=1, stream_name="Product-1-WORKSHOP", created_time=2017-09-11 12:54:59 UTC>, 
#<struct Event type="ProductRegistered", data={"store_id"=>1, "sku"=>"WORKSHOP"}, source_event_uri="http://localhost:2113/streams/Product-1-WORKSHOP/0", event_id="e059c1b1-5049-4b9c-8086-ebb1ec1f5239", id=0, position=0, stream_name="Product-1-WORKSHOP", created_time=2017-09-11 12:33:16 UTC>] 

2.4.1 :184 > client.read_all_events_forward(stream_name)
 => [
#<struct Event type="ProductRegistered", data={"store_id"=>1, "sku"=>"WORKSHOP"}, source_event_uri="http://localhost:2113/streams/Product-1-WORKSHOP/0", event_id="e059c1b1-5049-4b9c-8086-ebb1ec1f5239", id=0, position=0, stream_name="Product-1-WORKSHOP", created_time=2017-09-11 12:33:16 UTC>,
#<struct Event type="ProductSupplied", data={"store_id"=>1, "sku"=>"WORKSHOP", "quantity"=>30}, source_event_uri="http://localhost:2113/streams/Product-1-WORKSHOP/1", event_id="91d2266a-bb8b-4e8a-9db0-0f15732cfecc", id=1, position=1, stream_name="Product-1-WORKSHOP", created_time=2017-09-11 12:54:59 UTC>] 

Notice that read_events_forward returned events in different order than read_all_events_forward.

Is that intentional or a bug? I am not sure what to think about it.

litch commented 7 years ago

That's pretty surprising, definitely looks like read_events_forward is returning them in the wrong order. Does read_events_backward return the same thing as read_events_forward then? Or is that reversed as well? The nomenclature that the GES team uses (the "Atom" ordering) has always confused me.

paneq commented 7 years ago

The nomenclature that the GES team uses (the "Atom" ordering) has always confused me.

Me as well.

That's pretty surprising, definitely looks like read_events_forward is returning them in the wrong order

That was my assumption as well.