Documentation ¶
Index ¶
- func UnGzipData(input []byte) ([]byte, error)
- type AssignResult
- type ChunkInfo
- type ChunkManifest
- type ClusterStatus
- type DataCenter
- type DataNode
- type Dir
- type File
- type FilePart
- type Filer
- type FilerUploadResult
- type Layout
- type LookupResult
- type Rack
- type SubmitResult
- type SystemStatus
- type Topology
- type UploadResult
- type VolumeLocation
- type VolumeLocations
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UnGzipData ¶
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 ¶
ClusterStatus result of getting status of cluster
type DataCenter ¶
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 ¶
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 ¶
NewFilePart new file path from real file dir
func NewFilePartFromReader ¶
NewFilePartFromReader new file part from file reader. fileName and fileSize must be known
func NewFileParts ¶
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) 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 ¶
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 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 ¶
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