Documentation
¶
Index ¶
- Constants
- type FClient
- func (fc *FClient) DecryptFile(filename string) (err error)
- func (fc *FClient) DeleteFile(targetfile string) (err error)
- func (fc *FClient) DownloadFile(req *filehandler.FileRequest) (err error)
- func (fc *FClient) EncryptFile(filename string) (err error)
- func (fc *FClient) ListFiles() (files []*filehandler.FileInfo, err error)
- func (fc *FClient) MakeDirectory(dirname string) (err error)
- func (fc *FClient) MultifileDownload(targets []string) (errs map[string]error)
- func (fc *FClient) MultifileUpload(targets []string) (errs map[string]error)
- func (fc *FClient) Ping() (roundtrip time.Duration, err error)
- func (fc *FClient) RenameFile(originalname string, newname string) (err error)
- func (fc *FClient) StorageBreakdown() (consumption *filehandler.StorageInfo, err error)
- func (fc *FClient) UpdateServerAddress(newaddress string) (err error)
- func (fc *FClient) UpdateTimeout(newtimeout time.Duration) (err error)
- func (fc *FClient) UploadFile(filename string) (err error)
- type FClientOptFunc
- func WithCreds(creds credentials.TransportCredentials) FClientOptFunc
- func WithMaxDownloads(maxdownloads int) FClientOptFunc
- func WithMaxUploads(maxuploads int) FClientOptFunc
- func WithSrvAddr(addr string) FClientOptFunc
- func WithTimeout(timeout time.Duration) FClientOptFunc
- func WithTransferTimeout(timeout time.Duration) FClientOptFunc
- type FClientOption
Constants ¶
const DEFAULT_MAX_DOWNLOADS int = 10
const DEFAULT_MAX_UPLOADS int = 10
const DEFAULT_SRVADDR string = "127.0.0.1:8999"
const DEFAULT_TIMEOUT time.Duration = 30 * time.Second
const DEFAULT_TRANSFER_TIMEOUT time.Duration = 20 * time.Minute
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FClient ¶
type FClient struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(opts ...FClientOptFunc) (client *FClient, err error)
create, intialize and return a new FClient object.
func (*FClient) DecryptFile ¶ added in v0.4.0
function designed to request a file on the server be decrypted.
func (*FClient) DeleteFile ¶ added in v0.1.0
function designed to request a file be deleted from the server's uploads directory.
func (*FClient) DownloadFile ¶
func (fc *FClient) DownloadFile(req *filehandler.FileRequest) (err error)
function designed to download the file contents from the file server.
this will save the content to the filename specified in the req object.
func (*FClient) EncryptFile ¶ added in v0.4.0
function designed to request a file on the server be encrypted.
func (*FClient) ListFiles ¶ added in v0.1.0
func (fc *FClient) ListFiles() (files []*filehandler.FileInfo, err error)
function designed to get the list of files the client is able to download from the server.
func (*FClient) MakeDirectory ¶ added in v0.1.0
function designed to make a specified directory within the server's uploads directory.
func (*FClient) MultifileDownload ¶ added in v0.2.0
function designed to download multiple files at one time.
this will return a map containing the filenames and an associated error. if no errors occurred, the map will be empty.
func (*FClient) MultifileUpload ¶ added in v0.2.0
function designed to upload multiple files at one time.
this will return a map containing the filenames and an associated error. if no errors occurred, the map will be empty.
func (*FClient) Ping ¶ added in v0.2.0
function designed to check whether the server is up and able to be contacted.
func (*FClient) RenameFile ¶ added in v0.1.0
function designed to request a file in the server's uploads directory be renamed.
func (*FClient) StorageBreakdown ¶ added in v0.3.0
func (fc *FClient) StorageBreakdown() (consumption *filehandler.StorageInfo, err error)
function designed to call the StorageBreakdown rpc and get the storage consumption information from the server.
func (*FClient) UpdateServerAddress ¶ added in v0.2.0
function designed to update the address of the server the client attempts to connect to when it makes RPC calls.
this will first save the existing address, then set the new address, and Ping the new address to make sure it is reachable.
if the new address' Ping fails, the address will be reset to the old address.
func (*FClient) UpdateTimeout ¶ added in v0.2.0
function designed to update the connection timeout for the client.
func (*FClient) UploadFile ¶
function designed to upload a file to the file server.
type FClientOptFunc ¶
type FClientOptFunc func(*FClientOption) error
func WithCreds ¶
func WithCreds(creds credentials.TransportCredentials) FClientOptFunc
set the transport credentials the client will use to connect to the server.
func WithMaxDownloads ¶ added in v0.3.0
func WithMaxDownloads(maxdownloads int) FClientOptFunc
set the maximum number of concurrent downloads allowed
func WithMaxUploads ¶ added in v0.3.0
func WithMaxUploads(maxuploads int) FClientOptFunc
set the maximum number of concurrent downloads allowed
func WithSrvAddr ¶
func WithSrvAddr(addr string) FClientOptFunc
set the server address (<ip/domain>:<port>)
func WithTimeout ¶
func WithTimeout(timeout time.Duration) FClientOptFunc
set the connection timeout value.
func WithTransferTimeout ¶ added in v0.3.0
func WithTransferTimeout(timeout time.Duration) FClientOptFunc
set the transfer timeout value. this will be the timeout value for a file upload and download.
type FClientOption ¶
type FClientOption struct {
Creds credentials.TransportCredentials
Srvaddr string
Srvopts []grpc.DialOption
TransferCfg ofctypes.TransferConfig
// timeout value for making connections to the server. this will
// be applied to both upload and download functions.
Timeout time.Duration
}