eosclient

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2019 License: Apache-2.0 Imports: 18 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client performs actions against a EOS management node (MGM). It requires the eos-client and xrootd-client packages installed to work.

func New

func New(opt *Options) *Client

New creates a new client with the given options.

func (*Client) AddACL

func (c *Client) AddACL(ctx context.Context, username, path string, a *acl.Entry) error

AddACL adds an new acl to EOS with the given aclType.

func (*Client) CreateDir

func (c *Client) CreateDir(ctx context.Context, username, path string) error

CreateDir creates a directory at the given path

func (*Client) GetACL

func (c *Client) GetACL(ctx context.Context, username, path, aclType, target string) (*acl.Entry, error)

GetACL for a file

func (*Client) GetFileInfoByInode

func (c *Client) GetFileInfoByInode(ctx context.Context, username string, inode uint64) (*FileInfo, error)

GetFileInfoByInode returns the FileInfo by the given inode

func (*Client) GetFileInfoByPath

func (c *Client) GetFileInfoByPath(ctx context.Context, username, path string) (*FileInfo, error)

GetFileInfoByPath returns the FilInfo at the given path

func (*Client) GetQuota

func (c *Client) GetQuota(ctx context.Context, username, path string) (int, int, error)

GetQuota gets the quota of a user on the quota node defined by path

func (*Client) List

func (c *Client) List(ctx context.Context, username, path string) ([]*FileInfo, error)

List the contents of the directory given by path

func (*Client) ListACLs

func (c *Client) ListACLs(ctx context.Context, username, path string) ([]*acl.Entry, error)

ListACLs returns the list of ACLs present under the given path. EOS returns uids/gid for Citrine version and usernames for older versions. For Citire we need to convert back the uid back to username.

func (*Client) ListDeletedEntries

func (c *Client) ListDeletedEntries(ctx context.Context, username string) ([]*DeletedEntry, error)

ListDeletedEntries returns a list of the deleted entries.

func (*Client) ListVersions

func (c *Client) ListVersions(ctx context.Context, username, p string) ([]*FileInfo, error)

ListVersions list all the versions for a given file.

func (*Client) PurgeDeletedEntries

func (c *Client) PurgeDeletedEntries(ctx context.Context, username string) error

PurgeDeletedEntries purges all entries from the recycle bin.

func (*Client) Read

func (c *Client) Read(ctx context.Context, username, path string) (io.ReadCloser, error)

Read reads a file from the mgm

func (*Client) ReadVersion

func (c *Client) ReadVersion(ctx context.Context, username, p, version string) (io.ReadCloser, error)

ReadVersion reads the version for the given file.

func (*Client) Remove

func (c *Client) Remove(ctx context.Context, username, path string) error

Remove removes the resource at the given path

func (*Client) RemoveACL

func (c *Client) RemoveACL(ctx context.Context, username, path string, aclType string, recipient string) error

RemoveACL removes the acl from EOS.

func (*Client) Rename

func (c *Client) Rename(ctx context.Context, username, oldPath, newPath string) error

Rename renames the resource referenced by oldPath to newPath

func (*Client) RestoreDeletedEntry

func (c *Client) RestoreDeletedEntry(ctx context.Context, username, key string) error

RestoreDeletedEntry restores a deleted entry.

func (*Client) RollbackToVersion

func (c *Client) RollbackToVersion(ctx context.Context, username, path, version string) error

RollbackToVersion rollbacks a file to a previous version.

func (*Client) UpdateACL

func (c *Client) UpdateACL(ctx context.Context, username, path string, a *acl.Entry) error

UpdateACL updates the EOS acl.

func (*Client) Write

func (c *Client) Write(ctx context.Context, username, path string, stream io.ReadCloser) error

Write writes a file to the mgm

type DeletedEntry

type DeletedEntry struct {
	RestorePath   string
	RestoreKey    string
	Size          uint64
	DeletionMTime uint64
	IsDir         bool
}

DeletedEntry represents an entry from the trashbin.

type FileInfo

type FileInfo struct {
	IsDir      bool
	MTimeNanos uint32
	Inode      uint64 `json:"inode"`
	FID        uint64 `json:"fid"`
	UID        uint64 `json:"uid"`
	GID        uint64 `json:"gid"`
	TreeSize   uint64
	MTimeSec   uint64
	Size       uint64
	TreeCount  uint64
	File       string `json:"eos_file"`
	ETag       string
	Instance   string
	SysACL     string
}

FileInfo represents the metadata information returned by querying the EOS namespace.

type Options

type Options struct {

	// ForceSingleUserMode forces all connections to use only one user.
	// This is the case when access to EOS is done from FUSE under apache or www-data.
	ForceSingleUserMode bool

	// SingleUsername is the username to use when connecting to EOS.
	// Defaults to apache
	SingleUsername string

	// Location of the eos binary.
	// Default is /usr/bin/eos.
	EosBinary string

	// Location of the xrdcopy binary.
	// Default is /usr/bin/xrdcopy.
	XrdcopyBinary string

	// URL of the EOS MGM.
	// Default is root://eos-example.org
	URL string

	// Location on the local fs where to store reads.
	// Defaults to os.TempDir()
	CacheDirectory string
}

Options to configure the Client.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL