shared

package
v3.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: AGPL-3.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DefaultMaxBatchSize   uint64 = 100
	DefaultMaxBatchNumber int64  = 50

	GcachePoolEnabled             = "GCACHE_POOL_ENABLED"
	GcachePoolHttpPath            = "GCACHE_POOL_HTTP_PATH"
	GcachePoolHttpPeers           = "GCACHE_POOL_HTTP_PEERS"
	GcacheStatedbCacheSize        = "GCACHE_STATEDB_CACHE_SIZE"
	GcacheStatedbCacheExpiry      = "GCACHE_STATEDB_CACHE_EXPIRY"
	GcacheStatedbLogStatsInterval = "GCACHE_STATEDB_LOG_STATS_INTERVAL"
)

Variables

This section is empty.

Functions

func FetchIPLD

func FetchIPLD(tx *sqlx.Tx, cid string) ([]byte, error)

FetchIPLD is used to retrieve an ipld from Postgres blockstore with the provided tx and cid string

func FetchIPLDByMhKey

func FetchIPLDByMhKey(tx *sqlx.Tx, mhKey string) ([]byte, error)

FetchIPLDByMhKey is used to retrieve an ipld from Postgres blockstore with the provided tx and mhkey string

func HandleZeroAddr

func HandleZeroAddr(to common.Address) string

HandleZeroAddr will return an empty string for a 0 value address

func HandleZeroAddrPointer

func HandleZeroAddrPointer(to *common.Address) string

HandleZeroAddrPointer will return an emtpy string for a nil address pointer

func IPLDsContainBytes

func IPLDsContainBytes(iplds []models.IPLDModel, b []byte) bool

IPLDsContainBytes used to check if a list of strings contains a particular string

func MultihashKeyFromCID

func MultihashKeyFromCID(c cid.Cid) string

MultihashKeyFromCID converts a cid into a blockstore-prefixed multihash db key string

func MultihashKeyFromCIDString

func MultihashKeyFromCIDString(c string) (string, error)

MultihashKeyFromCIDString converts a cid string into a blockstore-prefixed multihash db key string

func NewDB

func NewDB(connectString string, config postgres.Config) (*sqlx.DB, error)

NewDB creates a new db connection and initializes the connection pool

func PublishIPLD

func PublishIPLD(tx *sqlx.Tx, i node.Node) error

PublishIPLD is used to insert an ipld into Postgres blockstore with the provided tx

func PublishRaw

func PublishRaw(tx *sqlx.Tx, codec, mh uint64, raw []byte) (string, error)

PublishRaw derives a cid from raw bytes and provided codec and multihash type, and writes it to the db tx

func Rollback

func Rollback(tx *sqlx.Tx)

Rollback sql transaction and log any error

func SetupDB

func SetupDB() *sqlx.DB

SetupDB is use to setup a db for watcher tests

func SetupTestStateDiffIndexer

func SetupTestStateDiffIndexer(ctx context.Context, chainConfig *params.ChainConfig, genHash common.Hash) interfaces.StateDiffIndexer

func TearDownDB

func TearDownDB(db *sqlx.DB)

TearDownDB is used to tear down the watcher dbs after tests

Types

type GroupCacheConfig

type GroupCacheConfig struct {
	Pool    PoolConfig
	StateDB GroupConfig
}

type GroupConfig

type GroupConfig struct {
	CacheSizeInMB          int
	CacheExpiryInMins      int
	LogStatsIntervalInSecs int

	// Used in tests to override the cache name, to work around
	// the "duplicate registration of group" error from groupcache
	Name string
}

type PoolConfig

type PoolConfig struct {
	Enabled           bool
	HttpEndpoint      string
	PeerHttpEndpoints []string
}

Jump to

Keyboard shortcuts

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