Documentation
¶
Index ¶
Constants ¶
const ( MetaCellRow = config.SheetMetaCellRow MetaCellCol = config.SheetMetaCellCol )
Variables ¶
This section is empty.
Functions ¶
func DynamicCopy ¶
Types ¶
type CancelledError ¶
type CancelledError struct { }
func (*CancelledError) Error ¶
func (c *CancelledError) Error() string
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(config *ClientConfig) (*Client, error)
func (*Client) Create ¶
Create @para
name(string): the name of the file
@return
f(*File): fd error(error): nil is no error fs.ErrExist: already exist fs.ErrInvalid: wrong para
type ClientConfig ¶ added in v1.0.0
type File ¶
type File struct {
// contains filtered or unexported fields
}
func (*File) Read ¶
Read Request Master to get a list of all Chunks of a file. For each chunk, start a worker goroutine to fetch them, and reassemble them into a complete file.
Sometimes(e.g. due to network delay), client will receive a newer Version from master which is not actually written to DataNode by another client. If so, this function will spin until it success or cancelled by ctx, so ctx is generally necessary. @para
b([]byte): return the read data. It will return partially read data if there are some workers failed.
@return
n(int64): the read size, -1 if error error(error) *UnexpectedStatusError: MasterNode or DataNode returns a unexpected status some other errors returned by rpc *CancelledError: If operations(spin or rpc call) are cancelled by ctx. And only if there is no other errors happened and ctx cancelled, a CancelledError will be returned.
func (*File) ReadAt ¶
ReadAt Sometimes(e.g. due to network delay), client will receive a newer Version from master which is not actually written to DataNode by another client. If so, this function will spin until it success or cancelled by ctx, so ctx is generally necessary.
@para
ctx: context.Context used to cancel operation b: buffer for reading cell row, col
@return
fd(uint64): the fd of the open file status(Status) error(error) *UnexpectedStatusError: MasterNode or DataNode returns a unexpected status some other errors returned by rpc *CancelledError: If operations(spin or rpc call) are cancelled by ctx. And only if there is no other errors happened and ctx cancelled, a CancelledError will be returned.
func (*File) WriteAt ¶
func (f *File) WriteAt(ctx context.Context, b []byte, row uint32, col uint32, padding string) (n int64, err error)
WriteAt Sometimes(e.g. due to network delay), client will receive a newer Version from master which is not actually written to DataNode by another client. If so, this function will spin until it success or cancelled by ctx, so ctx is generally necessary.
@para
@para ctx: context.Context used to cancel operation b: buffer for reading cell padding: padding character used to pad a cell to its maximum size, for LuckySheet file, a " " should be passed in. row, col
@return
fd(uint64): the fd of the open file status(Status) error(error) *UnexpectedStatusError: MasterNode or DataNode returns a unexpected status some other errors returned by rpc *CancelledError: If operations(spin or rpc call) are cancelled by ctx. And only if there is no other errors happened and ctx cancelled, a CancelledError will be returned.
type UnexpectedStatusError ¶
type UnexpectedStatusError struct {
// contains filtered or unexported fields
}
func NewUnexpectedStatusError ¶
func NewUnexpectedStatusError(status fsrpc.Status) *UnexpectedStatusError
func (*UnexpectedStatusError) Error ¶
func (u *UnexpectedStatusError) Error() string
func (*UnexpectedStatusError) Status ¶
func (u *UnexpectedStatusError) Status() fsrpc.Status