summaryrefslogtreecommitdiffstats
path: root/README.md
blob: 656a67ef0c4c0f859cd977f919ece22f5189201a (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
### Overview

This is the official python bindings for the
[GlusterFS](http://www.gluster.org) libgfapi C library interface.

Complete API reference and documentation can be found at
[ReadTheDocs](http://libgfapi-python.readthedocs.io/)

### Installation

```
$ git clone https://review.gluster.org/libgfapi-python
$ cd libgfapi-python
$ sudo python setup.py install
```

### Example Usage

```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()
```

### TODOs

* Submit to pypy to enable installing using pip
* Add support for py3
* Implement async I/O APIs
* Implement file locking APIs
* Implement os.scandir() like API that leverages d\_type
* Improve Volume.walk() by leveraging scandir.
* Test and allow protocols other than TCP such as rdma and socket.

Please follow the [Developer Guide](doc/markdown/dev_guide.md) to contribute code.