weedo

package module
v0.0.0-...-3059f24 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2017 License: Apache-2.0 Imports: 15 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

View Source
var ErrVolumeLocationNotFound = errors.New("Location not found.")

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(masterAddr string, filerUrls ...string) (*Client, error)

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) Master

func (c *Client) Master() *Master

func (*Client) Volume

func (c *Client) Volume(id, collection, dc string) (*Volume, error)

type DataCenter

type DataCenter struct {
	Free  int
	Max   int
	Id    string
	Racks []Rack
}

type DataNode

type DataNode struct {
	Free      int
	Max       int
	PublicUrl string
	Url       string
	Volumes   int
}

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 Layout

type Layout struct {
	Collection  string   `json:"collection"`
	Replication string   `json:"replication"`
	TTL         string   `json:"ttl"`
	Writables   []uint64 `json:"writables"`
}

type Location

type Location struct {
	Url       string `json:"url"`
	PublicUrl string `json:"publicUrl"`
}

type Master

type Master struct {
	Url string
	// contains filtered or unexported fields
}

func NewMaster

func NewMaster(addr string) (*Master, error)

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) Lookup

func (m *Master) Lookup(volumeId, collection, dc string) (*Volume, error)

Lookup Volume

func (*Master) Status

func (m *Master) Status() (*SystemStatus, 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 Rack

type Rack struct {
	DataNodes []DataNode
	Free      int
	Max       int
	Id        string
}

type SystemStatus

type SystemStatus struct {
	Topology Topology
	Version  string
}

type Topology

type Topology struct {
	DataCenters []DataCenter
	Free        int
	Max         int
	Layouts     []Layout `json:"layouts"`
}

type Volume

type Volume struct {
	Location Location
}

func NewVolume

func NewVolume(l Location) *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) 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
y or Y : Canonical URL