hub

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2020 License: Apache-2.0 Imports: 9 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HubSource

type HubSource struct {
	*shutter.Shutter
	// contains filtered or unexported fields
}

HubSource has the following guarantees: * if a ProcessBlock() returns an error to this source, ProcessBlock will not be called again by this source. * if a ProcessBlock() calls source.Shutdown(), the source will not call ProcessBlock again. (this was an issue with BufferedHandler solution) WARNING: because of that second guarantee, allowing ProcessBlock to call its own source's shutdown function, you should never assume that there is no ongoing or incoming ProcessBlock() when calling source.Shutdown() from another thread. Don't do anything dangerous like closing a channel awaiting a Write from that source! Let the channel die from garbage collecting, wrap your reads and writes with select() on context.Terminating() or source.Terminating() and so on.

func (*HubSource) Run

func (s *HubSource) Run()

type LIBGetter

type LIBGetter interface {
	GetRealtimeLIB() (uint64, error)
}

type Option

type Option func(*SubscriptionHub)

func WithName

func WithName(name string) Option

func WithRealtimeTolerance

func WithRealtimeTolerance(d time.Duration) Option

func WithSourceChannelSize

func WithSourceChannelSize(size int) Option

type SubscriptionHub

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

SubscriptionHub hooks to a live data source

func NewSubscriptionHub

func NewSubscriptionHub(startBlock uint64, buffer *bstream.Buffer, tailLockFunc TailLockFunc, fileSourceFactory bstream.SourceFromNumFactory, liveSourceFactory bstream.SourceFromNumFactory, opts ...Option) (*SubscriptionHub, error)

func (*SubscriptionHub) HeadBlock

func (h *SubscriptionHub) HeadBlock() bstream.BlockRef

func (*SubscriptionHub) HeadBlockID

func (h *SubscriptionHub) HeadBlockID() string

func (*SubscriptionHub) Launch

func (h *SubscriptionHub) Launch()

func (*SubscriptionHub) NewHubSourceFromBlockNum

func (h *SubscriptionHub) NewHubSourceFromBlockNum(blockNum uint64, handler bstream.Handler) (*HubSource, error)

func (*SubscriptionHub) NewSource

func (h *SubscriptionHub) NewSource(handler bstream.Handler, burst int) bstream.Source

NewSource issues new sources fed from the Hub.

func (*SubscriptionHub) NewSourceFromBlockNum

func (h *SubscriptionHub) NewSourceFromBlockNum(blockNum uint64, handler bstream.Handler) bstream.Source

func (*SubscriptionHub) NewSourceFromBlockNumWithOpts

func (h *SubscriptionHub) NewSourceFromBlockNumWithOpts(blockNum uint64, handler bstream.Handler, opts ...bstream.JoiningSourceOption) bstream.Source

func (*SubscriptionHub) NewSourceFromBlockRef

func (h *SubscriptionHub) NewSourceFromBlockRef(ref bstream.BlockRef, handler bstream.Handler) bstream.Source

func (*SubscriptionHub) WaitReady deprecated

func (h *SubscriptionHub) WaitReady()

Deprecated: Use `WaitUntilRealTime` instead.

func (*SubscriptionHub) WaitUntilRealTime

func (h *SubscriptionHub) WaitUntilRealTime()

type TailLockFunc

type TailLockFunc func(tailBlockNum uint64) (func(), error)

type TestLIBGetter

type TestLIBGetter struct {
	LIB uint64
}

func (*TestLIBGetter) GetRealtimeLIB

func (g *TestLIBGetter) GetRealtimeLIB() (uint64, error)

Jump to

Keyboard shortcuts

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