eosgrpc

package
v1.28.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SystemAttr is the system extended attribute.
	SystemAttr eosclient.AttrType = iota
	// UserAttr is the user extended attribute.
	UserAttr
)

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) using the EOS GRPC interface.

func New

func New(ctx context.Context, opt *Options, httpOpts *HTTPOptions) (*Client, error)

New creates a new client with the given options.

func (*Client) AddACL

func (c *Client) AddACL(ctx context.Context, auth, rootAuth eosclient.Authorization, path string, pos uint, a *acl.Entry) error

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

func (*Client) Chmod

func (c *Client) Chmod(ctx context.Context, auth eosclient.Authorization, mode, path string) error

Chmod given path.

func (*Client) Chown

func (c *Client) Chown(ctx context.Context, auth, chownAuth eosclient.Authorization, path string) error

Chown given path.

func (*Client) CreateDir

func (c *Client) CreateDir(ctx context.Context, auth eosclient.Authorization, path string) error

CreateDir creates a directory at the given path.

func (*Client) GenerateToken

func (c *Client) GenerateToken(ctx context.Context, auth eosclient.Authorization, path string, a *acl.Entry) (string, error)

GenerateToken returns a token on behalf of the resource owner to be used by lightweight accounts.

func (*Client) GetACL

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

GetACL for a file.

func (*Client) GetAttr

func (c *Client) GetAttr(ctx context.Context, auth eosclient.Authorization, key, path string) (*eosclient.Attribute, error)

GetAttr returns the attribute specified by key.

func (*Client) GetAttrs added in v0.0.20

func (c *Client) GetAttrs(ctx context.Context, auth eosclient.Authorization, path string) ([]*eosclient.Attribute, error)

GetAttrs returns all the attributes of a resource.

func (*Client) GetFileInfoByFXID

func (c *Client) GetFileInfoByFXID(ctx context.Context, auth eosclient.Authorization, fxid string) (*eosclient.FileInfo, error)

GetFileInfoByFXID returns the FileInfo by the given file id in hexadecimal.

func (*Client) GetFileInfoByInode

func (c *Client) GetFileInfoByInode(ctx context.Context, auth eosclient.Authorization, inode uint64) (*eosclient.FileInfo, error)

GetFileInfoByInode returns the FileInfo by the given inode.

func (*Client) GetFileInfoByPath

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

GetFileInfoByPath returns the FilInfo at the given path.

func (*Client) GetQuota

func (c *Client) GetQuota(ctx context.Context, username string, rootAuth eosclient.Authorization, path string) (*eosclient.QuotaInfo, 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, auth eosclient.Authorization, dpath string) ([]*eosclient.FileInfo, error)

List the contents of the directory given by path.

func (*Client) ListACLs

func (c *Client) ListACLs(ctx context.Context, auth eosclient.Authorization, 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, auth eosclient.Authorization, maxentries int, from, to time.Time) ([]*eosclient.DeletedEntry, error)

ListDeletedEntries returns a list of the deleted entries.

func (*Client) ListVersions

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

ListVersions list all the versions for a given file.

func (*Client) PurgeDeletedEntries

func (c *Client) PurgeDeletedEntries(ctx context.Context, auth eosclient.Authorization) error

PurgeDeletedEntries purges all entries from the recycle bin.

func (*Client) Read

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

Read reads a file from the mgm and returns a handle to read it This handle could be directly the body of the response or a local tmp file

returning a handle to the body is nice, yet it gives less control on the transaction
itself, e.g. strange timeouts or TCP issues may be more difficult to trace

Let's consider this experimental for the moment, maybe I'll like to add a config parameter to choose between the two behaviours.

func (*Client) ReadVersion

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

ReadVersion reads the version for the given file.

func (*Client) Remove

func (c *Client) Remove(ctx context.Context, auth eosclient.Authorization, path string, noRecycle bool) error

Remove removes the resource at the given path.

func (*Client) RemoveACL

func (c *Client) RemoveACL(ctx context.Context, auth, rootAuth eosclient.Authorization, path string, a *acl.Entry) error

RemoveACL removes the acl from EOS.

func (*Client) Rename

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

Rename renames the resource referenced by oldPath to newPath.

func (*Client) RestoreDeletedEntry

func (c *Client) RestoreDeletedEntry(ctx context.Context, auth eosclient.Authorization, key string) error

RestoreDeletedEntry restores a deleted entry.

func (*Client) RollbackToVersion

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

RollbackToVersion rollbacks a file to a previous version.

func (*Client) SetAttr

func (c *Client) SetAttr(ctx context.Context, auth eosclient.Authorization, attr *eosclient.Attribute, errorIfExists, recursive bool, path string) error

SetAttr sets an extended attributes on a path.

func (*Client) SetQuota

func (c *Client) SetQuota(ctx context.Context, rootAuth eosclient.Authorization, info *eosclient.SetQuotaInfo) error

SetQuota sets the quota of a user on the quota node defined by path.

func (*Client) Touch

func (c *Client) Touch(ctx context.Context, auth eosclient.Authorization, path string) error

Touch creates a 0-size,0-replica file in the EOS namespace.

func (*Client) UnsetAttr

func (c *Client) UnsetAttr(ctx context.Context, auth eosclient.Authorization, attr *eosclient.Attribute, recursive bool, path string) error

UnsetAttr unsets an extended attribute on a path.

func (*Client) UpdateACL

func (c *Client) UpdateACL(ctx context.Context, auth, rootAuth eosclient.Authorization, path string, position uint, a *acl.Entry) error

UpdateACL updates the EOS acl.

func (*Client) Write

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

Write writes a file to the mgm Somehow the same considerations as Read apply.

func (*Client) WriteFile

func (c *Client) WriteFile(ctx context.Context, auth eosclient.Authorization, path, source string) error

WriteFile writes an existing file to the mgm. Old xrdcp utility.

type EOSHTTPClient

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

EOSHTTPClient performs HTTP-based tasks (e.g. upload, download) against a EOS management node (MGM) using the EOS XrdHTTP interface. In this module we wrap eos-related behaviour, e.g. headers or r/w retries.

func NewEOSHTTPClient

func NewEOSHTTPClient(opt *HTTPOptions) (*EOSHTTPClient, error)

NewEOSHTTPClient creates a new client with the given options.

func (*EOSHTTPClient) GETFile

func (c *EOSHTTPClient) GETFile(ctx context.Context, remoteuser string, auth eosclient.Authorization, urlpath string, stream io.WriteCloser) (io.ReadCloser, error)

GETFile does an entire GET to download a full file. Returns a stream to read the content from.

func (*EOSHTTPClient) Head

func (c *EOSHTTPClient) Head(ctx context.Context, remoteuser string, auth eosclient.Authorization, urlpath string) error

Head performs a HEAD req. Useful to check the server.

func (*EOSHTTPClient) PUTFile

func (c *EOSHTTPClient) PUTFile(ctx context.Context, remoteuser string, auth eosclient.Authorization, urlpath string, stream io.ReadCloser, length int64) error

PUTFile does an entire PUT to upload a full file, taking the data from a stream.

type HTTPOptions

type HTTPOptions struct {

	// HTTP URL of the EOS MGM.
	// Default is https://eos-example.org
	BaseURL string

	// Timeout in seconds for connecting to the service
	ConnectTimeout int

	// Timeout in seconds for sending a request to the service and getting a response
	// Does not include redirections
	RWTimeout int

	// Timeout in seconds for performing an operation. Includes every redirection, retry, etc
	OpTimeout int

	// Max idle conns per Transport
	MaxIdleConns int

	// Max conns per transport per destination host
	MaxConnsPerHost int

	// Max idle conns per transport per destination host
	MaxIdleConnsPerHost int

	// TTL for an idle conn per transport
	IdleConnTimeout int

	// If the URL is https, then we need to configure this client
	// with the usual TLS stuff
	// Defaults are /etc/grid-security/hostcert.pem and /etc/grid-security/hostkey.pem
	ClientCertFile string
	ClientKeyFile  string

	// These will override the defaults, which are common system paths hardcoded
	// in the go x509 implementation (why did they do that?!?!?)
	// of course /etc/grid-security/certificates is NOT in those defaults!
	ClientCADirs  string
	ClientCAFiles string

	// Authkey is the key that authorizes this client to connect to the EOS HTTP service
	Authkey string
}

HTTPOptions to configure the Client.

type Options

type Options struct {

	// UseKeyTabAuth changes will authenticate requests by using an EOS keytab.
	UseKeytab bool

	// Whether to maintain the same inode across various versions of a file.
	// Requires extra metadata operations if set to true
	VersionInvariant bool

	// Set to true to use the local disk as a buffer for chunk
	// reads from EOS. Default is false, i.e. pure streaming
	ReadUsesLocalTemp bool

	// Set to true to use the local disk as a buffer for chunk
	// writes to EOS. Default is false, i.e. pure streaming
	// Beware: in pure streaming mode the FST must support
	// the HTTP chunked encoding
	WriteUsesLocalTemp bool

	// Location of the xrdcopy binary.
	// Default is /opt/eos/xrootd/bin/xrdcopy.
	XrdcopyBinary string

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

	// URI of the EOS MGM grpc server
	GrpcURI string

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

	// Keytab is the location of the EOS keytab file.
	Keytab string

	// Authkey is the key that authorizes this client to connect to the GRPC service
	Authkey string

	// SecProtocol is the comma separated list of security protocols used by xrootd.
	// For example: "sss, unix"
	SecProtocol string
}

Options to configure the Client.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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