Your First Stream
Let’s create your first event stream.
Serve
Unlike sqlite
, which operates directly on the file system, xs
requires a
running process to manage access to the local store. This enables features like
subscribing to real-time updates from the event stream.
Start an xs
store in a dedicated window:
Client
append
command
OK! Let’s append our first event:
cat
and cas
commands
and then cat
the stream:
These are the raw frames
on the stream. The actually content is stored
separately in the Content-Addressable Storage
(CAS). You can read more about
that here.
We have the full expressiveness of Nushell available to us—for example, we can get the content hash of the last frame on the stream using:
and then use the .cas
command to retrieve the content:
We can also retrieve the content for a frame by piping it in its entirety
directly to .cas
:
These are the raw frames
on the stream. The actually content is stored
separately in the Content-Addressable Storage
(CAS). You can read more about
that here.
We can retrieve the content for a frame using its content hash:
head
command
Let’s submit another note:
We can get the most recent note on the stream using the .head
command:
We can get the most recent note on the stream using the head
command:
riffing
Finally, let’s pull a list of all our notes.
We can use where
to filter the stream for only the notes
topic, and then use
the each
command to pull out the content of each note:
Fun! 🎉
Fun! 🎉