abicodec

package
v0.2.16 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2022 License: Apache-2.0 Imports: 32 Imported by: 0

README

ABI Encoder / Decoder Service

This service keeps a live-updating cache of all ABIs at any point in time, and allows consistent encoding and decoding of table rows or action payloads, at any block height or block ID.

Usage

Exposed through the REST interface currently. See https://docs.dfuse.io/reference/zswhq/rest/state-abi-decode/

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ABICacheItem

type ABICacheItem struct {
	ABI      *zsw.ABI
	BlockNum uint32
}

type ABISyncer

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

func NewSyncer

func NewSyncer(cache Cache, dbReader trxdb.DBReader, searchAddr string, onLive func()) (*ABISyncer, error)

func (*ABISyncer) Sync

func (s *ABISyncer) Sync()

type Backuper

type Backuper struct {
	*shutter.Shutter

	IsLive bool
	// contains filtered or unexported fields
}

func NewBackuper

func NewBackuper(cache Cache, exportABIsEnabled bool, exportABIsBaseURL, exportABIsFilename string) *Backuper

func (*Backuper) BackupPeriodically

func (b *Backuper) BackupPeriodically(every time.Duration)

type Cache

type Cache interface {
	ABIAtBlockNum(account string, blockNum uint32) *ABICacheItem
	SetABIAtBlockNum(account string, blockNum uint32, abi *zsw.ABI)
	RemoveABIAtBlockNum(account string, blockNum uint32)
	SaveState() error
	SetCursor(cursor string)
	GetCursor() string
	Export(baseURL string, filename string) error
}

type Decoder

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

func NewDecoder

func NewDecoder(cache Cache) *Decoder

func (*Decoder) DecodeAction

func (*Decoder) DecodeTable

func (*Decoder) GetAbi

type DefaultCache

type DefaultCache struct {
	Abis   map[string][]*ABICacheItem // from account to the ABIs in range
	Cursor string                     `json:"cursor"`
	// contains filtered or unexported fields
}

func NewABICache

func NewABICache(store dstore.Store, cacheName string) (*DefaultCache, error)

func (*DefaultCache) ABIAtBlockNum

func (c *DefaultCache) ABIAtBlockNum(account string, blockNum uint32) *ABICacheItem

func (*DefaultCache) Export

func (c *DefaultCache) Export(baseURL, filename string) error

func (*DefaultCache) GetCursor

func (c *DefaultCache) GetCursor() string

func (*DefaultCache) Load

func (c *DefaultCache) Load(workerID string) (string, error)

func (*DefaultCache) RemoveABIAtBlockNum

func (c *DefaultCache) RemoveABIAtBlockNum(account string, blockNum uint32)

func (*DefaultCache) Save

func (c *DefaultCache) Save(cursor string, workerID string) error

func (*DefaultCache) SaveState

func (c *DefaultCache) SaveState() error

func (*DefaultCache) SetABIAtBlockNum

func (c *DefaultCache) SetABIAtBlockNum(account string, blockNum uint32, abi *zsw.ABI)

func (*DefaultCache) SetCursor

func (c *DefaultCache) SetCursor(cursor string)

type IsLive

type IsLive chan interface{}

type Server

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

func NewServer

func NewServer(cache Cache, grpcListenAddr string) *Server

func (*Server) Serve

func (s *Server) Serve()

func (*Server) SetReady

func (s *Server) SetReady()

func (*Server) Stop

func (s *Server) Stop(err error)

Directories

Path Synopsis
app

Jump to

Keyboard shortcuts

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