sync

package
v0.0.0-...-3442dc8 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: GPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MOD_NAME       = "sync"
	MOD_ACTOR_NAME = "sync_actor"
)

Variables

View Source
var (
	ErrInvalidLengthMessageSync        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowMessageSync          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupMessageSync = fmt.Errorf("proto: unexpected end of group")
)
View Source
var BlockResponse_RespCode_name = map[int32]string{
	0: "OK",
	1: "NOBLOCK",
}
View Source
var BlockResponse_RespCode_value = map[string]int32{
	"OK":      0,
	"NOBLOCK": 1,
}
View Source
var SyncMessage_SyncMessageType_name = map[int32]string{
	0: "Unknown",
	1: "BlockRequest",
	2: "BlockResponse",
	3: "StatusRequest",
	4: "StatusResponse",
}
View Source
var SyncMessage_SyncMessageType_value = map[string]int32{
	"Unknown":        0,
	"BlockRequest":   1,
	"BlockResponse":  2,
	"StatusRequest":  3,
	"StatusResponse": 4,
}

Functions

func CreateSyncActor

func CreateSyncActor(level tplogcmm.LogLevel, parentLog tplog.Logger, sysActor *actor.ActorSystem, syncer *syncer) (*actor.PID, error)

func NewSyncHandler

func NewSyncHandler(log tplog.Logger) *syncHandler

Types

type BlockRequest

type BlockRequest struct {
	Height               uint64   `protobuf:"varint,1,opt,name=Height,proto3" json:"height"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*BlockRequest) Descriptor

func (*BlockRequest) Descriptor() ([]byte, []int)

func (*BlockRequest) GetHeight

func (m *BlockRequest) GetHeight() uint64

func (*BlockRequest) Marshal

func (m *BlockRequest) Marshal() (dAtA []byte, err error)

func (*BlockRequest) MarshalTo

func (m *BlockRequest) MarshalTo(dAtA []byte) (int, error)

func (*BlockRequest) MarshalToSizedBuffer

func (m *BlockRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*BlockRequest) ProtoMessage

func (*BlockRequest) ProtoMessage()

func (*BlockRequest) Reset

func (m *BlockRequest) Reset()

func (*BlockRequest) Size

func (m *BlockRequest) Size() (n int)

func (*BlockRequest) String

func (m *BlockRequest) String() string

func (*BlockRequest) Unmarshal

func (m *BlockRequest) Unmarshal(dAtA []byte) error

func (*BlockRequest) XXX_DiscardUnknown

func (m *BlockRequest) XXX_DiscardUnknown()

func (*BlockRequest) XXX_Marshal

func (m *BlockRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BlockRequest) XXX_Merge

func (m *BlockRequest) XXX_Merge(src proto.Message)

func (*BlockRequest) XXX_Size

func (m *BlockRequest) XXX_Size() int

func (*BlockRequest) XXX_Unmarshal

func (m *BlockRequest) XXX_Unmarshal(b []byte) error

type BlockResponse

type BlockResponse struct {
	Height               uint64                 `protobuf:"varint,1,opt,name=Height,proto3" json:"height"`
	Code                 BlockResponse_RespCode `protobuf:"varint,2,opt,name=Code,proto3,enum=proto.BlockResponse_RespCode" json:"code"`
	Block                *proto1.Block          `protobuf:"bytes,3,opt,name=block,proto3" json:"block"`
	XXX_NoUnkeyedLiteral struct{}               `json:"-"`
	XXX_unrecognized     []byte                 `json:"-"`
	XXX_sizecache        int32                  `json:"-"`
}

func (*BlockResponse) Descriptor

func (*BlockResponse) Descriptor() ([]byte, []int)

func (*BlockResponse) GetBlock

func (m *BlockResponse) GetBlock() *proto1.Block

func (*BlockResponse) GetCode

func (*BlockResponse) GetHeight

func (m *BlockResponse) GetHeight() uint64

func (*BlockResponse) Marshal

func (m *BlockResponse) Marshal() (dAtA []byte, err error)

func (*BlockResponse) MarshalTo

func (m *BlockResponse) MarshalTo(dAtA []byte) (int, error)

func (*BlockResponse) MarshalToSizedBuffer

func (m *BlockResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*BlockResponse) ProtoMessage

func (*BlockResponse) ProtoMessage()

func (*BlockResponse) Reset

func (m *BlockResponse) Reset()

func (*BlockResponse) Size

func (m *BlockResponse) Size() (n int)

func (*BlockResponse) String

func (m *BlockResponse) String() string

func (*BlockResponse) Unmarshal

func (m *BlockResponse) Unmarshal(dAtA []byte) error

func (*BlockResponse) XXX_DiscardUnknown

func (m *BlockResponse) XXX_DiscardUnknown()

func (*BlockResponse) XXX_Marshal

func (m *BlockResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*BlockResponse) XXX_Merge

func (m *BlockResponse) XXX_Merge(src proto.Message)

func (*BlockResponse) XXX_Size

func (m *BlockResponse) XXX_Size() int

func (*BlockResponse) XXX_Unmarshal

func (m *BlockResponse) XXX_Unmarshal(b []byte) error

type BlockResponse_RespCode

type BlockResponse_RespCode int32
const (
	BlockResponse_OK      BlockResponse_RespCode = 0
	BlockResponse_NOBLOCK BlockResponse_RespCode = 1
)

func (BlockResponse_RespCode) EnumDescriptor

func (BlockResponse_RespCode) EnumDescriptor() ([]byte, []int)

func (BlockResponse_RespCode) String

func (x BlockResponse_RespCode) String() string

type StatusRequest

type StatusRequest struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*StatusRequest) Descriptor

func (*StatusRequest) Descriptor() ([]byte, []int)

func (*StatusRequest) Marshal

func (m *StatusRequest) Marshal() (dAtA []byte, err error)

func (*StatusRequest) MarshalTo

func (m *StatusRequest) MarshalTo(dAtA []byte) (int, error)

func (*StatusRequest) MarshalToSizedBuffer

func (m *StatusRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*StatusRequest) ProtoMessage

func (*StatusRequest) ProtoMessage()

func (*StatusRequest) Reset

func (m *StatusRequest) Reset()

func (*StatusRequest) Size

func (m *StatusRequest) Size() (n int)

func (*StatusRequest) String

func (m *StatusRequest) String() string

func (*StatusRequest) Unmarshal

func (m *StatusRequest) Unmarshal(dAtA []byte) error

func (*StatusRequest) XXX_DiscardUnknown

func (m *StatusRequest) XXX_DiscardUnknown()

func (*StatusRequest) XXX_Marshal

func (m *StatusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*StatusRequest) XXX_Merge

func (m *StatusRequest) XXX_Merge(src proto.Message)

func (*StatusRequest) XXX_Size

func (m *StatusRequest) XXX_Size() int

func (*StatusRequest) XXX_Unmarshal

func (m *StatusRequest) XXX_Unmarshal(b []byte) error

type StatusResponse

type StatusResponse struct {
	HeightHighest        uint64   `protobuf:"varint,1,opt,name=HeightHighest,proto3" json:"heightHighest"`
	HeightLowest         uint64   `protobuf:"varint,2,opt,name=HeightLowest,proto3" json:"heightLowest"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*StatusResponse) Descriptor

func (*StatusResponse) Descriptor() ([]byte, []int)

func (*StatusResponse) GetHeightHighest

func (m *StatusResponse) GetHeightHighest() uint64

func (*StatusResponse) GetHeightLowest

func (m *StatusResponse) GetHeightLowest() uint64

func (*StatusResponse) Marshal

func (m *StatusResponse) Marshal() (dAtA []byte, err error)

func (*StatusResponse) MarshalTo

func (m *StatusResponse) MarshalTo(dAtA []byte) (int, error)

func (*StatusResponse) MarshalToSizedBuffer

func (m *StatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*StatusResponse) ProtoMessage

func (*StatusResponse) ProtoMessage()

func (*StatusResponse) Reset

func (m *StatusResponse) Reset()

func (*StatusResponse) Size

func (m *StatusResponse) Size() (n int)

func (*StatusResponse) String

func (m *StatusResponse) String() string

func (*StatusResponse) Unmarshal

func (m *StatusResponse) Unmarshal(dAtA []byte) error

func (*StatusResponse) XXX_DiscardUnknown

func (m *StatusResponse) XXX_DiscardUnknown()

func (*StatusResponse) XXX_Marshal

func (m *StatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*StatusResponse) XXX_Merge

func (m *StatusResponse) XXX_Merge(src proto.Message)

func (*StatusResponse) XXX_Size

func (m *StatusResponse) XXX_Size() int

func (*StatusResponse) XXX_Unmarshal

func (m *StatusResponse) XXX_Unmarshal(b []byte) error

type SyncActor

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

func (*SyncActor) Receive

func (sa *SyncActor) Receive(context actor.Context)

type SyncHandler

type SyncHandler interface {
	HandleBlockRequest(context actor.Context, marshaler codec.Marshaler, msg *BlockRequest) error

	HandleBlockResponse(msg *BlockResponse) error

	HandleStatusRequest(context actor.Context, marshaler codec.Marshaler, msg *StatusRequest) error

	HandleStatusResponse(msg *StatusResponse) error
}

type SyncMessage

type SyncMessage struct {
	MsgType              SyncMessage_SyncMessageType `protobuf:"varint,1,opt,name=MsgType,proto3,enum=proto.SyncMessage_SyncMessageType" json:"msgType"`
	Data                 []byte                      `protobuf:"bytes,2,opt,name=Data,proto3" json:"data"`
	XXX_NoUnkeyedLiteral struct{}                    `json:"-"`
	XXX_unrecognized     []byte                      `json:"-"`
	XXX_sizecache        int32                       `json:"-"`
}

func (*SyncMessage) Descriptor

func (*SyncMessage) Descriptor() ([]byte, []int)

func (*SyncMessage) GetData

func (m *SyncMessage) GetData() []byte

func (*SyncMessage) GetMsgType

func (m *SyncMessage) GetMsgType() SyncMessage_SyncMessageType

func (*SyncMessage) Marshal

func (m *SyncMessage) Marshal() (dAtA []byte, err error)

func (*SyncMessage) MarshalTo

func (m *SyncMessage) MarshalTo(dAtA []byte) (int, error)

func (*SyncMessage) MarshalToSizedBuffer

func (m *SyncMessage) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*SyncMessage) ProtoMessage

func (*SyncMessage) ProtoMessage()

func (*SyncMessage) Reset

func (m *SyncMessage) Reset()

func (*SyncMessage) Size

func (m *SyncMessage) Size() (n int)

func (*SyncMessage) String

func (m *SyncMessage) String() string

func (*SyncMessage) Unmarshal

func (m *SyncMessage) Unmarshal(dAtA []byte) error

func (*SyncMessage) XXX_DiscardUnknown

func (m *SyncMessage) XXX_DiscardUnknown()

func (*SyncMessage) XXX_Marshal

func (m *SyncMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SyncMessage) XXX_Merge

func (m *SyncMessage) XXX_Merge(src proto.Message)

func (*SyncMessage) XXX_Size

func (m *SyncMessage) XXX_Size() int

func (*SyncMessage) XXX_Unmarshal

func (m *SyncMessage) XXX_Unmarshal(b []byte) error

type SyncMessage_SyncMessageType

type SyncMessage_SyncMessageType int32
const (
	SyncMessage_Unknown        SyncMessage_SyncMessageType = 0
	SyncMessage_BlockRequest   SyncMessage_SyncMessageType = 1
	SyncMessage_BlockResponse  SyncMessage_SyncMessageType = 2
	SyncMessage_StatusRequest  SyncMessage_SyncMessageType = 3
	SyncMessage_StatusResponse SyncMessage_SyncMessageType = 4
)

func (SyncMessage_SyncMessageType) EnumDescriptor

func (SyncMessage_SyncMessageType) EnumDescriptor() ([]byte, []int)

func (SyncMessage_SyncMessageType) String

type Syncer

type Syncer interface {
	UpdateHandler(handler SyncHandler)

	Marshaler() codec.Marshaler

	Start(sysActor *actor.ActorSystem, network network.Network) error

	Stop()
}

func NewSyncer

func NewSyncer(level tplogcmm.LogLevel, log tplog.Logger, codecType codec.CodecType) Syncer

Jump to

Keyboard shortcuts

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