Skip to content

Commit c2e0ad0

Browse files
committed
add docs
1 parent 3442cfa commit c2e0ad0

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

docs/index.rst

+33
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,37 @@ it via elastic search.
7878
workspace.destroy()
7979

8080

81+
Using a Remote workspace
82+
------------------------
83+
84+
When paired with unicore.distribute_ it is possible to connect to a Git
85+
repository hosted on a network somewhere instead of needing file system
86+
access. This is done via the RemoteWorkspace.
87+
88+
In a distributed hosting environment this can help eliminate issues
89+
where applications may run on different servers than where the Git content
90+
repositories live.
91+
92+
.. code::
93+
94+
>>> from elasticgit.workspace import RemoteWorkspace
95+
>>> from unicore.content.models import Page
96+
>>> rws = RemoteWorkspace('http://localhost:6543/repos/unicore-sample-content.json')
97+
>>> rws.sync(Page)
98+
({u'c63477768fe745809b411878ac9c0023'}, set())
99+
>>> rws.S(Page).count()
100+
1
101+
>>> [page] = rws.S(Page)
102+
>>> page.title
103+
u'page title'
104+
>>> page.uuid
105+
u'c63477768fe745809b411878ac9c0023'
106+
107+
.. note::
108+
109+
Please note that the RemoteWorkspace is currently read only.
110+
111+
81112
.. toctree::
82113
:maxdepth: 2
83114

@@ -97,3 +128,5 @@ Indices and tables
97128
* :ref:`modindex`
98129
* :ref:`search`
99130

131+
132+
.. _unicore.distribute: http://unicoredistribute.readthedocs.org/

elasticgit/workspace.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,9 @@ def __init__(self, url, es=None, index_prefix=None):
348348
:param str index_prefix:
349349
The prefix to use when generating index names for Elasticsearch
350350
"""
351-
self.es_settings = es or {'urls': urljoin(url, '/esapi')}
352-
self.index_prefix = index_prefix or self.sm.repo_name
353351
self.sm = RemoteStorageManager(url)
352+
self.index_prefix = index_prefix or self.sm.repo_name
353+
self.es_settings = es or {'urls': urljoin(url, '/esapi')}
354354
self.im = ESManager(
355355
self.sm,
356356
es=get_es(**self.es_settings),

0 commit comments

Comments
 (0)