Documentation ¶
Index ¶
- Constants
- Variables
- func NewIoProgress(r io.Reader, m int, ch chan<- int) *ioProgress
- type AuthToken
- type FileList
- type ListItem
- type MailRuCloud
- func (c *MailRuCloud) Cat(src string) (err error)
- func (c *MailRuCloud) Copy(src, dst string) (err error)
- func (c *MailRuCloud) CopyA(src, targetDir string) (err error)
- func (c *MailRuCloud) Get(src, dst string, ch chan<- int) (err error)
- func (c *MailRuCloud) GetShardInfo() (err error)
- func (c *MailRuCloud) List(path string) (list *FileList, err error)
- func (c *MailRuCloud) Mkdir(path string) (err error)
- func (c *MailRuCloud) Move(src, dst string) (err error)
- func (c *MailRuCloud) MoveA(src, targetDir string) (err error)
- func (c *MailRuCloud) PrintFileList(path string) (err error)
- func (c *MailRuCloud) PrintFileStat(path string) (err error)
- func (c *MailRuCloud) Remove(path string) (err error)
- func (c *MailRuCloud) Rename(src, targetName string) (err error)
- func (c *MailRuCloud) Stat(path string) (finfo *FileList, err error)
- func (c *MailRuCloud) Upload(src, dst string, ch chan<- int) (err error)
- func (c *MailRuCloud) UploadFilePart(file *os.File, src, dst string, start, end int64, ch chan<- int) (err error)
- type ShardInfo
- type ShardItem
Constants ¶
const MaxFileSize = 2*1024*1024*1024 - 1024
mail.ru limits file size to 2GB the current implementation is limited to max int ( 4 bytes ) size of bytes.Buffer which used to send multipart form , 1024 bytes reserved for form data/fields
Variables ¶
var Logger *log.Logger
Functions ¶
Types ¶
type AuthToken ¶
type AuthToken struct { Body struct { Token string } }
AuthToken unmarshal Auth json data.
type FileList ¶
type FileList struct { Email string Body struct { Mtime int Count struct { Folders int Files int } Tree string Name string Grev int Size int Sort struct { Order string Type string } Kind string Rev int Type string Home string Hash string List []ListItem } }
FileList used to unmarshal json information about files in mail.ru cloud.
type ListItem ¶
type ListItem struct { Name string Size int Kind string Type string Home string Hash string Tree string Mtime int Virus_scan string Grev int Rev int Count struct { Folders int Files int } }
ListItem used to unmarshal json information about a file.
type MailRuCloud ¶
type MailRuCloud struct { Client *http.Client AuthToken string Shard struct { Get string Upload string } IoProgress func(int64, interface{}) InitIoProgress func(int64) interface{} }
MailRuCloud holds all information which required for the api operations.
func NewCloud ¶
func NewCloud(user, password, domain string) (*MailRuCloud, error)
NewCloud authenticates with mail.ru and returns a new object associated with user account. domain parameter should be "mail.ru"
func (*MailRuCloud) Cat ¶
func (c *MailRuCloud) Cat(src string) (err error)
Cat file at mail.ru cloud. src is the full file path.
func (*MailRuCloud) Copy ¶
func (c *MailRuCloud) Copy(src, dst string) (err error)
Copy is convenient method to move files at the mail.ru cloud. src and dst should be the full source and destination file paths.
func (*MailRuCloud) CopyA ¶
func (c *MailRuCloud) CopyA(src, targetDir string) (err error)
CopyA method is the direct call to api url. It does not support rename. src is full source file path, targetDir is the directory to copy file to.
func (*MailRuCloud) Get ¶
func (c *MailRuCloud) Get(src, dst string, ch chan<- int) (err error)
Get downloads file from the cloud. src is the full file path in the cloud, dst is the local path to store.
func (*MailRuCloud) GetShardInfo ¶
func (c *MailRuCloud) GetShardInfo() (err error)
GetShardInfo retrives and unmarshal information about get and upload urls. There are many others urls but at now only that 2 are in use.
func (*MailRuCloud) List ¶
func (c *MailRuCloud) List(path string) (list *FileList, err error)
List the files at the mail.ru cloud.
func (*MailRuCloud) Mkdir ¶
func (c *MailRuCloud) Mkdir(path string) (err error)
Mkdir creates directory in the mail.ru cloud
func (*MailRuCloud) Move ¶
func (c *MailRuCloud) Move(src, dst string) (err error)
Move is convenient method to move files in the mail.ru cloud. src and dst should be the full source and destination file paths.
func (*MailRuCloud) MoveA ¶
func (c *MailRuCloud) MoveA(src, targetDir string) (err error)
MoveA method is the direct call to api url. It does not support rename. src is full source file path, targetDir is the directory to move file to.
func (*MailRuCloud) PrintFileList ¶
func (c *MailRuCloud) PrintFileList(path string) (err error)
PrintFileList is a convenient method method to prin files list at the mail.ru cloud.
func (*MailRuCloud) PrintFileStat ¶
func (c *MailRuCloud) PrintFileStat(path string) (err error)
PrintFileStat is a convenient method to print information about a file at mail.ru cloud.
func (*MailRuCloud) Remove ¶
func (c *MailRuCloud) Remove(path string) (err error)
Remove a file at the mail.ru cloud.
func (*MailRuCloud) Rename ¶
func (c *MailRuCloud) Rename(src, targetName string) (err error)
Rename a file at the mail.ru cloud.
func (*MailRuCloud) Stat ¶
func (c *MailRuCloud) Stat(path string) (finfo *FileList, err error)
Stat is a convenient method to get information about a file at mail.ru cloud.
func (*MailRuCloud) Upload ¶
func (c *MailRuCloud) Upload(src, dst string, ch chan<- int) (err error)
Upload is a convenient method to upload files to the mail.ru cloud. src is the local file path dst is the full destination file path ch is a channel to report operation progress. can be nil.