Checking stream existence and listing all streams

1,743 views
Skip to first unread message

Sean Farrow

unread,
Oct 28, 2014, 8:24:04 PM10/28/14
to event...@googlegroups.com

Hi,

 

Are there plans to add an API to allow us to check whether a stream exists (I’ve already got some code to do this, so if a PR is wanted I can do that).

Also would it be possible to have API’s to list all streams and allow the user to query for streams that fit certain naming criteria. For example I have streams in the form {0}ReferenceList where 0 is currency. What I’d like to do is say give me all streams that are reference lists, i.e that would translate in to a query that says for example give me all streams who’s names end with the string “ReferenceList”.

Any help appreciated.

Kind regards

Sean.

 

Greg Young

unread,
Oct 29, 2014, 5:14:56 AM10/29/14
to event...@googlegroups.com
The second part yes there are plans for that (internal hosting of lucene)

For the first bit (check if stream exists) you can already do this. Readstreambackwards int.maxvalue, 1) this also gives you the current end of the stream :)

Cheers,

Greg
--
You received this message because you are subscribed to the Google Groups "Event Store" group.
To unsubscribe from this group and stop receiving emails from it, send an email to event-store...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Studying for the Turing test

Sean Farrow

unread,
Oct 31, 2014, 5:51:12 PM10/31/14
to event...@googlegroups.com

Hi,

 

Is there any sample to list all streams currently? I’m assuming Lucene is not implemented as yet?

Kind regards

Sean.

Greg Young

unread,
Oct 31, 2014, 5:53:43 PM10/31/14
to event...@googlegroups.com
Not pushed. There is not "give me all streams query" that said take a look at the $streams internal projection or you can listen on events and create a projection that creates this data for you from the outside.

Sean Farrow

unread,
Nov 1, 2014, 10:39:21 AM11/1/14
to event...@googlegroups.com

Hi Greg,

 

Where in the source tree is the %streams projection created/is the source code of this projection?

Also, can I subscribe to projections, or do I need to keep querying them manually, any example(s) would be useful!

Greg Young

unread,
Nov 1, 2014, 12:07:36 PM11/1/14
to event...@googlegroups.com
Projections emit to streams. Streams you know for the rest of questions. Here you go (emits the 0th event in a stream to a stream called $streams. Listen to it and know all streams.

Ray Wang

unread,
Feb 20, 2015, 2:36:01 PM2/20/15
to event...@googlegroups.com
About list all streams:
Just played with Event Store 3.01 projection. Following js will return list of streams:
fromAll().
    when({
        $init: function(s,e) { return {streanList:"", count:0} },
        $any : function(s,e) {
            if (!s.streanList){
                s.streanList =" ";
            }
            if (s.streanList.indexOf(e.streamId) < 0){
               s.streanList = s.streanList + e.streamId +",";
               s.count++;
            }
        }
    })
It is bad, need to iterate all of events.

Greg Young

unread,
Feb 20, 2015, 2:44:55 PM2/20/15
to event...@googlegroups.com

This is a really bad idea. The state can be massive

--

Ray Wang

unread,
Feb 20, 2015, 2:47:37 PM2/20/15
to event...@googlegroups.com
Any good option?

Greg Young

unread,
Feb 20, 2015, 2:55:53 PM2/20/15
to event...@googlegroups.com

$streams? https://github.com/EventStore/EventStore/blob/dev/src/EventStore.Projections.Core/Standard/IndexStreams.cs is the internal projection code. It must be enabled.

What will happe  to your projection with 100m streams?

Reply all
Reply to author
Forward
0 new messages