memstore

package
v0.0.0-...-ff6bfbe Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package memstore is a protocol.Store implementation that keeps all blockchain state in memory.

It is used in tests to avoid needing a database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemStore

type MemStore struct {
	Blocks map[uint64]*bc.Block
	State  *state.Snapshot
	// contains filtered or unexported fields
}

MemStore satisfies the Store interface.

func New

func New() *MemStore

New returns a new MemStore.

func (*MemStore) FinalizeHeight

func (m *MemStore) FinalizeHeight(context.Context, uint64) error

FinalizeHeight satisfies the protocol.Store interface.

func (*MemStore) GetBlock

func (m *MemStore) GetBlock(ctx context.Context, height uint64) (*bc.Block, error)

GetBlock satisfies the protocol.Store interface.

func (*MemStore) Height

func (m *MemStore) Height(context.Context) (uint64, error)

Height satisfies the protocol.Store interface.

func (*MemStore) LatestSnapshot

func (m *MemStore) LatestSnapshot(context.Context) (*state.Snapshot, error)

LatestSnapshot satisfies the protocol.Store interface.

func (*MemStore) SaveBlock

func (m *MemStore) SaveBlock(ctx context.Context, b *bc.Block) error

SaveBlock satisfies the protocol.Store interface.

func (*MemStore) SaveSnapshot

func (m *MemStore) SaveSnapshot(ctx context.Context, snapshot *state.Snapshot) error

SaveSnapshot satisfies the protocol.Store interface.

Jump to

Keyboard shortcuts

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