Documentation ¶
Index ¶
- func NewAppHandler(cfg AppConfig) *rpc.Router
- func NewFileHandler() *rpc.Router
- func NewMetaHandler() *rpc.Router
- type AppConfig
- type ArgsDelete
- type ArgsDownload
- type ArgsExist
- type ArgsRead
- type ArgsURIOptional
- type ArgsUpdate
- type ArgsUpload
- type ArgsWrite
- type Client
- type FileApp
- type Filer
- type LBConfig
- type Mode
- type RespStat
- type SimpleConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAppHandler ¶
NewAppHandler returns app server handler, use rpc.DefaultRouter
Types ¶
type AppConfig ¶
type AppConfig struct { MaxFiles int `json:"max_files"` SimpleConfig SimpleConfig `json:"simple_config"` LBConfig LBConfig `json:"lb_config"` }
AppConfig app configure
type ArgsDelete ¶
ArgsDelete args delete args in query string, the key in getter is lowercase of field name
type ArgsDownload ¶
type ArgsDownload struct { Name string `form:"name"` Mode Mode `form:"mode"` Offset int `formx:"offset,omitempty" flag:"xxx"` Read int `formx:"read,omitempty" flag:"vvv"` }
ArgsDownload args download you can define mulits tag on fields, but need to specify tag name's order in RegisterArgsParser
type ArgsURIOptional ¶
type ArgsURIOptional struct { Require string `json:"require"` Option string `json:"option,omitempty"` }
ArgsURIOptional argument in uri with omitempty
type ArgsUpdate ¶
ArgsUpdate args update args in body, you can implement rpc.Unmarshaler to unmarshal
type ArgsUpload ¶
type ArgsUpload struct { Name string `flag:"name"` // required Size int `flag:"size"` // required Mode Mode `flag:"mode"` // required Desc []byte `flag:"desc,base64"` // required, base64 urlencode string Nothing interface{} `flag:"-"` // ignored }
ArgsUpload args upload you should register the args to rpc, cos field name in tag
type Client ¶
type Client interface { Write(context.Context, int, io.Reader) error Read(context.Context, int) (io.ReadCloser, error) }
Client read and write client
func NewFileClient ¶
func NewFileClient(conf *SimpleConfig) Client
NewFileClient returns file client
type FileApp ¶
type FileApp interface { Upload(*rpc.Context) Update(*rpc.Context) Delete(*rpc.Context) Download(*rpc.Context) Stream(*rpc.Context) Exist(*rpc.Context) Stat(*rpc.Context) List(*rpc.Context) OptionalArgs(*rpc.Context) }
FileApp app handlers
type RespStat ¶
type RespStat struct { Name string `json:"name"` Size int `json:"size"` Mode Mode Desc []byte `json:"desc"` Ctime int64 Mtime int64 Meta map[string]string }
RespStat args stat, use json tag
type SimpleConfig ¶
SimpleConfig simple client config