Documentation
¶
Index ¶
- Variables
- type BlockstreamServer
- func (s *BlockstreamServer) Blocks(r *pbbstream.BlockRequest, stream pbbstream.BlockStream_BlocksServer) error
- func (s *BlockstreamServer) Close()
- func (s *BlockstreamServer) GetHeadInfo(ctx context.Context, req *pbheadinfo.HeadInfoRequest) (*pbheadinfo.HeadInfoResponse, error)
- func (s *BlockstreamServer) Launch(serverAddr string)
- type ForkableHub
- func (h *ForkableHub) GetBlock(num uint64, id string) (out *pbbstream.Block)
- func (h *ForkableHub) GetBlockByHash(id string) (out *pbbstream.Block)
- func (h *ForkableHub) HeadInfo() (headNum uint64, headID string, headTime time.Time, libNum uint64, err error)
- func (h *ForkableHub) HeadNum() uint64
- func (h *ForkableHub) IsReady() bool
- func (h *ForkableHub) LowestBlockNum() uint64
- func (h *ForkableHub) MatchSuffix(req string) bool
- func (h *ForkableHub) NewBlockstreamServer(dgrpcServer ggrpcserver.Server) *BlockstreamServer
- func (h *ForkableHub) ProcessBlock(blk *pbbstream.Block, obj any) error
- func (h *ForkableHub) Run()
- func (h *ForkableHub) SourceFromBlockNum(num uint64, handler bstream.Handler) (out bstream.Source)
- func (h *ForkableHub) SourceFromBlockNumWithForks(num uint64, handler bstream.Handler, withPartials bool) (out bstream.Source)
- func (h *ForkableHub) SourceFromCursor(cursor *bstream.Cursor, handler bstream.Handler) (out bstream.Source)
- func (h *ForkableHub) SourceThroughCursor(startBlock uint64, cursor *bstream.Cursor, handler bstream.Handler) (out bstream.Source)
- func (h *ForkableHub) WalkOneBlocksStore(ctx context.Context) ([]string, error)
- func (h *ForkableHub) WalkOneBlocksStoreFrom(ctx context.Context, startingBlock uint64) ([]string, error)
- type Option
- type Subscription
Constants ¶
This section is empty.
Variables ¶
var ErrSubscriptionChannelFull = fmt.Errorf("subscription channel at max capacity")
Functions ¶
This section is empty.
Types ¶
type BlockstreamServer ¶
type BlockstreamServer struct {
// contains filtered or unexported fields
}
func (*BlockstreamServer) Blocks ¶
func (s *BlockstreamServer) Blocks(r *pbbstream.BlockRequest, stream pbbstream.BlockStream_BlocksServer) error
func (*BlockstreamServer) Close ¶
func (s *BlockstreamServer) Close()
func (*BlockstreamServer) GetHeadInfo ¶
func (s *BlockstreamServer) GetHeadInfo(ctx context.Context, req *pbheadinfo.HeadInfoRequest) (*pbheadinfo.HeadInfoResponse, error)
func (*BlockstreamServer) Launch ¶
func (s *BlockstreamServer) Launch(serverAddr string)
type ForkableHub ¶
type ForkableHub struct {
*shutter.Shutter
Ready chan struct{}
// contains filtered or unexported fields
}
ForkableHub gives you block Sources for blocks close to head it keeps reversible segment in a Forkable it keeps small final segment in a buffer
func NewForkableHub ¶
func NewForkableHub(liveSourceFactory bstream.SourceFactory, keepFinalBlocks int, oneBlocksStore dstore.Store, extraForkableOptions ...forkable.Option) *ForkableHub
func NewForkableHubWithOptions ¶
func NewForkableHubWithOptions(liveSourceFactory bstream.SourceFactory, keepFinalBlocks int, oneBlocksStore dstore.Store, hubOptions []Option, extraForkableOptions ...forkable.Option) *ForkableHub
NewForkableHubWithOptions is like NewForkableHub but also accepts hub-level options such as WithMaxConsecutiveUnlinkableBlocks.
func (*ForkableHub) GetBlock ¶
func (h *ForkableHub) GetBlock(num uint64, id string) (out *pbbstream.Block)
func (*ForkableHub) GetBlockByHash ¶
func (h *ForkableHub) GetBlockByHash(id string) (out *pbbstream.Block)
func (*ForkableHub) HeadNum ¶
func (h *ForkableHub) HeadNum() uint64
func (*ForkableHub) IsReady ¶
func (h *ForkableHub) IsReady() bool
func (*ForkableHub) LowestBlockNum ¶
func (h *ForkableHub) LowestBlockNum() uint64
func (*ForkableHub) MatchSuffix ¶
func (h *ForkableHub) MatchSuffix(req string) bool
func (*ForkableHub) NewBlockstreamServer ¶
func (h *ForkableHub) NewBlockstreamServer(dgrpcServer ggrpcserver.Server) *BlockstreamServer
implementation of blockstream.Server from the hub
func (*ForkableHub) ProcessBlock ¶
func (h *ForkableHub) ProcessBlock(blk *pbbstream.Block, obj any) error
func (*ForkableHub) Run ¶
func (h *ForkableHub) Run()
func (*ForkableHub) SourceFromBlockNum ¶
func (*ForkableHub) SourceFromBlockNumWithForks ¶
func (*ForkableHub) SourceFromCursor ¶
func (*ForkableHub) SourceThroughCursor ¶
func (*ForkableHub) WalkOneBlocksStore ¶
func (h *ForkableHub) WalkOneBlocksStore(ctx context.Context) ([]string, error)
func (*ForkableHub) WalkOneBlocksStoreFrom ¶
type Option ¶
type Option func(h *ForkableHub)
Option configures a ForkableHub.
func WithMaxConsecutiveUnlinkableBlocks ¶
WithMaxConsecutiveUnlinkableBlocks instructs the hub to shut itself down (with errRestartRequired) if it has already passed readiness and it receives count consecutive blocks that cannot be linked to its current head, even after attempting to fill the gap from the one-block store. A count of 0 (the default) disables the check.
type Subscription ¶
Subscription is a bstream.Source
func NewSubscription ¶
func NewSubscription(handler bstream.Handler, chanSize int, withPartial bool) *Subscription
s.hub.unsubscribe(sub)
func (*Subscription) Run ¶
func (s *Subscription) Run()