eosdb

package
v0.1.1-docker Latest Latest
Warning

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

Go to latest
Published: May 12, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolPtr

func BoolPtr(b *bool) bool

func MustHexDecode

func MustHexDecode(input string) []byte

func Register

func Register(schemeName string, factory DriverFactory)

Register registers a storage backend Driver

Types

type AccountsReader

type AccountsReader interface {
	GetAccount(ctx context.Context, accountName string) (*pbcodec.AccountCreationRef, error)
	//TODO: concurrentReadCount is that a property only for Bigtable? should it be configured when creating the driver
	ListAccountNames(ctx context.Context, concurrentReadCount uint32) ([]string, error)
}

type BlocksReader

type BlocksReader interface {
	GetLastWrittenBlockID(ctx context.Context) (blockID string, err error)
	GetBlock(ctx context.Context, id string) (*pbcodec.BlockWithRefs, error)
	GetBlockByNum(ctx context.Context, num uint32) ([]*pbcodec.BlockWithRefs, error)
	GetClosestIrreversibleIDAtBlockNum(ctx context.Context, num uint32) (ref bstream.BlockRef, err error)
	GetIrreversibleIDAtBlockID(ctx context.Context, ID string) (ref bstream.BlockRef, err error)
	// ListBlocks retrieves blocks where `highBlockNum` is the highest
	// returned, and will retrieve a maximum of `limit` rows.  For
	// example, if you pass `highBlockNum = math.MaxUint32` with
	// `limit = 1`, it will retrieve the last written block.
	//
	// FIXME: this one should be `lowBlockNum` and `highBlockNum`, the
	// thing is you might not have the expected block range if there
	// are forked blocks provided.
	ListBlocks(ctx context.Context, highBlockNum uint32, limit int) ([]*pbcodec.BlockWithRefs, error)
	ListSiblingBlocks(ctx context.Context, blockNum uint32, spread uint32) ([]*pbcodec.BlockWithRefs, error)
}

type BlocksTransactionsReader

type BlocksTransactionsReader interface {
	BlocksReader
	TransactionsReader
}

This is the main interface, needed by most subsystems.

type ChainDiscriminator

type ChainDiscriminator func(blockID string) bool

type DBWriter

type DBWriter interface {
	SetWriterChainID(chainID []byte)
	// Where did I leave off last time I wrote?
	GetLastWrittenIrreversibleBlockRef(ctx context.Context) (ref bstream.BlockRef, err error)
	PutBlock(ctx context.Context, blk *pbcodec.Block) error
	UpdateNowIrreversibleBlock(ctx context.Context, blk *pbcodec.Block) error
	// Flush MUST be called or you WILL lose data
	Flush(context.Context) error
}

type Driver

type Driver interface {
	DBReader
	DBWriter
}

func New

func New(dsn string, opts ...Option) (Driver, error)

New initializes a new Driver

type DriverFactory

type DriverFactory func(dsn string, opts ...Option) (Driver, error)

type GRPCConn

type GRPCConn struct{ ClientConn *grpc.ClientConn }

type Option

type Option interface {
	// contains filtered or unexported methods
}

func WithGRPCConn

func WithGRPCConn(conn *grpc.ClientConn) Option

type ProtoDecoder

type ProtoDecoder struct{}

func NewProtoDecoder

func NewProtoDecoder() *ProtoDecoder

func (*ProtoDecoder) Into

func (d *ProtoDecoder) Into(cnt []byte, msg proto.Message) error

func (*ProtoDecoder) MustInto

func (d *ProtoDecoder) MustInto(cnt []byte, msg proto.Message)

type ProtoEncoder

type ProtoEncoder struct{}

func NewProtoEncoder

func NewProtoEncoder() *ProtoEncoder

func (*ProtoEncoder) MustProto

func (e *ProtoEncoder) MustProto(obj proto.Message) (out []byte)

type TestTransactionsReader

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

func NewTestTransactionsReader

func NewTestTransactionsReader(content map[string][]*pbcodec.TransactionEvent) *TestTransactionsReader

func (*TestTransactionsReader) GetTransactionEvents

func (r *TestTransactionsReader) GetTransactionEvents(ctx context.Context, idPrefix string) ([]*pbcodec.TransactionEvent, error)

func (*TestTransactionsReader) GetTransactionEventsBatch

func (r *TestTransactionsReader) GetTransactionEventsBatch(ctx context.Context, idPrefixes []string) ([][]*pbcodec.TransactionEvent, error)

func (*TestTransactionsReader) GetTransactionTraces

func (r *TestTransactionsReader) GetTransactionTraces(ctx context.Context, idPrefix string) ([]*pbcodec.TransactionEvent, error)

func (*TestTransactionsReader) GetTransactionTracesBatch

func (r *TestTransactionsReader) GetTransactionTracesBatch(ctx context.Context, idPrefixes []string) (out [][]*pbcodec.TransactionEvent, err error)

type TimelineExplorer

type TimelineExplorer interface {
	BlockIDAt(ctx context.Context, start time.Time) (id string, err error)
	BlockIDAfter(ctx context.Context, start time.Time, inclusive bool) (id string, foundtime time.Time, err error)
	BlockIDBefore(ctx context.Context, start time.Time, inclusive bool) (id string, foundtime time.Time, err error)
}

type TransactionsReader

type TransactionsReader interface {

	// GetTransactionTraces retrieves only the execution traces event, ignoring deferred lifecycle events.
	GetTransactionTraces(ctx context.Context, idPrefix string) ([]*pbcodec.TransactionEvent, error)
	// GetTransactionTracesBatch returns only the execution traces (ignoring deferred licycle events), for each id prefix specified.
	GetTransactionTracesBatch(ctx context.Context, idPrefixes []string) ([][]*pbcodec.TransactionEvent, error)

	// GetTransactionEvents retrieves all the events related to the lifecycle of a transaction, including transaction introduction, deferred creations, cancellations, and traces of execution.
	// This function returns `kvdb.ErrNotFound` is the transaction was not found
	GetTransactionEvents(ctx context.Context, idPrefix string) ([]*pbcodec.TransactionEvent, error)
	// GetTransactionEventsBatch returns a list of all events for each transaction id prefix.
	// If some ids are not found, the corresponding index will have a nil list of TransactionEvent.
	GetTransactionEventsBatch(ctx context.Context, idPrefixes []string) ([][]*pbcodec.TransactionEvent, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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