Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
smn committed May 20, 2015
1 parent 3442cfa commit c2e0ad0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
33 changes: 33 additions & 0 deletions docs/index.rst
Expand Up @@ -78,6 +78,37 @@ it via elastic search.
workspace.destroy()


Using a Remote workspace
------------------------

When paired with unicore.distribute_ it is possible to connect to a Git
repository hosted on a network somewhere instead of needing file system
access. This is done via the RemoteWorkspace.

In a distributed hosting environment this can help eliminate issues
where applications may run on different servers than where the Git content
repositories live.

.. code::
>>> from elasticgit.workspace import RemoteWorkspace
>>> from unicore.content.models import Page
>>> rws = RemoteWorkspace('http://localhost:6543/repos/unicore-sample-content.json')
>>> rws.sync(Page)
({u'c63477768fe745809b411878ac9c0023'}, set())
>>> rws.S(Page).count()
1
>>> [page] = rws.S(Page)
>>> page.title
u'page title'
>>> page.uuid
u'c63477768fe745809b411878ac9c0023'
.. note::

Please note that the RemoteWorkspace is currently read only.


.. toctree::
:maxdepth: 2

Expand All @@ -97,3 +128,5 @@ Indices and tables
* :ref:`modindex`
* :ref:`search`


.. _unicore.distribute: http://unicoredistribute.readthedocs.org/
4 changes: 2 additions & 2 deletions elasticgit/workspace.py
Expand Up @@ -348,9 +348,9 @@ def __init__(self, url, es=None, index_prefix=None):
:param str index_prefix:
The prefix to use when generating index names for Elasticsearch
"""
self.es_settings = es or {'urls': urljoin(url, '/esapi')}
self.index_prefix = index_prefix or self.sm.repo_name
self.sm = RemoteStorageManager(url)
self.index_prefix = index_prefix or self.sm.repo_name
self.es_settings = es or {'urls': urljoin(url, '/esapi')}
self.im = ESManager(
self.sm,
es=get_es(**self.es_settings),
Expand Down

0 comments on commit c2e0ad0

Please sign in to comment.