diff options
author | Prashanth Pai <ppai@redhat.com> | 2016-06-09 15:19:57 +0530 |
---|---|---|
committer | Prashanth Pai <ppai@redhat.com> | 2016-06-09 16:33:13 +0530 |
commit | f7f2dafb1e3d09017de6968a2a553d3e8b6c765c (patch) | |
tree | dc46d31d639a321100724ca83d66862333892085 /doc/index.rst | |
parent | 972c24f8b11d5a3e7e6fc341453d9733b2bb47b5 (diff) |
Revamp and complete API documentation
Created .rst files that sphinx can use to auto-generate entire
API documentation from doc strings present in code. This can be easily
rendered and hosted on ReadTheDocs website.
Change-Id: If1a569bdeaaba21919ac77ba8bd4967dfec22603
Signed-off-by: Prashanth Pai <ppai@redhat.com>
Diffstat (limited to 'doc/index.rst')
-rw-r--r-- | doc/index.rst | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/doc/index.rst b/doc/index.rst new file mode 100644 index 0000000..2ff1263 --- /dev/null +++ b/doc/index.rst @@ -0,0 +1,56 @@ +libgfapi-python +=============== + +This is the official python bindings for `GlusterFS <http://www.gluster.org>`_ +libgfapi C library interface. + +Installation +------------ + +Install from source: + +.. code-block:: console + + $ git clone https://review.gluster.org/libgfapi-python + $ cd libgfapi-python + $ sudo python setup.py install + +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.unmount() + + +API Reference +------------- + +.. toctree:: + :maxdepth: 2 + + api-reference |