rs

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2020 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DATA_SHARDS     = 4
	PARITY_SHARDS   = 2
	ALL_SHARDS      = DATA_SHARDS + PARITY_SHARDS
	BLOCK_PER_SHARD = 8 * 1 << 10
	BLOCK_SIZE      = BLOCK_PER_SHARD * DATA_SHARDS
)

Variables

This section is empty.

Functions

func NewDecoder

func NewDecoder(readers []io.Reader, writers []io.Writer, size int64) *decoder

func NewEncoder

func NewEncoder(writers []io.Writer) *encoder

Types

type RSGetStream

type RSGetStream struct {
	// contains filtered or unexported fields
}

func NewRSGetStream

func NewRSGetStream(locateInfo map[int]string, dataServers []string, hash string, size int64) (*RSGetStream, error)

func (*RSGetStream) Close

func (s *RSGetStream) Close()

func (RSGetStream) Read

func (d RSGetStream) Read(p []byte) (n int, err error)

func (*RSGetStream) Seek added in v0.3.0

func (s *RSGetStream) Seek(offset int64, whence int) (int64, error)

return 1, 0 为正常

type RSPutStream

type RSPutStream struct {
	// contains filtered or unexported fields
}

func NewRSPutStream

func NewRSPutStream(dataServers []string, hash string, size int64) (*RSPutStream, error)

func (*RSPutStream) Commit

func (s *RSPutStream) Commit(success bool)

func (RSPutStream) Flush

func (e RSPutStream) Flush()

func (RSPutStream) Write

func (e RSPutStream) Write(p []byte) (n int, err error)

type RSResumableGetStream added in v0.3.0

type RSResumableGetStream struct {
	// contains filtered or unexported fields
}

func NewRSResumableGetStream added in v0.3.0

func NewRSResumableGetStream(dataServers []string, uuids []string, size int64) (*RSResumableGetStream, error)

func (RSResumableGetStream) Read added in v0.3.0

func (d RSResumableGetStream) Read(p []byte) (n int, err error)

type RSResumablePutStream added in v0.3.0

type RSResumablePutStream struct {
	*RSPutStream
	// contains filtered or unexported fields
}

func NewRSResumablePutStream added in v0.3.0

func NewRSResumablePutStream(dataServers []string, name, hash string, size int64) (*RSResumablePutStream, error)

func NewRSResumablePutStreamFromToken added in v0.3.0

func NewRSResumablePutStreamFromToken(token string) (*RSResumablePutStream, error)

func (*RSResumablePutStream) CurrentSize added in v0.3.0

func (s *RSResumablePutStream) CurrentSize() int64

返回第一个临时分片的大小*4, 若超出文件大小,则返回文件大小

func (RSResumablePutStream) Flush added in v0.3.0

func (e RSResumablePutStream) Flush()

func (*RSResumablePutStream) ToToken added in v0.3.0

func (s *RSResumablePutStream) ToToken() string

func (RSResumablePutStream) Write added in v0.3.0

func (e RSResumablePutStream) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL