model

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnGzipData

func UnGzipData(input []byte) ([]byte, error)

UnGzipData unzip data in form of stream/bytes

Types

type AssignResult

type AssignResult struct {
	FileID    string `json:"fid,omitempty"`
	URL       string `json:"url,omitempty"`
	PublicURL string `json:"publicUrl,omitempty"`
	Count     uint64 `json:"count,omitempty"`
	Error     string `json:"error,omitempty"`
}

AssignResult contains assign result. Raw response: {"fid":"1,0a1653fd0f","url":"localhost:8899","publicUrl":"localhost:8899","count":1,"error":""}

type ChunkInfo

type ChunkInfo struct {
	Fid    string `json:"fid"`
	Offset int64  `json:"offset"`
	Size   int64  `json:"size"`
}

ChunkInfo chunk information. According to https://github.com/chrislusf/seaweedfs/wiki/Large-File-Handling.

type ChunkManifest

type ChunkManifest struct {
	Name   string       `json:"name,omitempty"`
	Mime   string       `json:"mime,omitempty"`
	Size   int64        `json:"size,omitempty"`
	Chunks []*ChunkInfo `json:"chunks,omitempty"`
}

ChunkManifest chunk manifest. According to https://github.com/chrislusf/seaweedfs/wiki/Large-File-Handling.

func LoadChunkManifest

func LoadChunkManifest(buffer []byte, isGzipped bool) (*ChunkManifest, error)

LoadChunkManifest load chunk manifest from bytes, support gzipped bytes

func (*ChunkManifest) Marshal

func (c *ChunkManifest) Marshal() ([]byte, error)

Marshal marshal whole chunk manifest

type ClusterStatus

type ClusterStatus struct {
	IsLeader bool
	Leader   string
	Peers    []string
}

ClusterStatus result of getting status of cluster

type DataCenter

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

DataCenter stats of a datacenter

type DataNode

type DataNode struct {
	Free      int
	Max       int
	PublicURL string `json:"PublicUrl"`
	URL       string `json:"Url"`
	Volumes   int
}

DataNode stats of data node

type Dir

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

Dir directory of filer. According to https://github.com/chrislusf/seaweedfs/wiki/Filer-Server-API.

type File

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

File structure according to filer API at https://github.com/chrislusf/seaweedfs/wiki/Filer-Server-API.

type FilePart

type FilePart struct {
	Reader     io.Reader
	FileName   string
	FileSize   int64
	IsGzipped  bool
	MimeType   string
	ModTime    int64 //in seconds
	Collection string

	// TTL Time to live.
	// 3m: 3 minutes
	// 4h: 4 hours
	// 5d: 5 days
	// 6w: 6 weeks
	// 7M: 7 months
	// 8y: 8 years
	TTL string

	Server string
	FileID string
}

FilePart file wrapper with reader and some metadata

func NewFilePart

func NewFilePart(fullPathFilename string) (*FilePart, error)

NewFilePart new file path from real file dir

func NewFilePartFromReader

func NewFilePartFromReader(reader io.Reader, fileName string, fileSize int64) *FilePart

NewFilePartFromReader new file part from file reader. fileName and fileSize must be known

func NewFileParts

func NewFileParts(fullPathFilenames []string) (ret []*FilePart, err error)

NewFileParts create many file part at once.

type Filer

type Filer struct {
	URL        string `json:"url"`
	HTTPClient *libs.HTTPClient
}

Filer client

func NewFiler

func NewFiler(url string, httpClient *libs.HTTPClient) *Filer

NewFiler new filer with filer server's url

func (*Filer) Delete

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

Delete a file/dir

func (*Filer) Dir

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

Dir list in directory

func (*Filer) UploadFile

func (f *Filer) UploadFile(filePath, newFilerPath, collection, ttl string) (result *FilerUploadResult, err error)

UploadFile a file

type FilerUploadResult

type FilerUploadResult struct {
	Name    string `json:"name,omitempty"`
	FileURL string `json:"url,omitempty"`
	FileID  string `json:"fid,omitempty"`
	Size    int64  `json:"size,omitempty"`
	Error   string `json:"error,omitempty"`
}

FilerUploadResult upload result which responsed from filer server. According to https://github.com/chrislusf/seaweedfs/wiki/Filer-Server-API.

type Layout

type Layout struct {
	Replication string
	Writables   []uint64
}

Layout of replication/collection stats. According to https://github.com/chrislusf/seaweedfs/wiki/Master-Server-API

type LookupResult

type LookupResult struct {
	VolumeID        string          `json:"volumeId,omitempty"`
	VolumeLocations VolumeLocations `json:"locations,omitempty"`
	Error           string          `json:"error,omitempty"`
}

LookupResult the result of looking up volume. According to https://github.com/chrislusf/seaweedfs/wiki/Master-Server-API

type Rack

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

Rack stats of racks

type SubmitResult

type SubmitResult struct {
	FileName string `json:"fileName,omitempty"`
	FileURL  string `json:"fileUrl,omitempty"`
	FileID   string `json:"fid,omitempty"`
	Size     int64  `json:"size,omitempty"`
	Error    string `json:"error,omitempty"`
}

SubmitResult result of submit operation.

type SystemStatus

type SystemStatus struct {
	Topology Topology
	Version  string
	Error    string
}

SystemStatus result of getting status of system

type Topology

type Topology struct {
	DataCenters []*DataCenter
	Free        int
	Max         int
	Layouts     []*Layout
}

Topology result of topology stats request

type UploadResult

type UploadResult struct {
	Name  string `json:"name,omitempty"`
	Size  int64  `json:"size,omitempty"`
	Error string `json:"error,omitempty"`
}

UploadResult contains upload result after put file to SeaweedFS Raw response: {"name":"go1.8.3.linux-amd64.tar.gz","size":82565628,"error":""}

type VolumeLocation

type VolumeLocation struct {
	URL       string `json:"url,omitempty"`
	PublicURL string `json:"publicUrl,omitempty"`
}

VolumeLocation location of volume responsed from master API. According to https://github.com/chrislusf/seaweedfs/wiki/Master-Server-API

type VolumeLocations

type VolumeLocations []*VolumeLocation

VolumeLocations returned VolumeLocations (volumes)

func (VolumeLocations) Head

func (c VolumeLocations) Head() *VolumeLocation

Head get first location in list

func (VolumeLocations) RandomPickForRead

func (c VolumeLocations) RandomPickForRead() *VolumeLocation

RandomPickForRead random pick a location for further read request

Jump to

Keyboard shortcuts

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