Skip to content
This repository has been archived by the owner on Jun 23, 2018. It is now read-only.

Commit

Permalink
Styling changes (#36)
Browse files Browse the repository at this point in the history
* Update workflow language rst styling
* Update Supported Integrations styling
  • Loading branch information
lanthias authored and mands committed Apr 10, 2017
1 parent 10169f2 commit f2fe559
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 52 deletions.
69 changes: 40 additions & 29 deletions reference/supported_integrations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,68 +7,79 @@ NStack is built to integrate with existing infrastructure, event, and data-sourc

.. seealso:: Learn more about *sources* and *sinks* in :ref:`Concepts<concepts>`

**Sources**
- Postgres ::
Sources
^^^^^^^

Postgres
-------

::

Sources.postgres<Text> {
pg_host = "localhost", pg_port = "5432",
pg_user = "user", pg_password = "123456",
pg_database = "db", pg_query = "SELECT * FROM tbl;" }

``pg_port`` defaults to 5432, ``pg_user`` defaults to ``postgres``, and
``pg_password`` defaults to the empty string. The other parameters are mandatory.
``pg_port`` defaults to 5432, ``pg_user`` defaults to ``postgres``, and
``pg_password`` defaults to the empty string. The other parameters are mandatory.

HTTP
----

- HTTP ::
::

Sources.http<Text> { http_path = "/foo" }

- RabbitMQ (AMQP) ::
RabbitMQ (AMQP)
--------------

::
Sources.amqp<Text> {
amqp_host = "localhost", amqp_port = "5672",
amqp_vhost = "/", amqp_exchange = "ex",
amqp_key = "key"
}

``amqp_port`` defaults to 5672 and ``amqp_vhost`` defaults to ``/``.
The other parameters are mandatory.
``amqp_port`` defaults to 5672 and ``amqp_vhost`` defaults to ``/``.
The other parameters are mandatory.

Sinks
^^^^^

Postgres
-------

**Sinks**
- Postgres ::
::

Sinks.postgres<Text> {
pg_host = "localhost", pg_port = "5432",
pg_user = "user", pg_password = "123456",
pg_database = "db", pg_table = "tbl" }

Like for Postgres source,
``pg_port`` defaults to 5432, ``pg_user`` defaults to ``postgres``, and
``pg_password`` defaults to the empty string. The other parameters are mandatory.
Like for Postgres source,
``pg_port`` defaults to 5432, ``pg_user`` defaults to ``postgres``, and
``pg_password`` defaults to the empty string. The other parameters are mandatory.

- NStack Log ::
NStack Log
---------
::

Sinks.log<Text>

The Log sink takes no parameters.
The Log sink takes no parameters.

- RabbitMQ (AMQP) ::
RabbitMQ (AMQP)
---------------

::

Sinks.amqp<Text> {
amqp_host = "localhost", amqp_port = "5672",
amqp_vhost = "/", amqp_exchange = "ex",
amqp_key = "key"
}

Like for AMQP source,
``amqp_port`` defaults to 5672 and ``amqp_vhost`` defaults to ``/``.
The other parameters are mandatory.

- Firebase ::

Sinks.firebase<Text> {
firebase_host = "localhost",
firebase_port = "111",
firebase_path = "..."
}

All parameters are mandatory.
Like for AMQP source,
``amqp_port`` defaults to 5672 and ``amqp_vhost`` defaults to ``/``.
The other parameters are mandatory.
67 changes: 44 additions & 23 deletions reference/workflow_language.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
Workflow Language
=================

Overview
--------

A module consists of a module header, import statements, and definitions,
for instance: ::

Expand All @@ -26,56 +29,74 @@ any other module: ::
If a name is not prefixed by a module alias, it refers to a function defined in
the current module.

Expressions
-----------

Expressions combine already defined functions through the following operations:

* Pipe: ``A.y | A.z``
Pipe
^^^^^
``A.y | A.z``

Every value produced by ``A.y`` is passed to ``A.z``.

The output type of ``A.y`` must match the input type of ``A.z``.

* Concat: ``concat A.y`` or ``A.y*``

Concat
^^^^^^
``concat A.y`` or ``A.y*``

``A.y`` must be a function that produces lists of values,
in which case ``concat A.y`` is a function that "unpacks" the lists
and yields the same values one by one.

* Filter: ``filter A.y`` or ``A.y?``
Filter
^^^^^^
``filter A.y`` or ``A.y?``

``A.y`` must be a function that produces "optional" (potentially missing) values,
in which case ``filter A.y`` is a function that filters out missing values.

* Type application. Some functions (notably, most sources and sinks) can be specialized
to multiple input or output types.
This is done with type application: ``Sources.http<Text>`` specializes
``Sources.http`` to the type ``Text``.
Type application
^^^^^^^^^^^^^^^^
``Sources.A<T>``

* Parameter application: ``A.y { one = "...", two = "..." }``.
Some functions (notably, most sources and sinks) can be specialized
to multiple input or output types.
This is done with type application: ``Sources.http<Text>`` specializes
``Sources.http`` to the type ``Text``.

Parameters are analogous to UNIX environment variables in the following ways:
Parameter application
^^^^^^^^^^^^^^^^^^^^^
``A.y { one = "...", two = "..." }``.

1. Parameters are inherited. E.g. in ::
Parameters are analogous to UNIX environment variables in the following ways:

y = x;
z = y { foo = "bar" };
1. Parameters are inherited. E.g. in ::

y = x;
z = y { foo = "bar" };

both functions ``x`` and ``y`` will have access to ``foo`` when ``z`` is
called.
both functions ``x`` and ``y`` will have access to ``foo`` when ``z`` is
called.

2. Parameters can be overridden. E.g. in ::
2. Parameters can be overridden. E.g. in ::

y = x { foo = "baz" };
z = y { foo = "bar" };

``y`` overrides the value of ``foo`` that is passed to ``x``.
Therefore, ``x`` will see the value of ``foo`` as ``baz``, not ``bar``.
``y`` overrides the value of ``foo`` that is passed to ``x``.
Therefore, ``x`` will see the value of ``foo`` as ``baz``, not ``bar``.

Parameters are used to configure sources and sinks —
for instance, to specify how to connect to a PostgreSQL database.

Parameters are used to configure sources and sinks —
for instance, to specify how to connect to a PostgreSQL database.
Parameters can also be used to configure user-defined modules.
Inside a Python nstack method, the value of parameter ``foo`` can be accessed as
``self.args["foo"]``.

Parameters can also be used to configure user-defined modules.
Inside a Python nstack method, the value of parameter ``foo`` can be accessed as
``self.args["foo"]``.
Comments
^^^^^^^^

The workflow language supports line and block comments.
Line comments start with ``//`` and extend until the end of line.
Expand Down

0 comments on commit f2fe559

Please sign in to comment.