Golang binding for iRODS C API: An iRODS client library written in Golang + C
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
msi
screenshots
.gitattributes
.gitignore
4-1-10_BUILD_README.md
4-2-0_BUILD_README.md
Dockerfile
HOWTO.md
LICENSE.md
README.md
acl.go
client.go
client_test.go
collection.go
collection_test.go
connection.go
connection_test.go
dataobj.go
dataobj_test.go
errors.go
group.go
helpers.go
httphandler.go
meta.go
meta_test.go
resource.go
user.go
wrapper.c
wrapper.h
zone.go

README.md

GoRODS

Golang binding for iRODS C API. Compatible with golang version >= 1.5

GoDoc

Installation

Install GoRODS (assuming GOPATH is setup)

$ export CGO_LDFLAGS_ALLOW=.*
$ go get github.com/jjacquay712/GoRODS 

Run Tests In Docker Container

Clone repository and run:

$ docker build -t gorods .
$ docker run -it gorods -irods.host=192.168.1.147 -irods.username=rods -irods.password=mypassword

Docs

iRODS client binding

iRODS microservice binding

Usage Guide and Examples

iRODS client binding

iRODS microservice binding

Basic Usage

package main

import (
	"fmt"
	"log"
	"github.com/jjacquay712/GoRODS"
)

func main() {
	
	client, conErr := gorods.New(gorods.ConnectionOptions{
		Type: gorods.UserDefined,

		Host: "localhost",
		Port: 1247,
		Zone: "tempZone",

		Username: "rods",
		Password: "password",
	})

	// Ensure the client initialized successfully and connected to the iCAT server
	if conErr != nil {
		log.Fatal(conErr)
	}


	// Open a collection reference for /tempZone/home/rods
	if openErr := client.OpenCollection(gorods.CollectionOptions{
		Path: "/tempZone/home/rods",
	}, func(col *gorods.Collection, con *gorods.Connection) {

		// Output collection's string representation
		fmt.Printf("String(): %v \n", col)

		// Loop over the data objects in the collection, print the file name
		col.EachDataObj(func(obj *gorods.DataObj) {
			fmt.Printf("%v \n", obj.Name())
		})

		// Loop over the subcollections in the collection, print the name
		col.EachCollection(func(subcol *gorods.Collection) {
			fmt.Printf("%v \n", subcol.Name())
		})

	}); openErr != nil {
		log.Fatal(openErr)
	}

}

Output:

CLI GoRODS Output

iRODS HTTP Mount

package main

import (
	"github.com/jjacquay712/GoRODS"
	"log"
	"net/http"
)

func main() {

	client, conErr := gorods.New(gorods.ConnectionOptions{
		Type: gorods.UserDefined,

		Host: "localhost",
		Port: 1247,
		Zone: "tempZone",

		Username: "rods",
		Password: "password",
	})

	// Ensure the client initialized successfully and connected to the iCAT server
	if conErr != nil {
		log.Fatal(conErr)
	}

	mountPath := "/irods/"

	// Setup the GoRODS FileServer
	fs := gorods.FileServer(gorods.FSOptions{
		Path:   "/tempZone/home/rods",
		Client: client,
		Download: true,
		StripPrefix: mountPath,
	})

	// Create the URL router
	mux := http.NewServeMux()

	// Serve the iRODS collection at /irods/
	mux.Handle(mountPath, http.StripPrefix(mountPath, fs))

	// Start HTTP server on port 8080
	log.Fatal(http.ListenAndServe(":8080", mux))

}

Output:

HTTP GoRODS Output HTTP GoRODS Output

Contributing

Send me a pull request!

Todo

Code Polish

  • Complete unit tests

Known Issues

License & Copyright

Copyright (c) 2016, University of Florida Research Foundation, Inc. and The BioTeam, Inc. All Rights Reserved.

GoRODS is released under a 3-clause BSD License. For more information please refer to the LICENSE.md file