Documentation
¶
Index ¶
- type Server
- func (s *Server) Blocks(r *pbbstream.BlockRequest, stream pbbstream.BlockStream_BlocksServer) error
- func (s *Server) GetHeadInfo(ctx context.Context, req *pbheadinfo.HeadInfoRequest) (*pbheadinfo.HeadInfoResponse, error)
- func (s *Server) PushBlock(blk *pbbstream.Block) error
- func (s *Server) Ready() bool
- func (s *Server) SetHeadInfo(num uint64, id string, blkTime time.Time, libNum uint64)
- type ServerOption
- type Source
- type SourceOption
- func WithBurstFunc(burstFunc func() int64) SourceOption
- func WithLogger(logger *zap.Logger) SourceOption
- func WithNumGator(blockNum uint64, exclusive bool) SourceOption
- func WithParallelPreproc(f bstream.PreprocessFunc, threads int) SourceOption
- func WithPartialBlocks() SourceOption
- func WithRequester(requester string) SourceOption
- func WithSecretKey(key string) SourceOption
- func WithTimeThresholdGator(threshold time.Duration) SourceOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewBufferedServer ¶
func NewBufferedServer(server dgrpcserver.Server, size int, opts ...ServerOption) *Server
func NewServer ¶
func NewServer(server dgrpcserver.Server, opts ...ServerOption) *Server
func NewUnmanagedServer ¶
func NewUnmanagedServer(opts ...ServerOption) *Server
NewUnmanagedServer can be used to create a BlockStream server that has no control over the actual gRPC server. Registration of services should be made manually by entity calling `blockstream.NewUnmanagedServer`.
Moreover, management methods like `Close`
func (*Server) Blocks ¶
func (s *Server) Blocks(r *pbbstream.BlockRequest, stream pbbstream.BlockStream_BlocksServer) error
func (*Server) GetHeadInfo ¶
func (s *Server) GetHeadInfo(ctx context.Context, req *pbheadinfo.HeadInfoRequest) (*pbheadinfo.HeadInfoResponse, error)
type ServerOption ¶
type ServerOption func(s *Server)
func ServerOptionWithBuffer ¶
func ServerOptionWithBuffer(size int) ServerOption
func ServerOptionWithLogger ¶
func ServerOptionWithLogger(logger *zap.Logger) ServerOption
type Source ¶
func (*Source) SetParallelPreproc ¶
func (s *Source) SetParallelPreproc(f bstream.PreprocessFunc, threads int)
type SourceOption ¶
type SourceOption = func(s *Source)
func WithBurstFunc ¶
func WithBurstFunc(burstFunc func() int64) SourceOption
WithBurstFunc makes the source call burstFunc when it sends its block request and use the returned burst instead of the one given to NewSource. The request is sent when the source runs, so the burst can depend on state the handler only has by then, such as a hub that bootstraps between creating its live source and running it.
func WithLogger ¶
func WithLogger(logger *zap.Logger) SourceOption
func WithNumGator ¶
func WithNumGator(blockNum uint64, exclusive bool) SourceOption
func WithParallelPreproc ¶
func WithParallelPreproc(f bstream.PreprocessFunc, threads int) SourceOption
func WithPartialBlocks ¶
func WithPartialBlocks() SourceOption
func WithRequester ¶
func WithRequester(requester string) SourceOption
func WithSecretKey ¶
func WithSecretKey(key string) SourceOption
WithSecretKey configures the source to send the given secret key in the gRPC metadata header "x-secret-key" on every outgoing call. When key is empty, no header is sent.
func WithTimeThresholdGator ¶
func WithTimeThresholdGator(threshold time.Duration) SourceOption