weedo

package module
Version: v0.0.0-...-6239f70 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2017 License: Apache-2.0 Imports: 14 Imported by: 0

README

weedo

a weed-fs client written in golang

Documentation

Overview

filer

weed master

weed volume

weedo.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssignUpload

func AssignUpload(filename, mimeType string, file io.Reader) (fid string, size int64, err error)

First, contact with master server and assign a fid, then upload to volume server It is same as the follow steps curl http://localhost:9333/dir/assign curl -F file=@example.jpg http://127.0.0.1:8080/3,01637037d6

func AssignUploadArgs

func AssignUploadArgs(filename, mimeType string, file io.Reader, args url.Values) (fid string, size int64, err error)

func Delete

func Delete(fid string, count int) (err error)

Types

type Client

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

func NewClient

func NewClient(masterUrl string, filerUrls ...string) *Client

func (*Client) AssignUpload

func (c *Client) AssignUpload(filename, mimeType string, file io.Reader) (fid string, size int64, err error)

func (*Client) AssignUploadArgs

func (c *Client) AssignUploadArgs(filename, mimeType string, file io.Reader, args url.Values) (fid string, size int64, err error)

func (*Client) Delete

func (c *Client) Delete(fid string, count int, collection ...string) (err error)

func (*Client) Filer

func (c *Client) Filer(url string) *Filer

func (*Client) GetUrl

func (c *Client) GetUrl(fid string, collection ...string) (publicUrl, url string, err error)

func (*Client) GetUrls

func (c *Client) GetUrls(fid string, collection ...string) (locations []Location, err error)

func (*Client) Master

func (c *Client) Master() *Master

func (*Client) Volume

func (c *Client) Volume(volumeId, collection string) (*Volume, error)

type Dir

type Dir struct {
	Path    string `json:"Directory"`
	Files   []*File
	Subdirs []*File `json:"Subdirectories"`
}

func (Dir) String

func (dir Dir) String() string

type Fid

type Fid struct {
	Id, Key, Cookie uint64
}

func ParseFid

func ParseFid(s string) (fid Fid, err error)

type File

type File struct {
	Id   string `json:"fid"`
	Name string `json:"name"`
}

type Filer

type Filer struct {
	Url string
}

func NewFiler

func NewFiler(url string) *Filer

func (*Filer) Delete

func (f *Filer) Delete(pathname string) error

func (*Filer) Dir

func (f *Filer) Dir(pathname string) (*Dir, error)

func (*Filer) Upload

func (f *Filer) Upload(pathname string, mimeType string, file io.Reader) error

type Location

type Location struct {
	Url       string
	PublicUrl string
}

type Master

type Master struct {
	Url string
}

func NewMaster

func NewMaster(addr string) *Master

func (*Master) Assign

func (m *Master) Assign() (string, error)

Assign a file key

func (*Master) AssignArgs

func (m *Master) AssignArgs(args url.Values) (fid string, err error)

v0.4 or later only

func (*Master) AssignN

func (m *Master) AssignN(count int) (fid string, err error)

Assign multi file keys

func (*Master) GC

func (m *Master) GC(threshold float64) error

Force Garbage Collection

func (*Master) Grow

func (m *Master) Grow(count int, collection, replication, dataCenter string) error

Pre-Allocate Volumes

func (*Master) GrowArgs

func (m *Master) GrowArgs(args url.Values) error

v0.4 or later only

func (*Master) Status

func (m *Master) Status() (err error)

Check System Status

func (*Master) Submit

func (m *Master) Submit(filename, mimeType string, file io.Reader) (fid string, size int64, err error)

func (*Master) SubmitArgs

func (m *Master) SubmitArgs(filename, mimeType string, file io.Reader, args url.Values) (fid string, size int64, err error)

Upload File Directly

type Volume

type Volume struct {
	Locations []Location
	// contains filtered or unexported fields
}

func NewVolume

func NewVolume(locations []Location, idx int) *Volume

func (*Volume) AssignVolume

func (v *Volume) AssignVolume(volumeId uint64, replica string) error

func (*Volume) Delete

func (v *Volume) Delete(fid string, count int) (err error)

Delete File

func (*Volume) PublicUrl

func (v *Volume) PublicUrl() string

func (*Volume) Status

func (v *Volume) Status() (err error)

Check Volume Server Status

func (*Volume) Submit

func (v *Volume) Submit(filename, mimeType string, file io.Reader) (fid string, size int64, err error)

Upload File Directly

func (*Volume) Upload

func (v *Volume) Upload(fid string, version int, filename, mimeType string, file io.Reader) (size int64, err error)

Upload File

func (*Volume) Url

func (v *Volume) Url() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL