api

package
v0.1.36 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2021 License: Apache-2.0 Imports: 24 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DisableTrust bool

DisableTrust is a hardcoded DisableTrust

View Source
var Password string

Password is a hardcoded Password

View Source
var UserName string

UserName is a hardcoded UserName

Functions

func AddTrustedCert added in v0.1.36

func AddTrustedCert(url string) error

AddTrustedCert adds a trusted Cert

func ClearAuthToken added in v0.1.36

func ClearAuthToken()

Clear AuthToken will remove the current auth token to authenticate to the client

Types

type Credentials

type Credentials struct {
	ServerURL    string `yaml:"url" required:"true" envconfig:"SDFS_URL" default:"sdfss://localhost:6442"`
	Password     string `yaml:"password" default:"" envconfig:"SDFS_PASSWORD" default:""`
	DisableTrust bool   `yaml:"disable_trust" envconfig:"SDFS_DISABLE_TRUST"`
	// contains filtered or unexported fields
}

A Credentials Struct

type SdfsConnection

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

SdfsConnection is the connection info

func NewConnection

func NewConnection(path string) (*SdfsConnection, error)

NewConnection Created a new connectio given a path

func (*SdfsConnection) Chmod

func (n *SdfsConnection) Chmod(ctx context.Context, path string, mode int32) (err error)

Chmod sets permission of the requested file to the requested permissions

func (*SdfsConnection) Chown

func (n *SdfsConnection) Chown(ctx context.Context, path string, gid int32, uid int32) (err error)

Chown sets ownership of the requested file to the requested owner

func (*SdfsConnection) CleanStore

func (n *SdfsConnection) CleanStore(ctx context.Context, compact, waitForCompletion bool) (event *spb.SDFSEvent, err error)

CleanStore does garbage collection on the volume

func (*SdfsConnection) CloseConnection

func (n *SdfsConnection) CloseConnection(ctx context.Context) error

CloseConnection closes the grpc connection to the volume

func (*SdfsConnection) CopyExtent added in v0.1.14

func (n *SdfsConnection) CopyExtent(ctx context.Context, src, dst string, srcStart, dstStart, len int64) (written int64, err error)

CopyExtent creates a snapshop of a give source to a given destination

func (*SdfsConnection) CopyFile

func (n *SdfsConnection) CopyFile(ctx context.Context, src, dst string, returnImmediately bool) (event *spb.SDFSEvent, err error)

CopyFile creates a snapshop of a give source to a given destination

func (*SdfsConnection) DSEInfo

func (n *SdfsConnection) DSEInfo(ctx context.Context) (info *spb.DSEInfo, err error)

DSEInfo get dedupe storage info

func (*SdfsConnection) DeleteCloudVolume

func (n *SdfsConnection) DeleteCloudVolume(ctx context.Context, volumeid int64, waitForCompletion bool) (event *spb.SDFSEvent, err error)

DeleteCloudVolume deletes a volume that is no longer in use

func (*SdfsConnection) DeleteFile

func (n *SdfsConnection) DeleteFile(ctx context.Context, path string) error

DeleteFile removes a given file

func (*SdfsConnection) Download added in v0.1.30

func (n *SdfsConnection) Download(ctx context.Context, src, dst string) (bytesread int64, err error)

Download downloads a file from SDFS locally

func (*SdfsConnection) FileExists

func (n *SdfsConnection) FileExists(ctx context.Context, path string) (exists bool, err error)

FileExists checks if a file Exists given a path.

func (*SdfsConnection) FileNotification added in v0.1.31

func (n *SdfsConnection) FileNotification(ctx context.Context, fileInfo chan *spb.FileMessageResponse) error

FileNotification notifies over a channel for all events when a file is downloaded for Sync

func (*SdfsConnection) Flush

func (n *SdfsConnection) Flush(ctx context.Context, path string, fh int64) (err error)

Flush flushes the requested file to underlying storage

func (*SdfsConnection) Fsync

func (n *SdfsConnection) Fsync(ctx context.Context, path string, fh int64) error

Fsync Syncs an sdfs file to underlying storage

func (*SdfsConnection) GetAttr

func (n *SdfsConnection) GetAttr(ctx context.Context, path string) (stat *spb.Stat, err error)

GetAttr returns Stat for a given file

func (*SdfsConnection) GetCloudFile

func (n *SdfsConnection) GetCloudFile(ctx context.Context, path, dst string, overwrite, waitForCompletion bool) (event *spb.SDFSEvent, err error)

GetCloudFile hydrates a given file from object storage to the local filesystem.

func (*SdfsConnection) GetCloudMetaFile

func (n *SdfsConnection) GetCloudMetaFile(ctx context.Context, path, dst string, overwrite, waitForCompletion bool) (event *spb.SDFSEvent, err error)

GetCloudMetaFile downloads the metadata for given file from object storage but does not hydrate it into the local hashtable.

func (*SdfsConnection) GetConnectedVolumes

func (n *SdfsConnection) GetConnectedVolumes(ctx context.Context) (info []*spb.ConnectedVolumeInfo, err error)

GetConnectedVolumes returns all the volumes sharing the same storage

func (*SdfsConnection) GetEvent

func (n *SdfsConnection) GetEvent(ctx context.Context, eventid string) (*spb.SDFSEvent, error)

GetEvent returns the event struct for a specific event id

func (*SdfsConnection) GetGCSchedule

func (n *SdfsConnection) GetGCSchedule(ctx context.Context) (schedule string, err error)

GetGCSchedule returns the current Garbage collection schedule for the volume

func (*SdfsConnection) GetVolumeInfo

func (n *SdfsConnection) GetVolumeInfo(ctx context.Context) (volumeInfo *spb.VolumeInfoResponse, err error)

GetVolumeInfo returns the volume info

func (*SdfsConnection) GetXAttr

func (n *SdfsConnection) GetXAttr(ctx context.Context, key, path string) (value string, err error)

GetXAttr retrieves a value for a given attribute and file

func (*SdfsConnection) GetXAttrSize

func (n *SdfsConnection) GetXAttrSize(ctx context.Context, path, key string) (int32, error)

GetXAttrSize gets the list size for attributes. This is useful for a fuse implementation

func (*SdfsConnection) ListDir

func (n *SdfsConnection) ListDir(ctx context.Context, path, marker string, compact bool, returnsz int32) (string, []*spb.FileInfoResponse, error)

ListDir lists a directory

func (*SdfsConnection) ListEvents

func (n *SdfsConnection) ListEvents(ctx context.Context) ([]*spb.SDFSEvent, error)

ListEvents lists all the events that have occured

func (*SdfsConnection) MkDir

func (n *SdfsConnection) MkDir(ctx context.Context, path string, mode int32) error

MkDir makes a given directory

func (*SdfsConnection) MkDirAll

func (n *SdfsConnection) MkDirAll(ctx context.Context, path string) error

MkDirAll makes a directory and all parent directories

func (*SdfsConnection) MkNod

func (n *SdfsConnection) MkNod(ctx context.Context, path string, mode, rdev int32) (err error)

MkNod makes a given file

func (*SdfsConnection) Open

func (n *SdfsConnection) Open(ctx context.Context, path string, flags int32) (fh int64, err error)

Open opens a given file

func (*SdfsConnection) Read

func (n *SdfsConnection) Read(ctx context.Context, fh int64, offset int64, length int32) (data []byte, err error)

Read reads data from a given filehandle

func (n *SdfsConnection) ReadLink(ctx context.Context, path string) (linkpath string, err error)

ReadLink reads a symlink for a given source

func (*SdfsConnection) Release

func (n *SdfsConnection) Release(ctx context.Context, fh int64) (err error)

Release closes a given filehandle

func (*SdfsConnection) RemoveXAttr

func (n *SdfsConnection) RemoveXAttr(ctx context.Context, key, path string) error

RemoveXAttr removes a given key for a file

func (*SdfsConnection) Rename added in v0.1.18

func (n *SdfsConnection) Rename(ctx context.Context, src, dst string) (err error)

Rename renames a file

func (*SdfsConnection) RmDir

func (n *SdfsConnection) RmDir(ctx context.Context, path string) error

RmDir removes a given directory

func (*SdfsConnection) SetCacheSize

func (n *SdfsConnection) SetCacheSize(ctx context.Context, size int64, waitForCompletion bool) (event *spb.SDFSEvent, err error)

SetCacheSize does garbage collection on the volume

func (*SdfsConnection) SetPassword

func (n *SdfsConnection) SetPassword(ctx context.Context, password string) (err error)

SetPassword sets the password for the volume

func (*SdfsConnection) SetReadSpeed

func (n *SdfsConnection) SetReadSpeed(ctx context.Context, speed int32) (err error)

SetReadSpeed sets the read speed in Kb/s

func (*SdfsConnection) SetUserMetaData

func (n *SdfsConnection) SetUserMetaData(ctx context.Context, path string, fileAttributes []*spb.FileAttributes) (err error)

SetUserMetaData sets an array of key value pairs for a given path

func (*SdfsConnection) SetVolumeCapacity

func (n *SdfsConnection) SetVolumeCapacity(ctx context.Context, size int64) (err error)

SetVolumeCapacity sets the logical size of the volume

func (*SdfsConnection) SetWriteSpeed

func (n *SdfsConnection) SetWriteSpeed(ctx context.Context, speed int32) (err error)

SetWriteSpeed sets the write speed in Kb/s

func (*SdfsConnection) SetXAttr

func (n *SdfsConnection) SetXAttr(ctx context.Context, key, value, path string) error

SetXAttr sets a specific key value pair for a given file

func (*SdfsConnection) ShutdownVolume

func (n *SdfsConnection) ShutdownVolume(ctx context.Context) (err error)

ShutdownVolume unmounts the given volume

func (*SdfsConnection) Stat

Stat gets a specific file info

func (*SdfsConnection) StatFS added in v0.1.16

func (n *SdfsConnection) StatFS(ctx context.Context) (stat *spb.StatFS, err error)

StatFS Gets Filesystem in Typical OS Stat Format

func (n *SdfsConnection) SymLink(ctx context.Context, src, dst string) (err error)

SymLink creates a symlink for a given source and destination

func (*SdfsConnection) SyncCloudVolume

func (n *SdfsConnection) SyncCloudVolume(ctx context.Context, waitForCompletion bool) (event *spb.SDFSEvent, err error)

SyncCloudVolume syncs the current volume from all instances in the cloud

func (*SdfsConnection) SyncFromCloudVolume

func (n *SdfsConnection) SyncFromCloudVolume(ctx context.Context, volumeid int64, waitForCompletion bool) (event *spb.SDFSEvent, err error)

SyncFromCloudVolume syncs the current volume from a give volume id

func (*SdfsConnection) SystemInfo

func (n *SdfsConnection) SystemInfo(ctx context.Context) (info *spb.SystemInfo, err error)

SystemInfo returns system info

func (*SdfsConnection) Truncate

func (n *SdfsConnection) Truncate(ctx context.Context, path string, length int64) (err error)

Truncate truncates a given file to a given length in bytes

func (n *SdfsConnection) Unlink(ctx context.Context, path string) (err error)

Unlink deletes the given file

func (*SdfsConnection) Upload added in v0.1.30

func (n *SdfsConnection) Upload(ctx context.Context, src, dst string) (written int64, err error)

Upload uploads a file to the filesystem

func (*SdfsConnection) Utime

func (n *SdfsConnection) Utime(ctx context.Context, path string, atime, mtime int64) (err error)

Utime sets the utime for a given file

func (*SdfsConnection) WaitForEvent

func (n *SdfsConnection) WaitForEvent(ctx context.Context, eventid string) (*spb.SDFSEvent, error)

WaitForEvent waits for events to finish and then returns the end event.

func (*SdfsConnection) Write

func (n *SdfsConnection) Write(ctx context.Context, fh int64, data []byte, offset int64, length int32) (err error)

Write writes data to a given filehandle

type SdfsError added in v0.1.11

type SdfsError struct {
	Err       string
	ErrorCode spb.ErrorCodes
}

SdfsError is an SDFS Error with an error code mapped as a syscall error id

func (*SdfsError) Error added in v0.1.11

func (e *SdfsError) Error() string

Jump to

Keyboard shortcuts

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