Revision 1fbdb3d7

b/docs/dev-guide.rst
3 3
Synnefo Developer's Guide
4 4
^^^^^^^^^^^^^^^^^^^^^^^^^
5 5

  
6
This is the complete Synnefo Developer's Guide. Here, we document all Synnefo
6
This is the complete Synnefo Developer's Guide.
7

  
8
Environment set up
9
==================
10

  
11
First of all you have to set up a developing environment for Synnefo.
12

  
13
**1. Create a new Squeeze VM**
14

  
15
**2. Build your own Synnefo installation**
16

  
17
Follow the instructions `here <http://www.synnefo.org/docs/synnefo/latest/quick-install-guide.html>`_
18
to build Synnefo on a single node using ``snf-deploy``.
19

  
20
**3. Install GitPython**
21

  
22
.. code-block:: console
23

  
24
	# pip install gitpython
25

  
26
**4. Install devflow**
27

  
28
Devflow is a tool to manage versions, helps implement the git flow development process,
29
and builds Python and Debian packages. You will need it to create your code's version.
30

  
31
.. code-block:: console
32

  
33
	# pip install devflow
34

  
35
**5. Get Synnefo code**
36

  
37
First you need to install git
38

  
39
.. code-block:: console
40

  
41
	# apt-get install git
42

  
43
And now get the Synnefo code from the official Synnefo repository
44

  
45
.. code-block:: console
46

  
47
	$ git clone https://code.grnet.gr/git/synnefo
48

  
49
Make sure you did the previous as a regular user. Otherwise you will have problems
50
with file permissions when deploying.
51

  
52
**6. Code and deploy**
53

  
54
1. Configure the version
55

  
56
.. code-block:: console
57

  
58
	$ devflow-update-version
59

  
60
2. Code
61
3. In every component you change run
62

  
63
.. code-block:: console
64

  
65
	# python setup.py develop
66

  
67
4. Refresh the web page and see your changes
68

  
69
Synnefo REST APIs
70
=================
71

  
72
Here, we document all Synnefo
7 73
REST APIs, to allow external developers write independent tools that interact
8 74
with Synnefo.
9 75

  
......
238 304
Consider the following algorithm for synchronizing a local folder with the
239 305
server. The "state" is the complete object listing, with the corresponding
240 306
attributes.
241
 
307

  
242 308
.. code-block:: python
243 309

  
244 310
  # L: Local State, the last synced state of the object.
245 311
  # Stored locally (e.g. in an SQLite database)
246
  
312

  
247 313
  # C: Current State, the current local state of the object
248 314
  # Returned by the filesystem
249
  
315

  
250 316
  # S: Server State, the current server state of the object
251 317
  # Returned by the server (HTTP request)
252
  
318

  
253 319
  def sync(path):
254 320
      L = get_local_state(path)   # Database action
255 321
      C = get_current_state(path) # Filesystem action
256 322
      S = get_server_state(path)  # Network action
257
  
323

  
258 324
      if C == L:
259 325
          # No local changes
260 326
          if S == L:
......
278 344
              else:
279 345
                  # Conflicting changes exist
280 346
                  conflict()
281
  
347

  
282 348

  
283 349
Notes:
284 350

  

Also available in: Unified diff