Skip to content

Latest commit

 

History

History
96 lines (66 loc) · 2.3 KB

README.md

File metadata and controls

96 lines (66 loc) · 2.3 KB

go-billy-gluster GoDoc Build Status codecov.io

This package provides a basic go-billy driver to access gluster volumes. It uses libgfapi so it's not needed to mount the volume locally.

So far, following actions are implemented:

  • Create
  • Open
  • OpenFile
  • Stat
  • Rename
  • Remove
  • Readdir
  • MkdirAll

For more information head to the documentation

Installation

This package requires native libgfapi library that is contained in the development client packages of gluster.

  • Arch / Manjaro:
pacman -S glusterfs
  • Ubuntu / Debian:
apt-get install glusterfs-common
  • CentOS / RHEL:
yum install glusterfs-api

After installing the dependency you can install the library with go get:

go get gopkg.in/src-d/go-billy-gluster.v0

Example of utilization

package main

import (
	"fmt"

	"gopkg.in/src-d/go-billy-gluster.v0"
)

func main() {
	fs, err := gluster.New("server", "volume")
	if err != nil {
		panic(fmt.Sprintf("cannot connect to gluster volume %s", err))
	}

	f, err := fs.Create("filename.ext")
	if err != nil {
		panic(fmt.Sprintf("cannot create file %s", err))
	}

	_, err = f.Write([]byte("text"))
	if err != nil {
		panic(fmt.Sprintf("cannot write to file %s", err))
	}

	err = f.Close()
	if err != nil {
		panic(fmt.Sprintf("cannot close file %s", err))
	}

	err = fs.Close()
	if err != nil {
		panic(fmt.Sprintf("cannot disconnect from volume %s", err))
	}
}

Contribute

Contributions are more than welcome, if you are interested please take a look to our Contributing Guidelines.

Code of Conduct

All activities under source{d} projects are governed by the source{d} code of conduct.

License

Apache License Version 2.0, see LICENSE.