GoRODS: github.com/jjacquay712/GoRODS Index | Files | Directories

package gorods

import "github.com/jjacquay712/GoRODS"

Package gorods is a Golang binding for the iRODS C API (iRODS client library). GoRods uses cgo to call iRODS client functions.

Index

Package Files

acl.go client.go collection.go connection.go dataobj.go errors.go group.go helpers.go httphandler.go meta.go resource.go user.go zone.go

Constants

const (
    EnvironmentDefined = iota
    UserDefined
)

EnvironmentDefined and UserDefined constants are used when calling gorods.New(ConnectionOptions{ Type: ... }) When EnvironmentDefined is specified, the options stored in ~/.irods/irods_environment.json will be used. When UserDefined is specified you must also pass Host, Port, Username, and Zone. Password should be set regardless.

const (
    DataObjType = iota
    CollectionType
    ResourceType
    ResourceGroupType
    ZoneType
    UserType
    AdminType
    GroupAdminType
    GroupType
    UnknownType
    Cache
    Archive
    Null
    Read
    Write
    Own
    Inherit
    NoInherit
    Local
    Remote
    PAMAuth
    PasswordAuth
)

Used when calling Type() on different gorods objects

const (
    Info = iota
    Warn
    Fatal
)

Log level constants

func FileServer Uses

func FileServer(opts FSOptions) http.Handler

func GetShortTypeString Uses

func GetShortTypeString(typ int) string

func GetTypeString Uses

func GetTypeString(typ int) string

type ACL Uses

type ACL struct {
    AccessObject AccessObject
    AccessLevel  int
    Type         int
}

ACL is used to describe the access level that a particular AccessObject (User/Group) has on a DataObj or Collection

func (*ACL) AccessLevelString Uses

func (acl *ACL) AccessLevelString() string

AccessLevelString gets the string represenation of the AccessLevel

func (*ACL) Group Uses

func (acl *ACL) Group() *Group

Group is a shortcut to cast the AccessObject as it's underlying data structure type (*Group)

func (*ACL) String Uses

func (acl *ACL) String() string

String returns a formatted string describing the ACL struct example: g:designers#tempZone:read

func (*ACL) User Uses

func (acl *ACL) User() *User

User is a shortcut to cast the AccessObject as it's underlying data structure type (*User)

type ACLs Uses

type ACLs []*ACL

ACLs is a slice of ACL pointers

type AccessObject Uses

type AccessObject interface {
    Name() string
    Zone() *Zone
    Comment() (string, error)
    CreateTime() (time.Time, error)
    ModifyTime() (time.Time, error)
    Id() (int, error)
    Type() int
    Con() *Connection
}

AccessObject is an interface for Users and Groups, used within ACL slices to denote the access level of a DataObj or Collection

type ByteArr Uses

type ByteArr struct {
    Contents []byte
    Ptr      unsafe.Pointer
}

func (ByteArr) Free Uses

func (br ByteArr) Free()

type Client Uses

type Client struct {
    Options    *ConnectionOptions
    ConnectErr error
}

Client structs are used to store connection options, and instatiate connections with those options

func New Uses

func New(opts ConnectionOptions) (*Client, error)

New creates a test connection to an iRODS iCAT server, and returns a *Client struct if successful. EnvironmentDefined and UserDefined constants are used in ConnectionOptions{ Type: ... }). When EnvironmentDefined is specified, the options stored in ~/.irods/irods_environment.json will be used. When UserDefined is specified you must also pass Host, Port, Username, and Zone. Password should be set unless using an anonymous user account with tickets.

func (*Client) DisplayMemInfo Uses

func (cli *Client) DisplayMemInfo()

func (*Client) OpenCollection Uses

func (cli *Client) OpenCollection(opts CollectionOptions, handler func(*Collection, *Connection)) error

OpenCollection will create a new connection using the previously configured iRODS client. It will execute the handler, and close *Collection and *Collection automatically when your handler finishes execution. Operations on a single connection are queued when shared between goroutines (iRODS C API doesn't support concurrent operations on a single connection), so be sure to open up new connections for long-running operations to prevent blocking between goroutines.

func (*Client) OpenConnection Uses

func (cli *Client) OpenConnection(handler func(*Connection)) error

OpenConnection will create a new connection using the previously configured iRODS client. It will execute the handler, and close *Collection automatically when your handler finishes execution. Operations on a single connection are queued when shared between goroutines (iRODS C API doesn't support concurrent operations on a single connection), so be sure to open up new connections for long-running operations to prevent blocking between goroutines.

func (*Client) OpenDataObject Uses

func (cli *Client) OpenDataObject(path string, handler func(*DataObj, *Connection)) error

OpenDataObject will create a new connection using the previously configured iRODS client. It will execute the handler, and close *DataObj and *Collection automatically when your handler finishes execution. Operations on a single connection are queued when shared between goroutines (iRODS C API doesn't support concurrent operations on a single connection), so be sure to open up new connections for long-running operations to prevent blocking between goroutines.

type Collection Uses

type Collection struct {
    // contains filtered or unexported fields
}

Collection structs contain information about single collections in an iRODS zone.

func CreateCollection Uses

func CreateCollection(name string, coll *Collection) (*Collection, error)

CreateCollection creates a collection in the specified collection using provided options. Returns the newly created collection object.

func (*Collection) ACL Uses

func (col *Collection) ACL() (ACLs, error)

ACL returns a slice of ACL structs. Example of slice in string format: [rods#tempZone:own developers#tempZone:modify object designers#tempZone:read object]

func (*Collection) AddMeta Uses

func (col *Collection) AddMeta(m Meta) (newMeta *Meta, err error)

AddMeta adds a single Meta triple struct

func (*Collection) All Uses

func (col *Collection) All() (IRodsObjs, error)

All returns generic interface slice containing both data objects and collections combined

func (*Collection) Attribute Uses

func (col *Collection) Attribute(attr string) (Metas, error)

Attribute gets slice of Meta AVU triples, matching by Attribute name for Collection

func (*Collection) Backup Uses

func (col *Collection) Backup(targetResource interface{}, opts DataObjOptions) error

Backup is similar to Replicate. In backup mode, if a good copy already exists in this resource group or resource, don't make another one.

func (*Collection) Cd Uses

func (col *Collection) Cd(path string) *Collection

Cd is a shortcut for calling collection.GetCollections().Find(path). It effectively returns (or changes to) the sub collection you specify collection-relatively or absolutely.

func (*Collection) Chmod Uses

func (col *Collection) Chmod(userOrGroup string, accessLevel int, recursive bool) error

Chmod changes the permissions/ACL of the collection accessLevel: Null | Read | Write | Own

func (*Collection) Close Uses

func (col *Collection) Close() error

Close closes the Collection connection and resets the handle

func (*Collection) Col Uses

func (col *Collection) Col() *Collection

Col returns the *Collection of the collection

func (*Collection) Collections Uses

func (col *Collection) Collections() (response IRodsObjs, err error)

Collections returns only the IRodsObjs that represent collections

func (*Collection) Con Uses

func (col *Collection) Con() *Connection

Connection returns the *Connection used to get collection

func (*Collection) CopyTo Uses

func (col *Collection) CopyTo(iRODSCollection interface{}) error

CopyTo copies all collections and data objects contained withing the collection to the specified collection. Accepts string or *Collection types.

func (*Collection) CreateDataObj Uses

func (col *Collection) CreateDataObj(opts DataObjOptions) (*DataObj, error)

CreateDataObj creates a data object within the collection using the options specified

func (*Collection) CreateSubCollection Uses

func (col *Collection) CreateSubCollection(name string) (*Collection, error)

CreateSubCollection creates a collection within the collection using the options specified

func (*Collection) CreateTime Uses

func (col *Collection) CreateTime() time.Time

CreateTime returns the create time of the collection

func (*Collection) DataObjs Uses

func (col *Collection) DataObjs() (response IRodsObjs, err error)

DataObjs returns only the data objects contained within the collection

func (*Collection) Delete Uses

func (col *Collection) Delete(recursive bool) error

Delete is equivalent to irm -f {-r}

func (*Collection) DeleteMeta Uses

func (col *Collection) DeleteMeta(attr string) (*MetaCollection, error)

DeleteMeta deletes a single Meta triple struct, identified by Attribute field

func (*Collection) Destroy Uses

func (col *Collection) Destroy() error

Destroy is equivalent to irm -rf

func (*Collection) DownloadTo Uses

func (col *Collection) DownloadTo(localPath string) error

DownloadTo recursively downloads all data objects and collections contained within the collection, into the path specified

func (*Collection) Each Uses

func (col *Collection) Each(ittr func(obj IRodsObj) error) error

EachDataObj is an iterator for data objects

func (*Collection) EachCollection Uses

func (col *Collection) EachCollection(ittr func(obj *Collection)) error

EachCollection is an iterator for collections

func (*Collection) EachDataObj Uses

func (col *Collection) EachDataObj(ittr func(obj *DataObj)) error

EachDataObj is an iterator for data objects

func (*Collection) Exists Uses

func (col *Collection) Exists(path string) bool

Exists returns true of false depending on whether the DataObj or Collection is found

func (*Collection) Find Uses

func (col *Collection) Find(path string) IRodsObj

Find returns either a DataObject or Collection using the collection-relative or absolute path specified.

func (*Collection) FindCol Uses

func (col *Collection) FindCol(path string) *Collection

FindCol returns a sub collection in the *Collection, matching based on the absolute path or name

func (*Collection) FindObj Uses

func (col *Collection) FindObj(path string) *DataObj

FindObj returns a data object contained in the *Collection, matching based on the absolute path or name. Equivalent to *Collection.Get.

func (*Collection) FindRecursive Uses

func (col *Collection) FindRecursive(path string) IRodsObj

Find returns either a DataObject or Collection using the collection-relative or absolute path specified.

func (*Collection) Get Uses

func (col *Collection) Get(path string) *DataObj

Get is a shortcut for calling collection.DataObjs().Find(path). It effectively returns the DataObj you specify collection-relatively or absolutely.

func (*Collection) GrantAccess Uses

func (col *Collection) GrantAccess(userOrGroup AccessObject, accessLevel int, recursive bool) error

GrantAccess will add permissions (ACL) to the collection

func (*Collection) Inheritance Uses

func (col *Collection) Inheritance() (bool, error)

Inheritance returns true or false, depending on the collection's inheritance setting

func (*Collection) IsDir Uses

func (col *Collection) IsDir() bool

func (*Collection) IsRecursive Uses

func (col *Collection) IsRecursive() bool

IsRecursive returns true or false

func (*Collection) Length Uses

func (col *Collection) Length() int

Length returns the total number of data objects and collections contained within the collection, recursively

func (*Collection) Meta Uses

func (col *Collection) Meta() (*MetaCollection, error)

Meta returns collection of all metadata AVU triples for Collection

func (*Collection) ModTime Uses

func (col *Collection) ModTime() time.Time

func (*Collection) Mode Uses

func (col *Collection) Mode() os.FileMode

func (*Collection) ModifyTime Uses

func (col *Collection) ModifyTime() time.Time

ModifyTime returns the modify time of the collection

func (*Collection) MoveTo Uses

func (col *Collection) MoveTo(iRODSCollection interface{}) error

MoveTo moves the collection to the specified collection. Supports Collection struct or string as input. Also refreshes the source and destination collections automatically to maintain correct state. Returns error.

func (*Collection) MoveToResource Uses

func (col *Collection) MoveToResource(targetResource interface{}) error

MoveToResource recursively moves all data objects contained within the collection to the specified resource. Accepts string or *Resource type.

func (*Collection) Name Uses

func (col *Collection) Name() string

Name returns the Name of the collection

func (*Collection) Open Uses

func (col *Collection) Open() error

Open connects to iRODS and sets the handle for Collection. Usually called by Collection.init()

func (*Collection) Owner Uses

func (col *Collection) Owner() *User

Owner returns a User struct, representing the user who owns the collection

func (*Collection) OwnerName Uses

func (col *Collection) OwnerName() string

OwnerName returns the owner name of the collection

func (*Collection) Path Uses

func (col *Collection) Path() string

Path returns the Path of the collection

func (*Collection) Put Uses

func (col *Collection) Put(localPath string, opts DataObjOptions) (*DataObj, error)

Put reads the entire file from localPath and adds it the collection, using the options specified.

func (*Collection) ReadCollection Uses

func (col *Collection) ReadCollection() error

ReadCollection reads data (overwrites) into col.dataObjects field.

func (*Collection) ReadCollectionOpts Uses

func (col *Collection) ReadCollectionOpts(opts CollectionReadOpts) (CollectionReadInfo, error)

func (*Collection) ReadInfo Uses

func (col *Collection) ReadInfo() *CollectionReadInfo

func (*Collection) Refresh Uses

func (col *Collection) Refresh() error

Refresh is an alias of ReadCollection()

func (*Collection) Rename Uses

func (col *Collection) Rename(newFileName string) error

Rename is equivalent to the Linux mv command except that the collection must stay within it's current collection (directory), returns error.

func (*Collection) Replicate Uses

func (col *Collection) Replicate(targetResource interface{}, opts DataObjOptions) error

Replicate recursively copies all data objects contained within the collection to the specified resource. Accepts string or *Resource type for targetResource parameter.

func (*Collection) Rm Uses

func (col *Collection) Rm(recursive bool, force bool) error

Rm is equivalent to irm {-r} {-f}

func (*Collection) RmTrash Uses

func (col *Collection) RmTrash() error

RmTrash is used (sometimes internally) by GoRODS to delete items in the trash permanently. The collection's path should be in the trash collection.

func (*Collection) SetInheritance Uses

func (col *Collection) SetInheritance(inherits bool, recursive bool) error

SetInheritance sets the inheritance option of the collection. If true, sub-collections and data objects inherit the permissions (ACL) of this collection.

func (*Collection) Size Uses

func (col *Collection) Size() int64

Size returns the total size in bytes of all contained data objects and collections, recursively

func (*Collection) Stat Uses

func (col *Collection) Stat() (map[string]interface{}, error)

Stat returns a map (key/value pairs) of the system meta information. The following keys can be used with the map:

"objSize"

"dataMode"

"dataId"

"chksum"

"ownerName"

"ownerZone"

"createTime"

"modifyTime"

func (*Collection) String Uses

func (obj *Collection) String() string

String shows the contents of the collection.

d = DataObj

C = Collection

Sample output:

Collection: /tempZone/home/admin/gorods
	d: build.sh
	C: bin
	C: pkg
	C: src

func (*Collection) Sys Uses

func (col *Collection) Sys() interface{}

func (*Collection) Trash Uses

func (col *Collection) Trash(recursive bool) error

Trash is equivalent to irm {-r}

func (*Collection) TrimRepls Uses

func (col *Collection) TrimRepls(opts TrimOptions) error

TrimRepls recursively trims data object replicas (removes from resource servers), using the rules defined in opts.

func (*Collection) Type Uses

func (col *Collection) Type() int

Type gets the type

func (*Collection) Walk Uses

func (col *Collection) Walk(callback func(IRodsObj) error) error

type CollectionOptions Uses

type CollectionOptions struct {
    Path      string
    Recursive bool
    GetRepls  bool
    SkipCache bool
}

CollectionOptions stores options relating to collection initialization. Path is the full path of the collection you're requesting. Recursive if set to true will load sub collections into memory, until the end of the collection "tree" is found.

type CollectionReadInfo Uses

type CollectionReadInfo struct {
    ColResultTotal int
    ObjResultTotal int
    ResultTotal    int

    ColTotal int
    ObjTotal int
    Total    int
}

type CollectionReadOpts Uses

type CollectionReadOpts struct {
    Limit  int
    Offset int
    Filter func(obj IRodsObj) bool
}

type Connection Uses

type Connection struct {
    PAMToken   string
    Connected  bool
    Init       bool
    Options    *ConnectionOptions
    OpenedObjs IRodsObjs
    // contains filtered or unexported fields
}

Connection structs hold information about the iRODS iCAT server, and the user who's connecting. It also contains a cache of opened Collections and DataObjs

func NewConnection Uses

func NewConnection(opts *ConnectionOptions) (*Connection, error)

NewConnection creates a connection to an iRODS iCAT server. EnvironmentDefined and UserDefined constants are used in ConnectionOptions{ Type: ... }). When EnvironmentDefined is specified, the options stored in ~/.irods/irods_environment.json will be used. When UserDefined is specified you must also pass Host, Port, Username, and Zone. Password should be set unless using an anonymous user account with tickets.

func (*Connection) Collection Uses

func (con *Connection) Collection(opts CollectionOptions) (*Collection, error)

Collection initializes and returns an existing iRODS collection using the specified path

func (*Connection) CollectionOpts Uses

func (con *Connection) CollectionOpts(opts CollectionOptions, readOpts CollectionReadOpts) (*Collection, error)

CollectionOpts initializes and returns an existing iRODS collection using the specified path

func (*Connection) CreateGroup Uses

func (con *Connection) CreateGroup(name string) (*Group, error)

CreateGroup creates a group within the local zone. You must have the proper groupadmin or rodsadmin privileges to use this function.

func (*Connection) CreateUser Uses

func (con *Connection) CreateUser(name string, typ int) (*User, error)

CreateUser creates an iRODS user within the local zone. You must have the proper rodsadmin privileges to use this function.

func (*Connection) DataObject Uses

func (con *Connection) DataObject(dataObjPath string) (dataobj *DataObj, err error)

DataObject directly returns a specific DataObj without the need to traverse collections. Must pass full path of data object.

func (*Connection) Disconnect Uses

func (con *Connection) Disconnect() error

Disconnect closes connection to iRODS iCAT server, returns error on failure or nil on success

func (*Connection) EmptyTrash Uses

func (con *Connection) EmptyTrash() error

EmptyTrash

func (*Connection) FetchGroups Uses

func (con *Connection) FetchGroups() (Groups, error)

FetchGroups returns a slice of *Group, fresh from the iCAT server.

func (*Connection) FetchResources Uses

func (con *Connection) FetchResources() (Resources, error)

FetchResources returns a slice of *Resource, fresh from the iCAT server.

func (*Connection) FetchUsers Uses

func (con *Connection) FetchUsers() (Users, error)

FetchUsers returns a slice of *User, fresh from the iCAT server.

func (*Connection) FetchZones Uses

func (con *Connection) FetchZones() (Zones, error)

FetchZones returns a slice of *Zone, fresh from the iCAT server.

func (*Connection) GetCcon Uses

func (con *Connection) GetCcon() *C.rcComm_t

GetCcon checks out the connection handle for use in all iRODS operations. Basically a mutex for connections. Other goroutines calling this function will block until the handle is returned with con.ReturnCcon, by the goroutine using it. This prevents errors in the net code since concurrent API calls aren't supported over a single iRODS connection.

func (*Connection) Groups Uses

func (con *Connection) Groups() (Groups, error)

Groups returns a slice of all *Group in the iCAT. You must have the proper groupadmin or rodsadmin privileges to use this function.

func (*Connection) IQuest Uses

func (con *Connection) IQuest(query string, upperCase bool) ([]map[string]string, error)

IQuest accepts a SQL query fragment, returns results in slice of maps If upperCase is true, all records will be matched using their uppercase representation.

func (*Connection) IQuestSQL Uses

func (con *Connection) IQuestSQL(specificQuery string, queryArgs ...string) ([][]string, error)

IQuestSQL executes a specific query on the iCAT server and returns a multi-dimensional string slice of results. Equivalent to: "iquest --sql {specificQuery} {queryArgs}..."

func (*Connection) InitCon Uses

func (con *Connection) InitCon() error

func (*Connection) LocalZone Uses

func (con *Connection) LocalZone() (*Zone, error)

LocalZone returns the *Zone. First it checks the ConnectionOptions.Zone and uses that, otherwise it pulls it fresh from the iCAT server.

func (*Connection) PathType Uses

func (con *Connection) PathType(p string) (int, error)

PathType returns DataObjType, CollectionType, or -1 (error) for the iRODS path specified

func (*Connection) QueryMeta Uses

func (con *Connection) QueryMeta(qString string) (response IRodsObjs, err error)

QueryMeta queries both data objects and collections for matching metadata. Returns IRodsObjs.

func (*Connection) RefreshGroups Uses

func (con *Connection) RefreshGroups() error

RefreshGroups updates the slice returned by con.Groups() with fresh data from the iCAT server.

func (*Connection) RefreshResources Uses

func (con *Connection) RefreshResources() error

RefreshResources updates the slice returned by con.Resources() with fresh data from the iCAT server.

func (*Connection) RefreshUsers Uses

func (con *Connection) RefreshUsers() error

RefreshUsers updates the slice returned by con.Users() with fresh data from the iCAT server.

func (*Connection) RefreshZones Uses

func (con *Connection) RefreshZones() error

RefreshZones updates the slice returned by con.Zones() with fresh data from the iCAT server.

func (*Connection) RegPhysObj Uses

func (con *Connection) RegPhysObj(opts RegOptions) error

RegPhysObj is equivalent to the ireg icommand

func (*Connection) Resources Uses

func (con *Connection) Resources() (Resources, error)

Resources returns a slice of all *Resource in the iCAT. You must have the proper rodsadmin privileges to use this function.

func (*Connection) ReturnCcon Uses

func (con *Connection) ReturnCcon(ccon *C.rcComm_t)

ReturnCcon returns the connection handle for use in other threads. Unlocks the mutex.

func (*Connection) SetThreads Uses

func (con *Connection) SetThreads(num int)

SetThreads changes the ccon.transStat.numThreads value. Not sure if it does anything.

func (*Connection) SetTicket Uses

func (con *Connection) SetTicket(t string) error

SetTicket is equivalent to using the -t flag with icommands

func (*Connection) String Uses

func (obj *Connection) String() string

String provides connection status and options provided during initialization (gorods.New)

func (*Connection) Threads Uses

func (con *Connection) Threads() int

Threads returns ccon.transStat.numThreads

func (*Connection) UserInfo Uses

func (con *Connection) UserInfo() (map[string]string, error)

func (*Connection) Users Uses

func (con *Connection) Users() (Users, error)

Users returns a slice of all *User in the iCAT. You must have the proper rodsadmin privileges to use this function.

func (*Connection) Zones Uses

func (con *Connection) Zones() (Zones, error)

Zones returns a slice of all *Zone in the iCAT. You must have the proper rodsadmin privileges to use this function.

type ConnectionOptions Uses

type ConnectionOptions struct {
    Type          int
    AuthType      int
    PAMPassFile   string
    PAMToken      string
    PAMPassExpire int
    Host          string
    Port          int
    Zone          string
    Username      string
    Password      string
    Ticket        string
    FastInit      bool
    Threads       int
}

ConnectionOptions are used when creating iRODS iCAT server connections see gorods.New() docs for more info.

func (*ConnectionOptions) String Uses

func (conOpts *ConnectionOptions) String() string

type DataObj Uses

type DataObj struct {
    // contains filtered or unexported fields
}

DataObj structs contain information about single data objects in an iRODS zone.

func CreateDataObj Uses

func CreateDataObj(opts DataObjOptions, coll *Collection) (*DataObj, error)

CreateDataObj creates and adds a data object to the specified collection using provided options. Returns the newly created data object.

func (*DataObj) ACL Uses

func (obj *DataObj) ACL() (ACLs, error)

ACL retuns a slice of ACL structs. Example of slice in string format: [rods#tempZone:own developers#tempZone:modify object designers#tempZone:read object]

func (*DataObj) AddMeta Uses

func (obj *DataObj) AddMeta(m Meta) (nm *Meta, err error)

AddMeta adds a single Meta triple struct

func (*DataObj) Attribute Uses

func (obj *DataObj) Attribute(attrName string) (Metas, error)

Attribute gets slice of Meta AVU triples, matching by Attribute name for DataObj

func (*DataObj) Backup Uses

func (obj *DataObj) Backup(targetResource interface{}, opts DataObjOptions) error

Backup is similar to Replicate. In backup mode, if a good copy already exists in this resource group or resource, don't make another one.

func (*DataObj) Checksum Uses

func (obj *DataObj) Checksum() string

Checksum returns the hash of the data object data

func (*DataObj) Chksum Uses

func (obj *DataObj) Chksum() (string, error)

Chksum returns md5 hash string of data object

func (*DataObj) Chmod Uses

func (obj *DataObj) Chmod(userOrGroup string, accessLevel int, recursive bool) error

Chmod changes the permissions/ACL of a data object. accessLevel: Null | Read | Write | Own

func (*DataObj) Close Uses

func (obj *DataObj) Close() error

Close closes the data object, resets handler

func (*DataObj) Col Uses

func (obj *DataObj) Col() *Collection

GetName returns the *Collection of the data object

func (*DataObj) Con Uses

func (obj *DataObj) Con() *Connection

Connection returns the *Connection used to get data object

func (*DataObj) CopyTo Uses

func (obj *DataObj) CopyTo(iRODSCollection interface{}) error

CopyTo copies the data object to the specified collection. Supports Collection struct or string as input. Also refreshes the destination collection automatically to maintain correct state. Returns error.

func (*DataObj) CopyToOpts Uses

func (obj *DataObj) CopyToOpts(iRODSCollection interface{}, opts DataObjOptions) error

CopyTo copies the data object to the specified collection. Supports Collection struct or string as input. Also refreshes the destination collection automatically to maintain correct state. Returns error.

func (*DataObj) CreateTime Uses

func (obj *DataObj) CreateTime() time.Time

CreateTime returns the create time of the data object

func (*DataObj) DataId Uses

func (obj *DataObj) DataId() string

func (*DataObj) Delete Uses

func (obj *DataObj) Delete(recursive bool) error

Delete is equivalent to irm -f {-r}

func (*DataObj) DeleteMeta Uses

func (obj *DataObj) DeleteMeta(attr string) (*MetaCollection, error)

DeleteMeta deletes a single Meta triple struct, identified by Attribute field

func (*DataObj) Destroy Uses

func (obj *DataObj) Destroy() error

Destroy is equivalent to irm -rf

func (*DataObj) DownloadTo Uses

func (obj *DataObj) DownloadTo(localPath string) error

DownloadTo downloads and writes the entire data object to the provided path. Don't use this with large files unless you have RAM to spare, use ReadChunk() instead. Returns error.

func (*DataObj) FastRead Uses

func (obj *DataObj) FastRead(pos int64, length int, callback func([]byte) error) error

FastRead is similar to ReadBytes, except it doesn't copy bytes into a new byte slice, making the process more efficient. It uses the existing C byte array and casts it as a go []byte. Once your call back is run, the allocated memory is freed automatically. This function will block until bytes are received and your callback has been run.

func (*DataObj) FastReadFree Uses

func (obj *DataObj) FastReadFree(pos int64, length int) (*ByteArr, error)

FastReadFree is similar to ReadBytes, except it doesn't copy bytes into a new byte slice, making the process more efficient. It uses the existing C byte array and casts it as a go []byte. You must explicitally call ByteArr.Free on the returned struct or there will be a memory leak.

func (*DataObj) GrantAccess Uses

func (obj *DataObj) GrantAccess(userOrGroup AccessObject, accessLevel int, recursive bool) error

GrantAccess will add permissions (ACL) to the data object.

func (*DataObj) Handle Uses

func (obj *DataObj) Handle() int

Handle returns the internal handle index

func (*DataObj) IsDir Uses

func (obj *DataObj) IsDir() bool

func (*DataObj) LSeek Uses

func (obj *DataObj) LSeek(offset int64) error

LSeek sets the read/write offset pointer of a data object, returns error

func (*DataObj) Meta Uses

func (obj *DataObj) Meta() (*MetaCollection, error)

Meta returns collection of Meta AVU triple structs of the data object

func (*DataObj) ModTime Uses

func (obj *DataObj) ModTime() time.Time

func (*DataObj) Mode Uses

func (obj *DataObj) Mode() os.FileMode

func (*DataObj) ModifyTime Uses

func (obj *DataObj) ModifyTime() time.Time

ModifyTime returns the modify time of the data object

func (*DataObj) MoveTo Uses

func (obj *DataObj) MoveTo(iRODSCollection interface{}) error

MoveTo moves the data object to the specified collection. Supports Collection struct or string as input. Also refreshes the source and destination collections automatically to maintain correct state. Returns error.

func (*DataObj) MoveToResource Uses

func (obj *DataObj) MoveToResource(targetResource interface{}) error

MoveToResource moves data object to the specified resource. Accepts string or *Resource type.

func (*DataObj) Name Uses

func (obj *DataObj) Name() string

GetName returns the Name of the data object

func (*DataObj) Offset Uses

func (obj *DataObj) Offset() int64

Offset returns the offset bytes for the pointer of the data object. LSeek will change this value.

func (*DataObj) Open Uses

func (obj *DataObj) Open() error

Open opens a connection to iRODS and sets the data object handle

func (*DataObj) OpenRW Uses

func (obj *DataObj) OpenRW() error

OpenRW opens a connection to iRODS and sets the data object handle for read/write access

func (*DataObj) Owner Uses

func (obj *DataObj) Owner() *User

GetOwnerName returns the owner name of the data object

func (*DataObj) OwnerName Uses

func (obj *DataObj) OwnerName() string

GetOwnerName returns the owner name of the data object

func (*DataObj) Path Uses

func (obj *DataObj) Path() string

GetName returns the Path of the data object

func (*DataObj) PhyPath Uses

func (obj *DataObj) PhyPath() string

PhyPath is the actual location where the data object is stored on the iRODS server.

func (*DataObj) Read Uses

func (obj *DataObj) Read() ([]byte, error)

Read reads the entire data object into memory and returns a []byte slice. Don't use this for large files.

func (*DataObj) ReadBytes Uses

func (obj *DataObj) ReadBytes(pos int64, length int) ([]byte, error)

ReadBytes reads bytes from a data object at the specified position and length, returns []byte slice and error.

func (*DataObj) ReadChunk Uses

func (obj *DataObj) ReadChunk(size int64, callback func([]byte)) error

ReadChunk reads the entire data object in chunks (size of chunk specified by size parameter), passing the data into a callback function for each chunk. Use this to read/write large files.

func (*DataObj) ReadChunkFree Uses

func (obj *DataObj) ReadChunkFree(size int64, callback func(*ByteArr)) error

ReadChunkFree is similar to ReadChunk, except it doesn't copy bytes into a new byte slice, making the process more efficient. It uses the existing C byte array and casts it as a go []byte. You must explicitally call ByteArr.Free on the returned struct or there will be a memory leak.

func (*DataObj) Reader Uses

func (obj *DataObj) Reader() *Reader

Reader returns *gorods.Reader whuch implements io.Reader interface

func (*DataObj) Rename Uses

func (obj *DataObj) Rename(newFileName string) error

Rename is equivalent to the Linux mv command except that the data object must stay within the current collection (directory), returns error.

func (*DataObj) ReplNum Uses

func (obj *DataObj) ReplNum() int

ReplNum returns the replica index of the data object

func (*DataObj) ReplStatus Uses

func (obj *DataObj) ReplStatus() int

func (*DataObj) Replicate Uses

func (obj *DataObj) Replicate(targetResource interface{}, opts DataObjOptions) error

Replicate copies the data object to the specified resource. Accepts string or *Resource type for targetResource parameter.

func (*DataObj) RescHier Uses

func (obj *DataObj) RescHier() string

func (*DataObj) Resource Uses

func (obj *DataObj) Resource() *Resource

Resource returns the *Resource where the data object is stored

func (*DataObj) Rm Uses

func (obj *DataObj) Rm(recursive bool, force bool) error

Rm is equivalent to irm {-r} {-f}

func (*DataObj) RmTrash Uses

func (obj *DataObj) RmTrash() error

RmTrash is used (sometimes internally) by GoRODS to delete items in the trash permanently. The data object's path should be in the trash collection.

func (*DataObj) Size Uses

func (obj *DataObj) Size() int64

Size returns the size in bytes of the data object

func (*DataObj) Stat Uses

func (obj *DataObj) Stat() (map[string]interface{}, error)

Stat returns a map (key/value pairs) of the system meta information. The following keys can be used with the map:

"objSize"

"dataMode"

"dataId"

"chksum"

"ownerName"

"ownerZone"

"createTime"

"modifyTime"

func (*DataObj) String Uses

func (obj *DataObj) String() string

String returns path of data object

func (*DataObj) Sys Uses

func (obj *DataObj) Sys() interface{}

func (*DataObj) Trash Uses

func (obj *DataObj) Trash(recursive bool) error

Trash is equivalent to irm {-r}

func (*DataObj) TrimRepls Uses

func (obj *DataObj) TrimRepls(opts TrimOptions) error

TrimRepls trims data object replicas (removes from resource servers), using the rules defined in opts.

func (*DataObj) Type Uses

func (obj *DataObj) Type() int

Type gets the type (DataObjType), used in interfaces

func (obj *DataObj) Unlink() error

Unlink deletes the data object from the iRODS server, no force flag is used

func (*DataObj) Verify Uses

func (obj *DataObj) Verify(md5Checksum string) bool

Verify returns true or false depending on whether the checksum md5 string matches

func (*DataObj) Write Uses

func (obj *DataObj) Write(data []byte) error

Write writes the data to the data object, starting from the beginning. Returns error.

func (*DataObj) WriteBytes Uses

func (obj *DataObj) WriteBytes(data []byte) error

WriteBytes writes to the data object wherever the object's offset pointer is currently set to. It advances the pointer to the end of the written data for supporting subsequent writes. Be sure to call obj.LSeek(0) before hand if you wish to write from the beginning. Returns error.

func (*DataObj) Writer Uses

func (obj *DataObj) Writer() *Writer

Writer returns *gorods.Writer whuch implements io.Writer interface

type DataObjOptions Uses

type DataObjOptions struct {
    Name     string
    Size     int64
    Mode     int
    Force    bool
    Resource interface{}
}

DataObjOptions is used for passing options to the CreateDataObj and DataObj.Copy function

type FSOptions Uses

type FSOptions struct {
    Client         *Client
    Connection     *Connection
    Path           string
    Download       bool
    StripPrefix    string
    CollectionView string
}

type GoRodsError Uses

type GoRodsError struct {
    LogLevel  int
    Message   string
    IRODSCode string
    Time      time.Time
}

GoRodsError stores information about errors

func (*GoRodsError) Error Uses

func (err *GoRodsError) Error() string

Error returns error string, alias of String(). Sample output:

2016-04-22 10:02:30.802355258 -0400 EDT: Fatal - iRODS Connect Failed: rcConnect failed

func (*GoRodsError) String Uses

func (err *GoRodsError) String() string

String returns error string. Sample output:

2016-04-22 10:02:30.802355258 -0400 EDT: Fatal - iRODS Connect Failed: rcConnect failed

type Group Uses

type Group struct {
    // contains filtered or unexported fields
}

Group holds info about iRODS groups

func (*Group) AddMeta Uses

func (grp *Group) AddMeta(m Meta) (nm *Meta, err error)

AddMeta adds a single Meta triple struct

func (*Group) AddUser Uses

func (grp *Group) AddUser(usr interface{}) error

AddUser adds an iRODS uset to the group. Accepts a string or *User struct.

func (*Group) Attribute Uses

func (grp *Group) Attribute(attrName string) (Metas, error)

Attribute gets slice of Meta AVU triples, matching by Attribute name for Group

func (*Group) Comment Uses

func (grp *Group) Comment() (string, error)

Comment loads data from iRODS if needed, and returns the group's comment attribute.

func (*Group) Con Uses

func (grp *Group) Con() *Connection

Con returns the *Connection used to fetch group info

func (*Group) CreateTime Uses

func (grp *Group) CreateTime() (time.Time, error)

CreateTime loads data from iRODS if needed, and returns the group's createTime attribute.

func (*Group) Delete Uses

func (grp *Group) Delete() error

Delete deletes the group from iCAT server. Refreshes Connection group cache.

func (*Group) DeleteMeta Uses

func (grp *Group) DeleteMeta(attr string) (*MetaCollection, error)

DeleteMeta deletes a single Meta triple struct, identified by Attribute field

func (*Group) FetchInfo Uses

func (grp *Group) FetchInfo() (map[string]string, error)

FetchInfo returns a map of fresh group info from the iCAT server

func (*Group) FetchUsers Uses

func (grp *Group) FetchUsers() (Users, error)

FetchUsers returns a slice of fresh *User from the iCAT server

func (*Group) Id Uses

func (grp *Group) Id() (int, error)

Id loads data from iRODS if needed, and returns the group's Id attribute.

func (*Group) Info Uses

func (grp *Group) Info() (string, error)

Info loads data from iRODS if needed, and returns the group's Info attribute.

func (*Group) Meta Uses

func (grp *Group) Meta() (*MetaCollection, error)

Meta returns collection of Meta AVU triple structs of the group object

func (*Group) ModifyTime Uses

func (grp *Group) ModifyTime() (time.Time, error)

ModifyTime loads data from iRODS if needed, and returns the group's modifyTime attribute.

func (*Group) Name Uses

func (grp *Group) Name() string

Name returns the name of the group.

func (*Group) Path Uses

func (grp *Group) Path() string

Path returns the name of the group. Used in gorods.MetaObj interface.

func (*Group) RefreshInfo Uses

func (grp *Group) RefreshInfo() error

RefreshInfo refreshes the attributes of the group, pulling fresh data from the iCAT server.

func (*Group) RefreshUsers Uses

func (grp *Group) RefreshUsers() error

RefreshUsers pulls fresh data from the iCAT server and sets the internal field returned by *Group.Users

func (*Group) Remove Uses

func (grp *Group) Remove() bool

Remove deletes the group from the parent slice

func (*Group) RemoveUser Uses

func (grp *Group) RemoveUser(usr interface{}) error

RemoveUser removes an iRODS user from the group. Accepts a string or *User struct.

func (*Group) String Uses

func (grp *Group) String() string

String returns the group name

func (*Group) Type Uses

func (grp *Group) Type() int

Type returns GroupType, used in AccessObject and MetaObj interfaces

func (*Group) Users Uses

func (grp *Group) Users() (Users, error)

Users loads data from iRODS if needed, and returns the group's Users slice.

func (*Group) Zone Uses

func (grp *Group) Zone() *Zone

Zone returns the *Zone struct that this group belongs to.

type Groups Uses

type Groups []*Group

Groups is a slice of *Group structs.

func (Groups) FindByName Uses

func (grps Groups) FindByName(name string, con *Connection) *Group

FindByName searches the slice (itself) and attempts to return a match based on name. If no match is found, a new group with that name is created and returned. This was designed to resolve issues of casting resources for DataObjects and Collections, even though the cache was empty due to permissions.

func (*Groups) Remove Uses

func (grps *Groups) Remove(index int)

type HandlerFactory Uses

type HandlerFactory struct {
    // contains filtered or unexported fields
}

func (*HandlerFactory) ServeHTTP Uses

func (hf *HandlerFactory) ServeHTTP(response http.ResponseWriter, request *http.Request)

type HttpHandler Uses

type HttpHandler struct {
    // contains filtered or unexported fields
}

func (*HttpHandler) AddACL Uses

func (handler *HttpHandler) AddACL(obj IRodsObj)

func (*HttpHandler) AddMetaAVU Uses

func (handler *HttpHandler) AddMetaAVU(obj IRodsObj)

func (*HttpHandler) CreateCollection Uses

func (handler *HttpHandler) CreateCollection(col *Collection)

func (*HttpHandler) DeleteMetaAVU Uses

func (handler *HttpHandler) DeleteMetaAVU(obj IRodsObj)

func (*HttpHandler) DeleteObj Uses

func (handler *HttpHandler) DeleteObj(obj IRodsObj)

func (*HttpHandler) Serve404 Uses

func (handler *HttpHandler) Serve404()

func (*HttpHandler) ServeCollectionView Uses

func (handler *HttpHandler) ServeCollectionView(col *Collection)

func (*HttpHandler) ServeDataObj Uses

func (handler *HttpHandler) ServeDataObj(obj *DataObj)

func (*HttpHandler) ServeHTTP Uses

func (handler *HttpHandler) ServeHTTP(response http.ResponseWriter, request *http.Request)

func (*HttpHandler) ServeJSONMeta Uses

func (handler *HttpHandler) ServeJSONMeta(obj IRodsObj)

func (*HttpHandler) Upload Uses

func (handler *HttpHandler) Upload(col *Collection)

type IRodsObj Uses

type IRodsObj interface {
    Type() int
    Name() string
    Path() string
    Col() *Collection
    Con() *Connection
    ACL() (ACLs, error)
    Stat() (map[string]interface{}, error)

    Size() int64
    Mode() os.FileMode
    ModTime() time.Time
    IsDir() bool
    Sys() interface{}

    Owner() *User
    OwnerName() string
    CreateTime() time.Time
    ModifyTime() time.Time

    Rename(string) error

    CopyTo(interface{}) error
    MoveTo(interface{}) error
    DownloadTo(string) error

    // irm -rf
    Destroy() error

    // irm -f {-r}
    Delete(bool) error

    // irm {-r}
    Trash(bool) error

    // irm {-r} {-f}
    Rm(bool, bool) error

    RmTrash() error

    Chmod(string, int, bool) error
    GrantAccess(AccessObject, int, bool) error

    Replicate(interface{}, DataObjOptions) error
    Backup(interface{}, DataObjOptions) error
    MoveToResource(interface{}) error
    TrimRepls(TrimOptions) error

    Meta() (*MetaCollection, error)
    Attribute(string) (Metas, error)
    AddMeta(Meta) (*Meta, error)
    DeleteMeta(string) (*MetaCollection, error)

    String() string
    Open() error
    Close() error
}

IRodsObj is a generic interface used to detect the object type and access common fields

type IRodsObjs Uses

type IRodsObjs []IRodsObj

IRodsObjs is a slice of IRodsObj (Either a *DataObj or *Collection).

func (IRodsObjs) Each Uses

func (objs IRodsObjs) Each(iterator func(IRodsObj)) error

Each provides an iterator for IRodsObjs slice

func (IRodsObjs) Exists Uses

func (objs IRodsObjs) Exists(path string) bool

Exists checks to see if a collection exists in the slice and returns true or false

func (IRodsObjs) Find Uses

func (objs IRodsObjs) Find(path string) IRodsObj

Find gets a collection from the slice and returns nil if one is not found. Both the collection name or full path can be used as input.

func (IRodsObjs) FindRecursive Uses

func (objs IRodsObjs) FindRecursive(path string) IRodsObj

FindRecursive acts just like Find, but also searches sub collections recursively. If the collection was not explicitly loaded recursively, only the first level of sub collections will be searched.

type JSONArr Uses

type JSONArr []JSONMap

type JSONMap Uses

type JSONMap map[string]string

type Meta Uses

type Meta struct {
    Attribute string
    Value     string
    Units     string
    Parent    *MetaCollection
}

Meta structs contain information about a single iRODS metadata attribute-value-units (AVU) triple

func (*Meta) Delete Uses

func (m *Meta) Delete() (*MetaCollection, error)

Delete deletes the current Meta struct from iRODS object

func (*Meta) Rename Uses

func (m *Meta) Rename(attributeName string) (*Meta, error)

Rename will modify metadata AVU attribute name only

func (*Meta) Set Uses

func (m *Meta) Set(value string, units string) (*Meta, error)

Set will modify metadata AVU value & units

func (*Meta) SetAll Uses

func (m *Meta) SetAll(attributeName string, value string, units string) (newMeta *Meta, e error)

SetAll will modify metadata AVU with all three paramaters (Attribute, Value, Unit)

func (*Meta) SetUnits Uses

func (m *Meta) SetUnits(units string) (*Meta, error)

SetUnits will modify metadata AVU units only

func (*Meta) SetValue Uses

func (m *Meta) SetValue(value string) (*Meta, error)

SetValue will modify metadata AVU value only

func (*Meta) String Uses

func (m *Meta) String() string

String shows the contents of the meta struct.

Sample output:

Attr1: Val (unit: foo)

type MetaCollection Uses

type MetaCollection struct {
    Metas Metas
    Obj   MetaObj
    Con   *Connection
}

MetaCollection is a collection of metadata AVU triples for a single data object

func (*MetaCollection) Add Uses

func (mc *MetaCollection) Add(m Meta) (*Meta, error)

Add creates a new meta AVU triple, returns pointer to the created Meta struct

func (*MetaCollection) All Uses

func (mc *MetaCollection) All() (Metas, error)

All returns a slice of all Meta structs in the MetaCollection

func (*MetaCollection) Delete Uses

func (mc *MetaCollection) Delete(attr string) (err error)

Delete deletes the meta AVU triple from the data object, identified by it's Attribute field

func (*MetaCollection) Each Uses

func (mc *MetaCollection) Each(iterator func(*Meta)) error

Each accepts an iterator function for looping over all Meta structs in the MetaCollection

func (*MetaCollection) First Uses

func (mc *MetaCollection) First(attr string) (*Meta, error)

First finds the first matching Meta struct by it's Attribute field

func (*MetaCollection) Get Uses

func (mc *MetaCollection) Get(attr string) (Metas, error)

Get returns a Meta struct slice (since attributes can share the same name in iRODS), matching by their Attribute field. Similar to Attribute() function of other types

func (*MetaCollection) ReadMeta Uses

func (mc *MetaCollection) ReadMeta() error

ReadMeta clears existing metadata triples and grabs updated copy from iCAT server.

func (*MetaCollection) Refresh Uses

func (mc *MetaCollection) Refresh() error

Refresh clears existing metadata triples and grabs updated copy from iCAT server. It's an alias of ReadMeta()

func (*MetaCollection) String Uses

func (mc *MetaCollection) String() string

String shows the contents of the meta collection.

Sample output:

Attr1: Val (unit: )
Attr2: Yes (unit: bool)

type MetaObj Uses

type MetaObj interface {
    Type() int
    Con() *Connection
    Name() string
    Path() string

    Meta() (*MetaCollection, error)
    Attribute(string) (Metas, error)
    AddMeta(Meta) (*Meta, error)
    DeleteMeta(string) (*MetaCollection, error)
}

type Metas Uses

type Metas []*Meta

Metas is a slice of *Meta

func (Metas) MatchOne Uses

func (ms Metas) MatchOne(m *Meta) *Meta

MatchOne returns a single Meta struct from the slice, matching on Attribute, Value, and Units

func (Metas) String Uses

func (ms Metas) String() string

String shows the contents of the meta slice struct.

Sample output:

Attr1: Val (unit: foo)

type RangeOutput Uses

type RangeOutput []RangeSegmentOutput

func (RangeOutput) TotalLength Uses

func (ro RangeOutput) TotalLength() string

type RangeSegmentOutput Uses

type RangeSegmentOutput struct {
    ContentRange string
    ContentType  string
    ByteContent  []byte
}

type Reader Uses

type Reader struct {
    // contains filtered or unexported fields
}

Reader provides an io.Reader interface for *gorods.DataObj

func (*Reader) Read Uses

func (r *Reader) Read(p []byte) (n int, err error)

Read implements io.Reader interface

type RegOptions Uses

type RegOptions struct {
    PhysicalFilePath string
    RodsPath         string
    Force            bool
    Replica          bool
    Resource         interface{}
    ExcludeFiles     string
}

type Resource Uses

type Resource struct {
    // contains filtered or unexported fields
}

Resource holds information about a resource server registered with iCAT.

func (*Resource) Children Uses

func (resc *Resource) Children() (string, error)

Children loads data from iCAT if needed, and returns the resources children attribute.

func (*Resource) Class Uses

func (resc *Resource) Class() (int, error)

Class loads data from iCAT if needed, and returns the resources class attribute.

func (*Resource) Comment Uses

func (resc *Resource) Comment() (string, error)

Comment loads data from iCAT if needed, and returns the resources comment attribute.

func (*Resource) Context Uses

func (resc *Resource) Context() (string, error)

Context loads data from iCAT if needed, and returns the resources context attribute.

func (*Resource) CreateTime Uses

func (resc *Resource) CreateTime() (time.Time, error)

CreateTime loads data from iCAT if needed, and returns the resources createTime attribute.

func (*Resource) FetchInfo Uses

func (resc *Resource) FetchInfo() (map[string]string, error)

FetchInfo fetches fresh resource info from the iCAT server and returns it as a map

func (*Resource) FreeSpace Uses

func (resc *Resource) FreeSpace() (int, error)

FreeSpace loads data from iCAT if needed, and returns the resources freeSpace attribute.

func (*Resource) FreeSpaceTime Uses

func (resc *Resource) FreeSpaceTime() (time.Time, error)

FreeSpaceTime loads data from iCAT if needed, and returns the resources freeSpaceTime attribute.

func (*Resource) Id Uses

func (resc *Resource) Id() (int, error)

Id loads data from iCAT if needed, and returns the resources id attribute.

func (*Resource) Info Uses

func (resc *Resource) Info() (string, error)

Info loads data from iCAT if needed, and returns the resources info attribute.

func (*Resource) ModifyTime Uses

func (resc *Resource) ModifyTime() (time.Time, error)

ModifyTime loads data from iCAT if needed, and returns the resources modifyTime attribute.

func (*Resource) Name Uses

func (resc *Resource) Name() string

Name returns the resource name

func (*Resource) Net Uses

func (resc *Resource) Net() (string, error)

Net loads data from iCAT if needed, and returns the resources net attribute.

func (*Resource) ObjCount Uses

func (resc *Resource) ObjCount() (int, error)

ObjCount loads data from iCAT if needed, and returns the resources status attribute.

func (*Resource) ParentStr Uses

func (resc *Resource) ParentStr() (string, error)

ParentStr loads data from iCAT if needed, and returns the resources parentStr attribute.

func (*Resource) PhysPath Uses

func (resc *Resource) PhysPath() (string, error)

PhysPath loads data from iCAT if needed, and returns the resources physPath attribute.

func (*Resource) RefreshInfo Uses

func (resc *Resource) RefreshInfo() error

RefreshInfo fetches fresh resource data from the iCAT server, and unloads it to the resource struct's fields.

func (*Resource) Remove Uses

func (resc *Resource) Remove() bool

Remove removes the resource from it's parent slice

func (*Resource) Status Uses

func (resc *Resource) Status() (string, error)

Status loads data from iCAT if needed, and returns the resources status attribute.

func (*Resource) StorageType Uses

func (resc *Resource) StorageType() (string, error)

Status loads data from iCAT if needed, and returns the resources info attribute.

func (*Resource) String Uses

func (resc *Resource) String() string

String returns the resource name and zone name

func (*Resource) Type Uses

func (resc *Resource) Type() (int, error)

Id loads data from iCAT if needed, and returns the resources id attribute.

func (*Resource) Zone Uses

func (resc *Resource) Zone() *Zone

Zone returns the *Zone to which the resource belongs to.

type Resources Uses

type Resources []*Resource

Resources is a slice of *Resource.

func (Resources) FindByName Uses

func (rescs Resources) FindByName(name string) *Resource

FindByName returns the matching *Resource based on the name.

func (*Resources) Remove Uses

func (rescs *Resources) Remove(index int)

Remove removes the specific element from itself, based on index.

type TrimOptions Uses

type TrimOptions struct {
    NumCopiesKeep  int
    MinAgeMins     int
    TargetResource interface{}
}

TrimOptions store the options for trim operations. NumCopiesKeep is the miniumum number of data object replicas to maintain. MinAgeMinues is the minimum age in minutes of the data object to trim. TargetResource is a string or *Resource type.

type User Uses

type User struct {
    // contains filtered or unexported fields
}

User contains information relating to an iRODS user

func (*User) AddMeta Uses

func (usr *User) AddMeta(m Meta) (nm *Meta, err error)

AddMeta adds a single Meta triple struct

func (*User) AddToGroup Uses

func (usr *User) AddToGroup(grp interface{}) error

AddToGroup adds the user to an existing iRODS group. Accepts string or *Group types.

func (*User) Attribute Uses

func (usr *User) Attribute(attrName string) (Metas, error)

Attribute gets slice of Meta AVU triples, matching by Attribute name for User

func (*User) ChangePassword Uses

func (usr *User) ChangePassword(newPass string) error

ChangePassword changes the user's password. You will need to be a rodsadmin for this to succeed (I think).

func (*User) Comment Uses

func (usr *User) Comment() (string, error)

Comment loads data from iRODS if needed, and returns the user's comment attribute.

func (*User) Con Uses

func (usr *User) Con() *Connection

Con returns the connection used to initalize the user

func (*User) CreateTime Uses

func (usr *User) CreateTime() (time.Time, error)

CreateTime loads data from iRODS if needed, and returns the user's createTime attribute.

func (*User) Delete Uses

func (usr *User) Delete() error

Delete deletes the user from the iCAT server

func (*User) DeleteMeta Uses

func (usr *User) DeleteMeta(attr string) (*MetaCollection, error)

DeleteMeta deletes a single Meta triple struct, identified by Attribute field

func (*User) FetchGroups Uses

func (usr *User) FetchGroups() (Groups, error)

FetchGroups fetches and returns fresh data about the user's groups from the iCAT server.

func (*User) FetchInfo Uses

func (usr *User) FetchInfo() (map[string]string, error)

FetchInfo fetches fresh user info from the iCAT server, and returns it as a map.

func (*User) Groups Uses

func (usr *User) Groups() (Groups, error)

Groups loads data from iRODS if needed, and returns the user's groups slice.

func (*User) Id Uses

func (usr *User) Id() (int, error)

Id loads data from iRODS if needed, and returns the user's id attribute.

func (*User) Info Uses

func (usr *User) Info() (string, error)

Info loads data from iRODS if needed, and returns the user's info attribute.

func (*User) Meta Uses

func (usr *User) Meta() (*MetaCollection, error)

Meta returns collection of Meta AVU triple structs of the user object

func (*User) ModifyTime Uses

func (usr *User) ModifyTime() (time.Time, error)

ModifyTime loads data from iRODS if needed, and returns the user's modifyTime attribute.

func (*User) Name Uses

func (usr *User) Name() string

Name returns the users name.

func (*User) Path Uses

func (usr *User) Path() string

Path returns the users name. Used in gorods.MetaObj interface.

func (*User) RefreshGroups Uses

func (usr *User) RefreshGroups() error

RefreshGroups fetches group data from iCAT, and unloads it into the *User fields

func (*User) RefreshInfo Uses

func (usr *User) RefreshInfo() error

RefreshInfo fetches user data from iCAT, and unloads it into the *User fields

func (*User) Remove Uses

func (usr *User) Remove() bool

Remove removed the user from it's parent slice.

func (*User) RemoveFromGroup Uses

func (usr *User) RemoveFromGroup(grp interface{}) error

RemoveFromGroup removes the user from an iRODS group. Accepts string or *Group types.

func (*User) String Uses

func (usr *User) String() string

String returns a user's type, name, and zone.

func (*User) Type Uses

func (usr *User) Type() int

Type loads data from iRODS if needed, and returns the user's typ attribute. Used in AccessObject and MetaObj interfaces.

func (*User) Zone Uses

func (usr *User) Zone() *Zone

Zone returns the *Zone to which the user belongs.

type Users Uses

type Users []*User

Users is a slice of *User

func (Users) FindByName Uses

func (usrs Users) FindByName(name string, con *Connection) *User

FindByName searches the slice for a user by name. If no match is found, a new user with that name is created and returned. This was designed to resolve issues of casting resources for DataObjects and Collections, even though the cache was empty due to permissions.

func (*Users) Remove Uses

func (usrs *Users) Remove(index int)

Remove deletes an item from the slice based on the index.

type Writer Uses

type Writer struct {
    // contains filtered or unexported fields
}

Writer provides an io.Writer interface for *gorods.DataObj

func (*Writer) Write Uses

func (w *Writer) Write(p []byte) (n int, err error)

Write implements io.Writer interface

type Zone Uses

type Zone struct {
    // contains filtered or unexported fields
}

Zone contains information representing an iRODS zone.

func (*Zone) Comment Uses

func (zne *Zone) Comment() (string, error)

Comment loads data from iRODS if needed, and returns the zone's comment attribute.

func (*Zone) ConString Uses

func (zne *Zone) ConString() (string, error)

ConString loads data from iRODS if needed, and returns the zone's conString attribute.

func (*Zone) CreateTime Uses

func (zne *Zone) CreateTime() (time.Time, error)

CreateTime loads data from iRODS if needed, and returns the zone's createTime attribute.

func (*Zone) FetchInfo Uses

func (zne *Zone) FetchInfo() (map[string]string, error)

FetchInfo returns a map of fresh zone info from the iCAT server.

func (*Zone) Id Uses

func (zne *Zone) Id() (int, error)

Id loads data from iRODS if needed, and returns the zone's id attribute.

func (*Zone) ModifyTime Uses

func (zne *Zone) ModifyTime() (time.Time, error)

ModifyTime loads data from iRODS if needed, and returns the zone's modifyTime attribute.

func (*Zone) Name Uses

func (zne *Zone) Name() string

Name returns the zone's name.

func (*Zone) RefreshInfo Uses

func (zne *Zone) RefreshInfo() error

RefreshInfo pulls fresh info from the iCAT server, and sets it's zone fields based on the data.

func (*Zone) Remove Uses

func (zne *Zone) Remove() bool

Remove removes the zone from it's parent slice

func (*Zone) String Uses

func (zne *Zone) String() string

String returns the zone type and name.

func (*Zone) Type Uses

func (zne *Zone) Type() (int, error)

Type loads data from iRODS if needed, and returns the zone's typ attribute.

type Zones Uses

type Zones []*Zone

Zones is a slice of *Zone.

func (Zones) FindByName Uses

func (znes Zones) FindByName(name string, con *Connection) *Zone

FindByName searches the slice (itself) for a matching zone, based on name. If the zone isn't found, one is initialized. If no match is found, a new zone with that name is created and returned. This was designed to resolve issues of casting zone strings to structs, even though the cache was empty due to permissions.

func (*Zones) Remove Uses

func (znes *Zones) Remove(index int)

Remove removes an item from itself based on index.

Bugs

iRODS C API code outputs errors messages, need to implement connect wrapper (gorods_connect_env) from a lower level to suppress this output https://github.com/irods/irods/blob/master/iRODS/lib/core/src/rcConnect.cpp#L109

Directories

PathSynopsis
msiPackage msi is package that contains utilities for use in microservices written in Golang.

Package gorods imports 21 packages (graph) and is imported by 1 packages. Updated 2018-07-07. Refresh now. Tools for package owners.