memory

package
v0.0.0-...-c97bdb9 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package memory implements the ability to read and write blocks to memory using a slice.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Memory

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

Memory represents the serialization implementation for reading and storing blocks in memory using a slice. This implements the database.Storage interface.

func New

func New() (*Memory, error)

New constructs an Memory value for use.

func (*Memory) Close

func (m *Memory) Close() error

Close in this implementation has nothing to do since everything is in memory.

func (*Memory) ForEach

func (m *Memory) ForEach() database.Iterator

ForEach returns an iterator to walk through all the blocks starting with block number 1.

func (*Memory) GetBlock

func (m *Memory) GetBlock(num uint64) (database.BlockData, error)

GetBlock searches the blockchain to locate and return the contents of the specified block by number.

func (*Memory) Reset

func (m *Memory) Reset() error

Reset will clear out the blockchain on disk.

func (*Memory) Write

func (m *Memory) Write(blockData database.BlockData) error

Write takes the specified database blocks and stores it in memory.

Jump to

Keyboard shortcuts

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