Documentation
¶
Index ¶
Constants ¶
View Source
const ( BaseSearch = "sync_base_req" BlockRequest = "sync_block_req" )
SyncService messages
View Source
const ( SimultaneousRequest = 1 DefaultResponseTimeLimit = 2 * time.Second DefaultNumberOfRetry = 5 DefaultActiveDownloadLimit = 10 )
Parameters related sync service
Variables ¶
View Source
var ( ErrContextDone = errors.New("context is closed") ErrDownloadCtxDone = errors.New("sync download context is done") ErrTimeout = errors.New("timeout to wait response") ErrDifferentTargetHash = errors.New("target hash is different") ErrDownloadActivated = errors.New("download is already activated") ErrFailedToConnect = errors.New("failed to connect to peer") ErrLimitedRetry = errors.New("retry is limited") ErrNotFound = errors.New("not found") ErrWrongHeightBlock = errors.New("peer send wrong block height") )
Error types
Functions ¶
This section is empty.
Types ¶
type BlockManager ¶
type BlockManager interface { Start() BlockHashByHeight(height uint64) ([]byte, error) BlockByHeight(height uint64) (*core.Block, error) BlockByHash(hash []byte) *core.Block LIB() *core.Block PushBlockDataSync(bd *core.BlockData, timeLimit time.Duration) error PushBlockDataSync2(ctx context.Context, bd *core.BlockData) error }
BlockManager is interface of core.blockmanager.
type DownloadByHeightQuery ¶
type DownloadByHeightQuery struct {
// contains filtered or unexported fields
}
DownloadByHeightQuery is a query to download block
func (*DownloadByHeightQuery) Hash ¶
func (q *DownloadByHeightQuery) Hash() []byte
Hash returns hash
func (*DownloadByHeightQuery) MessageType ¶
func (*DownloadByHeightQuery) MessageType() string
MessageType returns message type
func (*DownloadByHeightQuery) ProtoBuf ¶
func (q *DownloadByHeightQuery) ProtoBuf() proto.Message
ProtoBuf returns proto buffer
func (*DownloadByHeightQuery) SetID ¶
func (q *DownloadByHeightQuery) SetID(id string)
SetID sets query id
type FindBaseQuery ¶
type FindBaseQuery struct {
// contains filtered or unexported fields
}
FindBaseQuery is a query to find base block
func (*FindBaseQuery) MessageType ¶
func (*FindBaseQuery) MessageType() string
MessageType returns message type
func (*FindBaseQuery) ProtoBuf ¶
func (q *FindBaseQuery) ProtoBuf() proto.Message
ProtoBuf returns protobuf
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the service for sync service
func NewService ¶
func NewService(cfg *medletpb.SyncConfig) *Service
NewService returns new syncService
func (*Service) IsDownloadActivated ¶
IsDownloadActivated return status of activation
Click to show internal directories.
Click to hide internal directories.