pieceerror

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrHandlerChanSize = 100
	HandleErrorPool    = 4
	GCHandlingInterval = 1 * time.Second
	GCHandlingDelay    = 3 * time.Second
)

Variables

This section is empty.

Functions

func Register

func Register(errType string, initer handlerInitFunc)

Types

type FileMd5NotMatchHandler

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

func (*FileMd5NotMatchHandler) Handle

func (fnmh *FileMd5NotMatchHandler) Handle(ctx context.Context, pieceErrorRequest *types.PieceErrorRequest) error

type FileNotExistHandler

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

func (*FileNotExistHandler) Handle

func (feh *FileNotExistHandler) Handle(ctx context.Context, pieceErrorRequest *types.PieceErrorRequest) error

type Handler

type Handler interface {
	Handle(ctx context.Context, pieceErrorRequest *types.PieceErrorRequest) error
}

TODO: make it pluggable

func NewFileMd5NotMatchHandler

func NewFileMd5NotMatchHandler(gcManager mgr.GCMgr, cdnManager mgr.CDNMgr) (Handler, error)

func NewFileNotExistHandler

func NewFileNotExistHandler(gcManager mgr.GCMgr, cdnManager mgr.CDNMgr) (Handler, error)

type Manager

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

func NewManager

func NewManager(cfg *config.Config, gcManager mgr.GCMgr, cdnManager mgr.CDNMgr) (*Manager, error)

func (*Manager) HandlePieceError

func (em *Manager) HandlePieceError(ctx context.Context, pieceErrorRequest *types.PieceErrorRequest) error

HandlePieceError the peer should report the error with related info when it failed to download a piece from supernode. And the supernode should handle the piece Error and do some repair operations.

func (*Manager) StartHandleError

func (em *Manager) StartHandleError(ctx context.Context)

StartHandleError starts a goroutine to handle the piece error.

Jump to

Keyboard shortcuts

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