summaryrefslogtreecommitdiffstats
path: root/doc/index.rst
blob: 9d0b605b3458eddfc769d9b7dca3a03a255a0429 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
libgfapi-python
===============

This is the official python bindings for `GlusterFS <http://www.gluster.org>`_
libgfapi C library interface.

Example Usage
-------------

.. code-block:: python

    from gluster import gfapi

    # Create virtual mount
    volume = gfapi.Volume('10.7.1.99', 'datavolume')
    volume.mount()

    # Create directory
    volume.mkdir('dir1', 0755)

    # List directories
    volume.listdir('/')

    # Create new file and write to it
    with volume.fopen('somefile.txt', 'w+') as f:
        f.write("Winter is coming.")

    # Open and read file
    with volume.fopen('somefile.txt', 'r') as f:
      print f.read()

    # Delete file
    volume.unlink('somefile.txt')

    # Unmount the volume
    volume.umount()

.. toctree::
    :hidden:
    :glob:

    *