Code Monkey home page Code Monkey logo

go-irodsclient's Introduction

go-irodsclient

Go iRODS Client implemented in pure Golang

Import package

import (
    "github.com/cyverse/go-irodsclient/fs"
    "github.com/cyverse/go-irodsclient/irods/types"
    "github.com/cyverse/go-irodsclient/irods/util"
)

Account Configuration YAML

host:
  hostname: "data.cyverse.org"
  port: 1247
user:
  username: "USERNAME"
  password: "PASSWORD"
  zone: "iplant"
auth_scheme: "native"

Loading a YAML file.

yaml, err := os.ReadFile("account.yml")
if err != nil {
    logger.Error(err)
    panic(err)
}

account, err := types.CreateIRODSAccountFromYAML(yaml)
if err != nil {
    logger.Error(err)
    panic(err)
}

FileSystem Interface

Creating a file system object with default configurations.

appName := "delete_file"
filesystem, err := fs.NewFileSystemWithDefault(account, appName)
if err != nil {
    panic(err)
}
defer filesystem.Release()

Deleting a file and double check the file existance.

err = filesystem.RemoveFile("/iplant/home/iychoi/test", true) // do it forcefully
if err != nil {
    logger.Error(err)
    panic(err)
}

if !filesystem.ExistsFile("/iplant/home/iychoi/test") {
    fmt.Printf("Successfully deleted file\n")
} else {
    fmt.Printf("Could not delete file\n")
}

Downloading a file.

err = filesystem.DownloadFile("/iplant/home/iychoi/test", "", "/opt", nil) // download a file from default resource ("") to /opt local dir
if err != nil {
    logger.Error(err)
    panic(err)
}

More examples can be found in /examples directory.

License

Copyright (c) 2010-2021, The Arizona Board of Regents on behalf of The University of Arizona

All rights reserved.

Developed by: CyVerse as a collaboration between participants at BIO5 at The University of Arizona (the primary hosting institution), Cold Spring Harbor Laboratory, The University of Texas at Austin, and individual contributors. Find out more at http://www.cyverse.org/.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of CyVerse, BIO5, The University of Arizona, Cold Spring Harbor Laboratory, The University of Texas at Austin, nor the names of other contributors may be used to endorse or promote products derived from this software without specific prior written permission.

Please check LICENSE file.

go-irodsclient's People

Contributors

erykkul avatar iychoi avatar kjsanger avatar peterverraedt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-irodsclient's Issues

is fs.FileSystem thread safe?

Hello,

I am using go routines to implement concurrent file upload/download to iRODS. I wonder if the fs.FileSystem is thread safe so that I just need to create it once and shared across go routines? Thanks!

iRODS 4.3.x compatibility

go-irodsclient v0.14.1

I've noticed that permissions queries on iRODS 4.3.x return a different value than on iRODS 4.2.x e.g. read_object, rather than read object for access_types in r_tokn_main

This means that permissions checks can fail to successfully identify a permission where it is present and comparisions are done on either IRODSAccessLevelType or IRODSAccessLevelType.ChmodString() (because this falls through a switch to a default of IRODSAccessLevelType). Some permissions are unaffected e.g. own - it appears to be a general whitespace -> underscore change where whitespace appeared in the dictionary value originally.

Question: federation support?

Thanks for your work on go-irodsclient; having access to a pure Go API has made deployment of iRODS client tools ridiculously easy for us, compared to the C or Python APIs.

I'm interested in what plans there are if any, for go-irodsclient to support federation? For example, fs.SearchByMeta() currently doesn't return results for metadata in a federated zone.

CAT_STATEMENT_TABLE_FULL when listing all users

Hello,

First of all, thanks for this pure Golang implementation of the iRODS protocol. Although it seem to me that this package is still heavily under development, I am already trying to use it for a project.

I just want to report an error I run into. When I use the fs.ListUsers(*conn) function to get a list of iRODS users, I get the error CAT_STATEMENT_TABLE_FULL.

After checking the source code, the issue seems to be due to the fact that the value of continueIndex is not used in the line below (i.e. the second argument of the function message.NewIRODSMessageQueryRequest is 0 instead of continueIndex changed in the iteration):

query := message.NewIRODSMessageQueryRequest(common.MaxQueryRows, 0, 0, 0)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.