dump

package
v0.0.0-...-2935fa7 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2021 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthDump        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowDump          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupDump = fmt.Errorf("proto: unexpected end of group")
)

Functions

func Load

func Load(source Source, st *state.State) error

Load a dump into state

func Write

func Write(out io.Writer, source Source, useBinaryEncoding bool, options Option) error

Write a dump to the Writer out by pulling rows from stream

Types

type AccountStorage

type AccountStorage struct {
	Address              github_com_klyed_hivesmartchain_crypto.Address `protobuf:"bytes,1,opt,name=Address,proto3,customtype=github.com/klyed/hivesmartchain/crypto.Address" json:"Address"`
	Storage              []*Storage                                     `protobuf:"bytes,2,rep,name=Storage,proto3" json:"Storage,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                                       `json:"-"`
	XXX_unrecognized     []byte                                         `json:"-"`
	XXX_sizecache        int32                                          `json:"-"`
}

func (*AccountStorage) Descriptor

func (*AccountStorage) Descriptor() ([]byte, []int)

func (*AccountStorage) GetStorage

func (m *AccountStorage) GetStorage() []*Storage

func (*AccountStorage) Marshal

func (m *AccountStorage) Marshal() (dAtA []byte, err error)

func (*AccountStorage) MarshalTo

func (m *AccountStorage) MarshalTo(dAtA []byte) (int, error)

func (*AccountStorage) MarshalToSizedBuffer

func (m *AccountStorage) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*AccountStorage) ProtoMessage

func (*AccountStorage) ProtoMessage()

func (*AccountStorage) Reset

func (m *AccountStorage) Reset()

func (*AccountStorage) Size

func (m *AccountStorage) Size() (n int)

func (*AccountStorage) String

func (m *AccountStorage) String() string

func (*AccountStorage) Unmarshal

func (m *AccountStorage) Unmarshal(dAtA []byte) error

func (*AccountStorage) XXX_DiscardUnknown

func (m *AccountStorage) XXX_DiscardUnknown()

func (*AccountStorage) XXX_Marshal

func (m *AccountStorage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*AccountStorage) XXX_Merge

func (m *AccountStorage) XXX_Merge(src proto.Message)

func (*AccountStorage) XXX_MessageName

func (*AccountStorage) XXX_MessageName() string

func (*AccountStorage) XXX_Size

func (m *AccountStorage) XXX_Size() int

func (*AccountStorage) XXX_Unmarshal

func (m *AccountStorage) XXX_Unmarshal(b []byte) error

type Blockchain

type Blockchain interface {
	ChainID() string
	LastBlockHeight() uint64
}

type CollectSink

type CollectSink struct {
	Rows    []string
	Current int
}

func (*CollectSink) Recv

func (c *CollectSink) Recv() (d *Dump, err error)

func (*CollectSink) Send

func (c *CollectSink) Send(d *Dump) error

type Dump

type Dump struct {
	Height               uint64          `protobuf:"varint,1,opt,name=Height,proto3" json:"Height,omitempty"`
	Account              *acm.Account    `protobuf:"bytes,2,opt,name=Account,proto3" json:"Account,omitempty"`
	AccountStorage       *AccountStorage `protobuf:"bytes,3,opt,name=AccountStorage,proto3" json:"AccountStorage,omitempty"`
	EVMEvent             *EVMEvent       `protobuf:"bytes,4,opt,name=EVMEvent,proto3" json:"EVMEvent,omitempty"`
	Name                 *names.Entry    `protobuf:"bytes,5,opt,name=Name,proto3" json:"Name,omitempty"`
	XXX_NoUnkeyedLiteral struct{}        `json:"-"`
	XXX_unrecognized     []byte          `json:"-"`
	XXX_sizecache        int32           `json:"-"`
}

func (*Dump) Descriptor

func (*Dump) Descriptor() ([]byte, []int)

func (*Dump) GetAccount

func (m *Dump) GetAccount() *acm.Account

func (*Dump) GetAccountStorage

func (m *Dump) GetAccountStorage() *AccountStorage

func (*Dump) GetEVMEvent

func (m *Dump) GetEVMEvent() *EVMEvent

func (*Dump) GetHeight

func (m *Dump) GetHeight() uint64

func (*Dump) GetName

func (m *Dump) GetName() *names.Entry

func (*Dump) Marshal

func (m *Dump) Marshal() (dAtA []byte, err error)

func (*Dump) MarshalTo

func (m *Dump) MarshalTo(dAtA []byte) (int, error)

func (*Dump) MarshalToSizedBuffer

func (m *Dump) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Dump) ProtoMessage

func (*Dump) ProtoMessage()

func (*Dump) Reset

func (m *Dump) Reset()

func (*Dump) Size

func (m *Dump) Size() (n int)

func (*Dump) String

func (m *Dump) String() string

func (*Dump) Unmarshal

func (m *Dump) Unmarshal(dAtA []byte) error

func (*Dump) XXX_DiscardUnknown

func (m *Dump) XXX_DiscardUnknown()

func (*Dump) XXX_Marshal

func (m *Dump) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Dump) XXX_Merge

func (m *Dump) XXX_Merge(src proto.Message)

func (*Dump) XXX_MessageName

func (*Dump) XXX_MessageName() string

func (*Dump) XXX_Size

func (m *Dump) XXX_Size() int

func (*Dump) XXX_Unmarshal

func (m *Dump) XXX_Unmarshal(b []byte) error

type Dumper

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

func NewDumper

func NewDumper(state *state.State, blockchain Blockchain) *Dumper

Return a Dumper that can Transmit Dump rows to a Sink by pulling them out of the the provided State

func (*Dumper) Source

func (ds *Dumper) Source(startHeight, endHeight uint64, options Option) Source

Return a Source that is a Pipe fed from this Dumper's Transmit function

func (*Dumper) Transmit

func (ds *Dumper) Transmit(sink Sink, startHeight, endHeight uint64, options Option) error

func (*Dumper) WithLogger

func (ds *Dumper) WithLogger(logger *logging.Logger) *Dumper

type EVMEvent

type EVMEvent struct {
	// The original ChainID from for this event
	ChainID string `protobuf:"bytes,1,opt,name=ChainID,proto3" json:"ChainID,omitempty"`
	// The original index for this event
	Index uint64 `protobuf:"varint,4,opt,name=Index,proto3" json:"Index,omitempty"`
	// The original block time for this transaction
	Time time.Time `protobuf:"bytes,2,opt,name=Time,proto3,stdtime" json:"Time"`
	// The event itself
	Event                *exec.LogEvent `protobuf:"bytes,3,opt,name=Event,proto3" json:"Event,omitempty"`
	XXX_NoUnkeyedLiteral struct{}       `json:"-"`
	XXX_unrecognized     []byte         `json:"-"`
	XXX_sizecache        int32          `json:"-"`
}

func (*EVMEvent) Descriptor

func (*EVMEvent) Descriptor() ([]byte, []int)

func (*EVMEvent) GetChainID

func (m *EVMEvent) GetChainID() string

func (*EVMEvent) GetEvent

func (m *EVMEvent) GetEvent() *exec.LogEvent

func (*EVMEvent) GetIndex

func (m *EVMEvent) GetIndex() uint64

func (*EVMEvent) GetTime

func (m *EVMEvent) GetTime() time.Time

func (*EVMEvent) Marshal

func (m *EVMEvent) Marshal() (dAtA []byte, err error)

func (*EVMEvent) MarshalTo

func (m *EVMEvent) MarshalTo(dAtA []byte) (int, error)

func (*EVMEvent) MarshalToSizedBuffer

func (m *EVMEvent) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*EVMEvent) ProtoMessage

func (*EVMEvent) ProtoMessage()

func (*EVMEvent) Reset

func (m *EVMEvent) Reset()

func (*EVMEvent) Size

func (m *EVMEvent) Size() (n int)

func (*EVMEvent) String

func (m *EVMEvent) String() string

func (*EVMEvent) Unmarshal

func (m *EVMEvent) Unmarshal(dAtA []byte) error

func (*EVMEvent) XXX_DiscardUnknown

func (m *EVMEvent) XXX_DiscardUnknown()

func (*EVMEvent) XXX_Marshal

func (m *EVMEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*EVMEvent) XXX_Merge

func (m *EVMEvent) XXX_Merge(src proto.Message)

func (*EVMEvent) XXX_MessageName

func (*EVMEvent) XXX_MessageName() string

func (*EVMEvent) XXX_Size

func (m *EVMEvent) XXX_Size() int

func (*EVMEvent) XXX_Unmarshal

func (m *EVMEvent) XXX_Unmarshal(b []byte) error

type MockSource

type MockSource struct {
	Accounts   int
	MaxStorage int
	Names      int
	Events     int
	*Mockchain
	// contains filtered or unexported fields
}

func NewMockSource

func NewMockSource(accounts, maxStorage, names, events int) *MockSource

func (*MockSource) Recv

func (m *MockSource) Recv() (*Dump, error)

type Mockchain

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

func NewMockchain

func NewMockchain(chainID string, lastBlockHeight uint64) *Mockchain

func (*Mockchain) ChainID

func (mc *Mockchain) ChainID() string

func (*Mockchain) LastBlockHeight

func (mc *Mockchain) LastBlockHeight() uint64

type NullSink

type NullSink struct{}

func (NullSink) Send

func (NullSink) Send(*Dump) error

type Option

type Option uint64
const (
	// Whether to send/receive these classes of data
	Accounts Option = 1 << iota
	Names
	Events
)
const (
	None Option = 0
	All         = Accounts | Names | Events
)

func (Option) Enabled

func (options Option) Enabled(option Option) bool

type Pipe

type Pipe chan msg

Implements both Sink and Source

func (Pipe) Recv

func (p Pipe) Recv() (*Dump, error)

func (Pipe) Send

func (p Pipe) Send(dump *Dump) error

type Sink

type Sink interface {
	Send(*Dump) error
}

type Source

type Source interface {
	Recv() (*Dump, error)
}

func NewFileReader

func NewFileReader(filename string) (Source, error)

type Storage

type Storage struct {
	Key                  github_com_klyed_hivesmartchain_binary.Word256  `protobuf:"bytes,1,opt,name=Key,proto3,customtype=github.com/klyed/hivesmartchain/binary.Word256" json:"Key"`
	Value                github_com_klyed_hivesmartchain_binary.HexBytes `protobuf:"bytes,2,opt,name=Value,proto3,customtype=github.com/klyed/hivesmartchain/binary.HexBytes" json:"Value"`
	XXX_NoUnkeyedLiteral struct{}                                        `json:"-"`
	XXX_unrecognized     []byte                                          `json:"-"`
	XXX_sizecache        int32                                           `json:"-"`
}

func (*Storage) Descriptor

func (*Storage) Descriptor() ([]byte, []int)

func (*Storage) Marshal

func (m *Storage) Marshal() (dAtA []byte, err error)

func (*Storage) MarshalTo

func (m *Storage) MarshalTo(dAtA []byte) (int, error)

func (*Storage) MarshalToSizedBuffer

func (m *Storage) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Storage) ProtoMessage

func (*Storage) ProtoMessage()

func (*Storage) Reset

func (m *Storage) Reset()

func (*Storage) Size

func (m *Storage) Size() (n int)

func (*Storage) String

func (m *Storage) String() string

func (*Storage) Unmarshal

func (m *Storage) Unmarshal(dAtA []byte) error

func (*Storage) XXX_DiscardUnknown

func (m *Storage) XXX_DiscardUnknown()

func (*Storage) XXX_Marshal

func (m *Storage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Storage) XXX_Merge

func (m *Storage) XXX_Merge(src proto.Message)

func (*Storage) XXX_MessageName

func (*Storage) XXX_MessageName() string

func (*Storage) XXX_Size

func (m *Storage) XXX_Size() int

func (*Storage) XXX_Unmarshal

func (m *Storage) XXX_Unmarshal(b []byte) error

type StreamReader

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

func NewJSONReader

func NewJSONReader(reader io.Reader) (*StreamReader, error)

func NewProtobufReader

func NewProtobufReader(reader io.Reader) (*StreamReader, error)

func NewStreamReader

func NewStreamReader(reader io.Reader, decode func(*Dump) error) (*StreamReader, error)

func (*StreamReader) Recv

func (sr *StreamReader) Recv() (*Dump, error)

Jump to

Keyboard shortcuts

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