mindreader

package
v0.0.2-0...-26b375a Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2021 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContinuityChecker

func NewContinuityChecker(filePath string, zlogger *zap.Logger) (*continuityChecker, error)

func RunGRPCServer

func RunGRPCServer(s *grpc.Server, listenAddr string, zlogger *zap.Logger) error

Types

type Archiver

type Archiver interface {
	Init() error
	StoreBlock(block *bstream.Block) error
	Start()
	Shutdown(err error)
	Terminated() <-chan struct{}
	IsTerminating() bool
}

type ArchiverSelector

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

func NewArchiverSelector

func NewArchiverSelector(
	oneblockArchiver Archiver,
	mergeArchiver Archiver,
	blockReaderFactory bstream.BlockReaderFactory,
	batchMode bool,
	tracker *bstream.Tracker,
	mergeThresholdBlockAge time.Duration,
	workDir string,
	logger *zap.Logger,
) *ArchiverSelector

func (*ArchiverSelector) Init

func (s *ArchiverSelector) Init() error

func (*ArchiverSelector) Start

func (s *ArchiverSelector) Start()

func (*ArchiverSelector) StoreBlock

func (s *ArchiverSelector) StoreBlock(block *bstream.Block) error

type BlockMarshaller

type BlockMarshaller func(block *bstream.Block) ([]byte, error)

type BlockNumberGate

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

func NewBlockNumberGate

func NewBlockNumberGate(blockNum uint64) *BlockNumberGate

type ConsoleReaderBlockTransformer

type ConsoleReaderBlockTransformer func(obj interface{}) (*bstream.Block, error)

ConsoleReaderBlockTransformer is a function that accepts an `obj` of type `interface{}` as produced by a specialized ConsoleReader implementation and turns it into a `bstream.Block` that is able to flow in block streams.

type ConsolerReader

type ConsolerReader interface {
	Read() (obj interface{}, err error)
	Done() <-chan interface{}
}

type ConsolerReaderFactory

type ConsolerReaderFactory func(lines chan string) (ConsolerReader, error)

type ContinuityChecker

type ContinuityChecker interface {
	IsLocked() bool
	Reset()
	Write(lastSeenBlockNum uint64) error
}

type MergeArchiver

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

MergeArchiver does the merging in one swift, no need for a merger here.

func NewMergeArchiver

func NewMergeArchiver(
	store dstore.Store,
	blockWriterFactory bstream.BlockWriterFactory,
	workDir string,
	logger *zap.Logger,
) *MergeArchiver

func (*MergeArchiver) Init

func (m *MergeArchiver) Init() error

func (*MergeArchiver) Start

func (m *MergeArchiver) Start()

func (*MergeArchiver) StoreBlock

func (m *MergeArchiver) StoreBlock(block *bstream.Block) error

func (*MergeArchiver) Terminate

func (m *MergeArchiver) Terminate() <-chan interface{}

Terminate assumes that no more 'StoreBlock' command is coming

type MindReaderPlugin

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

func NewMindReaderPlugin

func NewMindReaderPlugin(
	archiveStoreURL string,
	mergeArchiveStoreURL string,
	batchMode bool,
	mergeThresholdBlockAge time.Duration,
	workingDirectory string,
	consoleReaderFactory ConsolerReaderFactory,
	consoleReaderTransformer ConsoleReaderBlockTransformer,
	tracker *bstream.Tracker,

	startBlockNum uint64,
	stopBlockNum uint64,
	channelCapacity int,
	headBlockUpdateFunc nodeManager.HeadBlockUpdater,
	shutdownFunc func(error),
	failOnNonContinuousBlocks bool,
	waitUploadCompleteOnShutdown time.Duration,
	oneblockSuffix string,
	blockStreamServer *blockstream.Server,
	zlogger *zap.Logger,
) (*MindReaderPlugin, error)

NewMindReaderPlugin initiates its own: * ConsoleReader (from given Factory) * ConsoleReaderBlockTransformer (from given Factory) * Archiver (from archive store params) * ContinuityChecker * Shutter

func (*MindReaderPlugin) HasContinuityChecker

func (p *MindReaderPlugin) HasContinuityChecker() bool

func (*MindReaderPlugin) Launch

func (p *MindReaderPlugin) Launch()

func (*MindReaderPlugin) LogLine

func (p *MindReaderPlugin) LogLine(in string)

LogLine receives log line and write it to "pipe" of the local console reader

func (*MindReaderPlugin) Name

func (p *MindReaderPlugin) Name() string

func (*MindReaderPlugin) ResetContinuityChecker

func (p *MindReaderPlugin) ResetContinuityChecker()

func (MindReaderPlugin) Stop

func (p MindReaderPlugin) Stop()

type OneBlockArchiver

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

func NewOneBlockArchiver

func NewOneBlockArchiver(
	oneBlockStore dstore.Store,
	blockWriterFactory bstream.BlockWriterFactory,
	workDir string,
	suffix string,
	logger *zap.Logger,
) *OneBlockArchiver

func (*OneBlockArchiver) Init

func (s *OneBlockArchiver) Init() error

func (*OneBlockArchiver) Start

func (a *OneBlockArchiver) Start()

func (*OneBlockArchiver) StoreBlock

func (s *OneBlockArchiver) StoreBlock(block *bstream.Block) error

Jump to

Keyboard shortcuts

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