Documentation ¶
Index ¶
- Constants
- Variables
- func BlockPrefix(info *pb.BlockInfo) string
- func BytesToHashString(b []byte) string
- func CheckConnState(conn *grpc.ClientConn) error
- func CommonPrefix(env, chainId, role string, blockTy pb.BlockInfo_BlockType) string
- func DevelopmentMode()
- func DevelopmentModeWithoutStackTrace()
- func HeaderPrefix(info *pb.BlockInfo) string
- func HexEncode(b []byte) string
- func InfoToPrefix(info *pb.BlockInfo) string
- func IntegrationTestMod()
- func Less(item *entry, than *entry) bool
- func Logger() *zap.Logger
- func New(code int, text string) error
- func OpenAndReadDbInfo(path string) (*pb.DBInfoList, error)
- func PrefixToBlockInfo(key string) (info *pb.BlockInfo, err error)
- func PrefixToHeaderInfo(key string) (info *pb.BlockInfo, err error)
- func ProductionMode()
- func ProductionModeWithoutStackTrace()
- func Topic(env, chainId, role string) string
- func TopicPrefix(env, chainId, role string) string
- type Cache
- type ClientPool
- type Config
- type ErrorCode
- type FetchFn
- type Hash
- type LRU
Constants ¶
View Source
const ( UnknownErrorCode = -1 NoMetaDBRegisteredErrorCode = 41001 WriterStoppedErrorCode = 41002 ReadInvalidHeaderErrorCode = 41003 AwsS3ErrorCode = 41004 WriterRecoveryErrorCode = 41005 RemoteErrorCode = 41006 MetaDBAlreadyRegisteredErrorCode = 41007 BroadcasterErrorCode = 41008 StreamNotInitErrorCode = 41009 )
View Source
const ( UnInited int = 0 InProcess int = 1 Sucess int = 2 Failed int = 3 )
View Source
const ConnNum = 32
View Source
const (
// HashLength is the expected length of the hash
HashLength = 32
)
Lengths of hashes and addresses in bytes.
Variables ¶
View Source
var ( ErrNoMetaDBRegistered = New(NoMetaDBRegisteredErrorCode, "no meta db registered") ErrMetaDBAlreadyRegistered = New(MetaDBAlreadyRegisteredErrorCode, "meta db already registered") ErrWriterStopped = New(WriterStoppedErrorCode, "writer stopped") ErrReadInvalidHeader = New(ReadInvalidHeaderErrorCode, "invalid header") ErrAwsS3 = New(AwsS3ErrorCode, "aws s3 error") ErrWriterRecovey = New(WriterRecoveryErrorCode, "writer recovery error") ErrStreamNotInit = New(StreamNotInitErrorCode, "stream not init") )
Functions ¶
func BlockPrefix ¶
func BytesToHashString ¶
BytesToHashString returns the hash as the hexadecimal string of the byte-reversed hash.
func CheckConnState ¶
func CheckConnState(conn *grpc.ClientConn) error
func CommonPrefix ¶
func CommonPrefix(env, chainId, role string, blockTy pb.BlockInfo_BlockType) string
func DevelopmentMode ¶
func DevelopmentMode()
func DevelopmentModeWithoutStackTrace ¶
func DevelopmentModeWithoutStackTrace()
func HeaderPrefix ¶
func InfoToPrefix ¶
func IntegrationTestMod ¶
func IntegrationTestMod()
func OpenAndReadDbInfo ¶
func OpenAndReadDbInfo(path string) (*pb.DBInfoList, error)
func ProductionMode ¶
func ProductionMode()
func ProductionModeWithoutStackTrace ¶
func ProductionModeWithoutStackTrace()
func TopicPrefix ¶
Types ¶
type Cache ¶
func (*Cache) GetOrCreatePrefixCache ¶
type ClientPool ¶
func NewClientPool ¶
func NewClientPool(target string) (*ClientPool, error)
func (*ClientPool) GetConn ¶
func (cc *ClientPool) GetConn() (*grpc.ClientConn, int64, error)
func (*ClientPool) ResetConn ¶
func (cc *ClientPool) ResetConn(idx int64) (*grpc.ClientConn, error)
type Config ¶
type Config struct { S3ProxyAddr string KafkaAddr string RemoteAddr string RemoteListenAddr string Env string ChainId string Role string DBInfoPath string ReorgDeep int DBCacheSize int NdrcAddr string MetricEndpoint string }
Config represents the configuration of the replicator.
func NewDevelopmentConfig ¶
func NewDevelopmentConfig() *Config
NewDevelopmentConfig returns a Dev env Config with default values.
type ErrorCode ¶
type ErrorCode struct {
// contains filtered or unexported fields
}
func ErrorToErrorCode ¶
type Hash ¶
type Hash [HashLength]byte
Hash represents the 32 byte Keccak256 hash of arbitrary data.
func BytesToHash ¶
BytesToHash sets b to hash. If b is larger than len(h), b will be cropped from the left.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.