Documentation
¶
Index ¶
- Variables
- func FileUploader(path string, token *StreamToken, pieceSize int64, ...) error
- func TokenWriter(reader io.Reader, token *StreamToken, pieceSize int64, ...) (err error)
- type Conn4RPC
- func (c *Conn4RPC) DoLogin() error
- func (c *Conn4RPC) DoRPC(method string, args interface{}, reply interface{}) (err error)
- func (c *Conn4RPC) GetAccessKey() (string, error)
- func (c *Conn4RPC) GetClient() (IRPCClient, error)
- func (c *Conn4RPC) GetSecretKey() (string, error)
- func (c *Conn4RPC) GetUser() string
- type CopyNodeBo
- type CreateUserBo
- type DataStream
- func (s *DataStream) DoReadToken(nodeNo, token, endpoint string, offset int64) (r io.ReadCloser, err error)
- func (s *DataStream) DoWriteToken(nodeNo, token, endpoint string, pieceNumber int, sha256 string, ...) (err error)
- func (s *DataStream) GetNodeStreamAddr(nodeNo string, endpoint string) (string, error)
- func (s *DataStream) GetReadStreamURL(nodeNo, token, endpoint string) (string, error)
- func (s *DataStream) GetWriteStreamURL(nodeNo, token, endpoint string) (string, error)
- func (s *DataStream) SetNodeStreamAddr(nodes map[string]string)
- type DirNameListDto
- type DirNodeListDto
- type IConn4RPC
- type IOpenApi
- type IRPCClient
- type IServerMG
- type LimitQueryBo
- type LimitedReader
- type MoveNodeBo
- type OpenSdkImpl
- func (s *OpenSdkImpl) ConnTest(user User) error
- func (s *OpenSdkImpl) DoAskReadToken(src string) (*StreamToken, error)
- func (s *OpenSdkImpl) DoAskWriteToken(src string) (*StreamToken, error)
- func (s *OpenSdkImpl) DoCopy(src, dst string, override bool) (string, error)
- func (s *OpenSdkImpl) DoDelete(src string) error
- func (s *OpenSdkImpl) DoMkDir(path string) (string, error)
- func (s *OpenSdkImpl) DoMove(src, dst string, override bool) error
- func (s *OpenSdkImpl) DoQueryToken(token string) (*StreamToken, error)
- func (s *OpenSdkImpl) DoReadToken(nodeNo, token, endpoint string, offset int64) (io.ReadCloser, error)
- func (s *OpenSdkImpl) DoRefreshToken(token string) (*StreamToken, error)
- func (s *OpenSdkImpl) DoRename(src string, dst string) error
- func (s *OpenSdkImpl) DoSubmitWriteToken(token string, override bool) (node *TNode, err error)
- func (s *OpenSdkImpl) DoWriteToken(nodeNo, token, endpoint string, pieceNumber int, sha256 string, ...) (err error)
- func (s *OpenSdkImpl) GetDirNameList(src string, limit, offset int) (*DirNameListDto, error)
- func (s *OpenSdkImpl) GetDirNodeList(src string, limit, offset int) (*DirNodeListDto, error)
- func (s *OpenSdkImpl) GetFileSize(src string) (int64, error)
- func (s *OpenSdkImpl) GetNode(src string) (*TNode, error)
- func (s *OpenSdkImpl) GetNodes(src []string) ([]TNode, error)
- func (s *OpenSdkImpl) GetReadStreamURL(nodeNo, token, endpoint string) (string, error)
- func (s *OpenSdkImpl) GetWriteStreamURL(nodeNo, token, endpoint string) (string, error)
- func (s *OpenSdkImpl) IsDir(src string) (bool, error)
- func (s *OpenSdkImpl) IsExist(src string) (bool, error)
- func (s *OpenSdkImpl) IsFile(src string) (bool, error)
- func (s *OpenSdkImpl) SetDataNodeDNS(nodes map[string]string)
- type PwdUpdateBo
- type RPCClient
- type RequestBody
- type ServerMgSdkImpl
- func (s *ServerMgSdkImpl) ConnTest(user User) error
- func (s *ServerMgSdkImpl) DoCreateUser(user CreateUserBo) (bool, error)
- func (s *ServerMgSdkImpl) DoDeleteUser(userID string) (bool, error)
- func (s *ServerMgSdkImpl) DoListAllUsers() (*UserListDto, error)
- func (s *ServerMgSdkImpl) DoUpdatePWD(user, pwd string) (bool, error)
- type Session
- type SrcAndDstBo
- type StreamToken
- type StreamTokenType
- type TNode
- type User
- type UserInfo
- type UserListDto
- type WriteTokenBo
Constants ¶
This section is empty.
Variables ¶
var ErrorAuthentication = errors.New("authentication failed")
Functions ¶
func FileUploader ¶
func FileUploader(path string, token *StreamToken, pieceSize int64, doWriteToken doWriteTokenFunc) error
FileUploader FileUploader
func TokenWriter ¶
func TokenWriter(reader io.Reader, token *StreamToken, pieceSize int64, doWriteToken doWriteTokenFunc) (err error)
TokenWriter TokenWriter
Types ¶
type Conn4RPC ¶
type Conn4RPC struct {
// contains filtered or unexported fields
}
Conn4RPC Conn4RPC
func (*Conn4RPC) DoLogin ¶
DoLogin 登录一下, 获取 Data={"AccessKey":"e194244b-1683-cb4c-98a9-a79e43fe1576","SecretKey":"e194244b-1683-cb4c-98a9-a05f6ef420d2"}
func (*Conn4RPC) GetAccessKey ¶
GetAccessKey 获取accessKey, 为空则自动登录一下
func (*Conn4RPC) GetClient ¶
func (c *Conn4RPC) GetClient() (IRPCClient, error)
GetClient 获取一个空闲的客户端
func (*Conn4RPC) GetSecretKey ¶
GetSecretKey 获取 secretKey
type CreateUserBo ¶
CreateUserBo 用户表存储的结构
type DataStream ¶
type DataStream struct {
// contains filtered or unexported fields
}
DataStream DataStream
func (*DataStream) DoReadToken ¶
func (s *DataStream) DoReadToken(nodeNo, token, endpoint string, offset int64) (r io.ReadCloser, err error)
DoReadToken /stream/read/tokenxxxx
func (*DataStream) DoWriteToken ¶
func (s *DataStream) DoWriteToken(nodeNo, token, endpoint string, pieceNumber int, sha256 string, reader io.Reader) (err error)
DoWriteToken /stream/put/tokenxxxx
func (*DataStream) GetNodeStreamAddr ¶
func (s *DataStream) GetNodeStreamAddr(nodeNo string, endpoint string) (string, error)
GetNodeStreamAddr 获取nodeNo的地址映射
func (*DataStream) GetReadStreamURL ¶
func (s *DataStream) GetReadStreamURL(nodeNo, token, endpoint string) (string, error)
GetReadStreamURL 获取下载url
func (*DataStream) GetWriteStreamURL ¶
func (s *DataStream) GetWriteStreamURL(nodeNo, token, endpoint string) (string, error)
GetWriteStreamURL 获取上传url
func (*DataStream) SetNodeStreamAddr ¶
func (s *DataStream) SetNodeStreamAddr(nodes map[string]string)
SetNodeStreamAddr 设置nodeNo的地址映射
type DirNameListDto ¶
DirNameListDto 文件夹目录列表
type IConn4RPC ¶
type IConn4RPC interface { GetAccessKey() (string, error) GetClient() (IRPCClient, error) DoRPC(method string, args interface{}, reply interface{}) error }
IConn4RPC RPC连接会话
type IOpenApi ¶
type IOpenApi interface { ConnTest(user User) error IsDir(src string) (bool, error) IsFile(src string) (bool, error) IsExist(src string) (bool, error) GetFileSize(src string) (int64, error) GetNode(src string) (*TNode, error) GetNodes(src []string) ([]TNode, error) GetDirNameList(src string, limit, offset int) (*DirNameListDto, error) GetDirNodeList(src string, limit, offset int) (*DirNodeListDto, error) DoMkDir(path string) (string, error) DoDelete(src string) error DoRename(src string, dst string) error DoCopy(src, dst string, override bool) (string, error) DoMove(src, dst string, override bool) error DoQueryToken(token string) (*StreamToken, error) DoAskReadToken(src string) (*StreamToken, error) DoAskWriteToken(src string) (*StreamToken, error) DoRefreshToken(token string) (*StreamToken, error) DoSubmitWriteToken(token string, override bool) (*TNode, error) SetDataNodeDNS(nodes map[string]string) GetReadStreamURL(nodeNo, token, endpoint string) (string, error) GetWriteStreamURL(nodeNo, token, endpoint string) (string, error) DoWriteToken(nodeNo, token, endpoint string, pieceNumber int, sha256 string, reader io.Reader) error DoReadToken(nodeNo, token, endpoint string, offset int64) (io.ReadCloser, error) }
IOpenApi 开放api
type IRPCClient ¶
type IRPCClient interface { Close() error Call(serviceMethod string, args interface{}, reply interface{}) error }
IRPCClient RPC发起接口
type IServerMG ¶
type IServerMG interface { ConnTest(user User) error DoCreateUser(user CreateUserBo) (bool, error) DoUpdatePWD(user, pwd string) (bool, error) DoDeleteUser(userID string) (bool, error) DoListAllUsers() (*UserListDto, error) }
IServerMG 管理类接口
func NewSvrMngApi ¶
NewSvrMngApi 服务器管理接口, 如: 用户管理
type LimitQueryBo ¶
LimitQueryBo 分页查询
type LimitedReader ¶
type LimitedReader struct {
// contains filtered or unexported fields
}
func NewLimitedReader ¶
func NewLimitedReader(r io.Reader, n int64) *LimitedReader
NewLimitedReader NewLimitedReader
func (*LimitedReader) Next ¶
func (l *LimitedReader) Next() (bool, error)
type OpenSdkImpl ¶
type OpenSdkImpl struct {
// contains filtered or unexported fields
}
OpenSdkImpl 开放api接口
func (*OpenSdkImpl) DoAskReadToken ¶
func (s *OpenSdkImpl) DoAskReadToken(src string) (*StreamToken, error)
func (*OpenSdkImpl) DoAskWriteToken ¶
func (s *OpenSdkImpl) DoAskWriteToken(src string) (*StreamToken, error)
func (*OpenSdkImpl) DoCopy ¶
func (s *OpenSdkImpl) DoCopy(src, dst string, override bool) (string, error)
func (*OpenSdkImpl) DoDelete ¶
func (s *OpenSdkImpl) DoDelete(src string) error
func (*OpenSdkImpl) DoQueryToken ¶
func (s *OpenSdkImpl) DoQueryToken(token string) (*StreamToken, error)
func (*OpenSdkImpl) DoReadToken ¶
func (s *OpenSdkImpl) DoReadToken(nodeNo, token, endpoint string, offset int64) (io.ReadCloser, error)
func (*OpenSdkImpl) DoRefreshToken ¶
func (s *OpenSdkImpl) DoRefreshToken(token string) (*StreamToken, error)
func (*OpenSdkImpl) DoSubmitWriteToken ¶
func (s *OpenSdkImpl) DoSubmitWriteToken(token string, override bool) (node *TNode, err error)
func (*OpenSdkImpl) DoWriteToken ¶
func (*OpenSdkImpl) GetDirNameList ¶
func (s *OpenSdkImpl) GetDirNameList(src string, limit, offset int) (*DirNameListDto, error)
func (*OpenSdkImpl) GetDirNodeList ¶
func (s *OpenSdkImpl) GetDirNodeList(src string, limit, offset int) (*DirNodeListDto, error)
func (*OpenSdkImpl) GetFileSize ¶
func (s *OpenSdkImpl) GetFileSize(src string) (int64, error)
func (*OpenSdkImpl) GetReadStreamURL ¶
func (s *OpenSdkImpl) GetReadStreamURL(nodeNo, token, endpoint string) (string, error)
func (*OpenSdkImpl) GetWriteStreamURL ¶
func (s *OpenSdkImpl) GetWriteStreamURL(nodeNo, token, endpoint string) (string, error)
func (*OpenSdkImpl) SetDataNodeDNS ¶
func (s *OpenSdkImpl) SetDataNodeDNS(nodes map[string]string)
type RequestBody ¶
RequestBody RPC请求体
type ServerMgSdkImpl ¶
type ServerMgSdkImpl struct {
// contains filtered or unexported fields
}
ServerMgSdkImpl 开发api接口
func (*ServerMgSdkImpl) ConnTest ¶
func (s *ServerMgSdkImpl) ConnTest(user User) error
ConnTest ConnTest
func (*ServerMgSdkImpl) DoCreateUser ¶
func (s *ServerMgSdkImpl) DoCreateUser(user CreateUserBo) (bool, error)
func (*ServerMgSdkImpl) DoDeleteUser ¶
func (s *ServerMgSdkImpl) DoDeleteUser(userID string) (bool, error)
func (*ServerMgSdkImpl) DoListAllUsers ¶
func (s *ServerMgSdkImpl) DoListAllUsers() (*UserListDto, error)
func (*ServerMgSdkImpl) DoUpdatePWD ¶
func (s *ServerMgSdkImpl) DoUpdatePWD(user, pwd string) (bool, error)
type StreamToken ¶
type StreamToken struct { Token string NodeNo string FileID string FilePath string FileSize int64 CTime int64 MTime int64 EndPoint string Type StreamTokenType }
StreamToken 流操作Token
type TNode ¶
type TNode struct { Id string Pid string Addr string Flag int Name string Size int64 Ctime int64 Mtime int64 Props string }
TNode 元数据内容(filenames)
type WriteTokenBo ¶
WriteTokenBo 文件上传递交token