Documentation ¶
Index ¶
Constants ¶
View Source
const (
// Default max connection count of each server.
DefaultMaxConnectionsPerServer = 100
)
Variables ¶
View Source
var NoStorageServerErr = errors.New("no storage available")
Functions ¶
func FilterUploadableInstances ¶
FilterReadonlyInstances gets readonly storage instance.
Types ¶
type ClientAPI ¶
type ClientAPI interface { // SetConfig sets or refresh client server config. SetConfig(config *Config) // Upload uploads file to specific group server. // // If no group provided, it will upload file to a random server. Upload(src io.Reader, length int64, group string, isPrivate bool) (*common.UploadResult, error) // Download downloads a file from server. // // Return error can be common.NoStorageServerErr if there is no server available // // or common.NotFoundErr if the file cannot be found on the servers. Download(fileId string, offset int64, length int64, handler func(body io.Reader, bodyLength int64) error) error DownloadFrom(fileId string, offset int64, length int64, server *common.Server, handler func(body io.Reader, bodyLength int64) error) error // Query queries file's information by fileId. // // Parameter `fileId` must be the pattern of common.FILE_ID_PATTERN Query(fileId string) (*common.FileInfo, error) // SyncInstances synchronizes instances from specific tracker server. SyncInstances(server *common.Server) (map[string]*common.Instance, error) // PushBinlog pushes binlog to tracker server. PushBinlog(server *common.Server, binlogs []common.BingLogDTO) error // SyncBinlog synchronizes binlogs from other storage servers. SyncBinlog(server *common.Server, clientState *common.BinlogQueryDTO) (*common.BinlogQueryResultDTO, error) // SelectStorageServer selects proper storage server. SelectStorageServer(group string, uploadable bool, exclude *list.List) *common.StorageServer }
ClientAPI is godfs APIClient interface.
type Config ¶
type Config struct { MaxConnectionsPerServer uint // limit max connection for each server TrackerServers []*common.Server // tracker servers SynchronizeOnce bool // synchronize with each tracker server only once SynchronizeOnceCallback chan int // attached with `SynchronizeOnce`, for noticing client cli that whether all server is synced. StaticStorageServers []*common.StorageServer // storage servers }
Config is the APIClient config
Click to show internal directories.
Click to hide internal directories.