Documentation ¶
Index ¶
- Constants
- Variables
- type Seaweed
- func (c *Seaweed) Assign(args url.Values) (result *model.AssignResult, err error)
- func (c *Seaweed) BatchUploadFileParts(files []*model.FilePart, collection string, ttl string) ([]*model.SubmitResult, error)
- func (c *Seaweed) BatchUploadFiles(files []string, collection, ttl string) ([]*model.SubmitResult, error)
- func (c *Seaweed) ClusterStatus() (result *model.ClusterStatus, err error)
- func (c *Seaweed) DeleteChunks(cm *model.ChunkManifest, args url.Values) (err error)
- func (c *Seaweed) DeleteFile(fileID string, args url.Values) (err error)
- func (c *Seaweed) GC(threshold float64) (err error)
- func (c *Seaweed) Grow(count int, collection, replication, dataCenter string) error
- func (c *Seaweed) GrowArgs(args url.Values) (err error)
- func (c *Seaweed) Lookup(volID string, args url.Values) (result *model.LookupResult, err error)
- func (c *Seaweed) LookupFileID(fileID string, args url.Values, readonly bool) (fullURL string, err error)
- func (c *Seaweed) LookupNoCache(volID string, args url.Values) (result *model.LookupResult, err error)
- func (c *Seaweed) LookupServerByFileID(fileID string, args url.Values, readonly bool) (server string, err error)
- func (c *Seaweed) LookupVolumeIDs(volIDs []string) (result map[string]*model.LookupResult, err error)
- func (c *Seaweed) Replace(fileID string, fileReader io.Reader, fileName string, size int64, ...) (err error)
- func (c *Seaweed) ReplaceFile(fileID, filePath string, deleteFirst bool) error
- func (c *Seaweed) ReplaceFilePart(f *model.FilePart, deleteFirst bool) (fileID string, err error)
- func (c *Seaweed) Status() (result *model.SystemStatus, err error)
- func (c *Seaweed) Submit(filePath string, collection, ttl string) (result *model.SubmitResult, err error)
- func (c *Seaweed) SubmitFilePart(f *model.FilePart, args url.Values) (result *model.SubmitResult, err error)
- func (c *Seaweed) Upload(fileReader io.Reader, fileName string, size int64, collection, ttl string) (fp *model.FilePart, fileID string, err error)
- func (c *Seaweed) UploadFile(filePath string, collection, ttl string) (cm *model.ChunkManifest, fp *model.FilePart, fileID string, err error)
- func (c *Seaweed) UploadFilePart(f *model.FilePart) (cm *model.ChunkManifest, fileID string, err error)
Constants ¶
const ( // ParamCollection http param to specify collection which files belong. According to SeaweedFS API. ParamCollection = "collection" // ParamTTL http param to specify time to live. According to SeaweedFS API. ParamTTL = "ttl" // ParamCount http param to specify how many file ids to reserve. According to SeaweedFS API. ParamCount = "count" // ParamAssignReplication http param to assign files with a specific replication type. ParamAssignReplication = "replication" // ParamAssignCount http param to specify how many file ids to reserve. ParamAssignCount = "count" // ParamAssignDataCenter http param to assign a specific data center ParamAssignDataCenter = "dataCenter" // ParamLookupVolumeID http param to specify volume ID for looking up. ParamLookupVolumeID = "volumeId" // ParamLookupPretty http param to make json response prettified or not. Default should not be set. ParamLookupPretty = "pretty" // ParamLookupCollection http param to specify known collection, this would make file look up/search faster. ParamLookupCollection = "collection" // ParamVacuumGarbageThreshold if your system has many deletions, the deleted file's disk space will not be synchronously re-claimed. // There is a background job to check volume disk usage. If empty space is more than the threshold, // default to 0.3, the vacuum job will make the volume readonly, create a new volume with only existing files, // and switch on the new volume. If you are impatient or doing some testing, vacuum the unused spaces this way. ParamVacuumGarbageThreshold = "GarbageThreshold" // ParamGrowReplication http param to specify a specific replication. ParamGrowReplication = "replication" // ParamGrowCount http param to specify number of empty volume to grow. ParamGrowCount = "count" // ParamGrowDataCenter http param to specify datacenter of growing volume. ParamGrowDataCenter = "dataCenter" // ParamGrowCollection http param to specify collection of files for growing. ParamGrowCollection = "collection" // ParamGrowTTL specify time to live for growing api. Refers to: https://github.com/chrislusf/seaweedfs/wiki/Store-file-with-a-Time-To-Live // 3m: 3 minutes // 4h: 4 hours // 5d: 5 days // 6w: 6 weeks // 7M: 7 months // 8y: 8 years ParamGrowTTL = "ttl" )
Variables ¶
var ( // ErrFileNotFound return file not found error ErrFileNotFound = fmt.Errorf("File not found") )
Functions ¶
This section is empty.
Types ¶
type Seaweed ¶
type Seaweed struct { Master string Filers []*model.Filer Scheme string ChunkSize int64 HTTPClient *libs.HTTPClient // contains filtered or unexported fields }
Seaweed client containing almost features/operations to interact with SeaweedFS
func NewSeaweed ¶
func NewSeaweed(scheme string, master string, filers []string, chunkSize int64, timeout time.Duration) *Seaweed
NewSeaweed create new seaweed with default
func (*Seaweed) BatchUploadFileParts ¶
func (c *Seaweed) BatchUploadFileParts(files []*model.FilePart, collection string, ttl string) ([]*model.SubmitResult, error)
BatchUploadFileParts upload multiple file parts at once
func (*Seaweed) BatchUploadFiles ¶
func (c *Seaweed) BatchUploadFiles(files []string, collection, ttl string) ([]*model.SubmitResult, error)
BatchUploadFiles batch upload files
func (*Seaweed) ClusterStatus ¶
func (c *Seaweed) ClusterStatus() (result *model.ClusterStatus, err error)
ClusterStatus get cluster status
func (*Seaweed) DeleteChunks ¶
DeleteChunks concurrently delete chunks
func (*Seaweed) DeleteFile ¶
DeleteFile delete file by fileID
func (*Seaweed) LookupFileID ¶
func (c *Seaweed) LookupFileID(fileID string, args url.Values, readonly bool) (fullURL string, err error)
LookupFileID lookup file by id
func (*Seaweed) LookupNoCache ¶
func (c *Seaweed) LookupNoCache(volID string, args url.Values) (result *model.LookupResult, err error)
LookupNoCache lookup by volume id without get from caching first, but set cache in the end of process.
func (*Seaweed) LookupServerByFileID ¶
func (c *Seaweed) LookupServerByFileID(fileID string, args url.Values, readonly bool) (server string, err error)
LookupServerByFileID lookup server by fileID
func (*Seaweed) LookupVolumeIDs ¶
func (c *Seaweed) LookupVolumeIDs(volIDs []string) (result map[string]*model.LookupResult, err error)
LookupVolumeIDs find volume locations by cache and actual lookup
func (*Seaweed) Replace ¶
func (c *Seaweed) Replace(fileID string, fileReader io.Reader, fileName string, size int64, collection, ttl string, deleteFirst bool) (err error)
Replace with file reader
func (*Seaweed) ReplaceFile ¶
ReplaceFile replace file by fileID with local filePath
func (*Seaweed) ReplaceFilePart ¶
ReplaceFilePart replace file part
func (*Seaweed) Status ¶
func (c *Seaweed) Status() (result *model.SystemStatus, err error)
Status check System Status
func (*Seaweed) Submit ¶
func (c *Seaweed) Submit(filePath string, collection, ttl string) (result *model.SubmitResult, err error)
Submit file directly to master
func (*Seaweed) SubmitFilePart ¶
func (c *Seaweed) SubmitFilePart(f *model.FilePart, args url.Values) (result *model.SubmitResult, err error)
SubmitFilePart directly to master
func (*Seaweed) Upload ¶
func (c *Seaweed) Upload(fileReader io.Reader, fileName string, size int64, collection, ttl string) (fp *model.FilePart, fileID string, err error)
Upload file by reader
func (*Seaweed) UploadFile ¶
func (c *Seaweed) UploadFile(filePath string, collection, ttl string) (cm *model.ChunkManifest, fp *model.FilePart, fileID string, err error)
UploadFile upload file with full file dir/path
func (*Seaweed) UploadFilePart ¶
func (c *Seaweed) UploadFilePart(f *model.FilePart) (cm *model.ChunkManifest, fileID string, err error)
UploadFilePart upload a file part