weedo

package module
v0.0.0-...-b52dbaa Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2015 License: Apache-2.0 Imports: 17 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 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) AssignUploadTK

func (c *Client) AssignUploadTK(filename string, r io.Reader, fileSize int) (fid string, err error)

uinsg time/cookie as Fid

func (*Client) Delete

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

func (*Client) Filer

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

func (*Client) GetUrl

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

func (*Client) Master

func (c *Client) Master() *Master

func (*Client) UploadFileTK

func (c *Client) UploadFileTK(fullPath string) (fid string, err error)

Assign Fid using timekey.Fid

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)

func (*Fid) String

func (f *Fid) String() string

Fid in string form

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 Master

type Master struct {
	Url string
}

func NewMaster

func NewMaster(url string) *Master

func (*Master) Assign

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

Assign a file key

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, replica, dataCenter string) error

Pre-Allocate Volumes

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)

Upload File Directly

type Volume

type Volume struct {
	Url       string
	PublicUrl string
}

func NewVolume

func NewVolume(url, publicUrl string) *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) Status

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

Check Volume Server Status

func (*Volume) Upload

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

Upload File

Directories

Path Synopsis
cmd
Package timekey implements a customized Fid to get/set time/mime/size info in fid for seaweedfs
Package timekey implements a customized Fid to get/set time/mime/size info in fid for seaweedfs

Jump to

Keyboard shortcuts

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