types

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AbciInfoResponse added in v1.9.0

type AbciInfoResponse struct {
	Result struct {
		Response struct {
			LastBlockHeight string `json:"last_block_height"`
		} `json:"response"`
	} `json:"result"`
}

type BlockCollector added in v1.9.0

type BlockCollector interface {
	// GetEarliestAvailableHeight gets the earliest available block in a block pool
	GetEarliestAvailableHeight() int64

	// GetLatestAvailableHeight gets the latest available block in a block pool
	GetLatestAvailableHeight() int64

	// GetBlock gets the block for the given height
	GetBlock(height int64) ([]byte, error)

	// StreamBlocks takes a continuationHeight and a targetHeight and streams
	// all blocks in order into a given block channel. This method exits once
	// the target height is reached or runs indefinitely depending on the
	// exitOnTargetHeight value
	StreamBlocks(blockCh chan<- *BlockItem, errorCh chan<- error, continuationHeight, targetHeight int64)
}

BlockCollector is an interface defining common behaviour for each type of collecting blocks, since blocks can be either obtained with requesting the rpc endpoint of the source chain or with downloading archived bundles from KYVE

type BlockItem added in v1.9.0

type BlockItem struct {
	Height int64
	Block  json.RawMessage
}

type Bundle

type Bundle = []DataItem

type Codebase added in v1.6.0

type Codebase struct {
	GitUrl   string         `yaml:"git-url"`
	Settings CosmosSettings `yaml:"settings"`
}

type CosmosSettings added in v1.6.0

type CosmosSettings struct {
	Upgrades []CosmosUpgrade `yaml:"upgrades"`
}

type CosmosUpgrade added in v1.6.0

type CosmosUpgrade struct {
	Name               string `yaml:"name"`
	Height             string `yaml:"height"`
	RecommendedVersion string `yaml:"recommended-version"`
	Engine             string `yaml:"ksync-engine"`
}

type DataItem

type DataItem struct {
	Key   string          `json:"key"`
	Value json.RawMessage `json:"value"`
}

type Engine added in v1.1.0

type Engine interface {
	// GetName gets the name of the engine
	GetName() string

	// LoadConfig loads and sets the config
	LoadConfig() error

	// OpenDBs opens the relevant blockstore and state DBs
	OpenDBs() error

	// CloseDBs closes the relevant blockstore and state DBs
	CloseDBs() error

	// GetRpcListenAddress gets the address the rpc endpoint is hosted
	GetRpcListenAddress() string

	// GetProxyAppAddress gets the proxy app address of the TSP connection
	GetProxyAppAddress() string

	// StartProxyApp starts the proxy app connections to the app
	StartProxyApp() error

	// StopProxyApp stops the proxy app connections to the app
	StopProxyApp() error

	// DoHandshake does a handshake with the app and needs to be called
	// before ApplyBlock
	DoHandshake() error

	// ApplyBlock takes a block at height n and n+1 and applies it against
	// the cosmos app
	ApplyBlock(rawBlock, nextRawBlock []byte) error

	// ApplyFirstBlockOverP2P applies the first block over the P2P reactor
	// which is necessary, if the genesis file is bigger than 100MB
	ApplyFirstBlockOverP2P(rawBlock, nextRawBlock []byte) error

	// GetHeight gets the latest height stored in the blockstore.db
	GetHeight() int64

	// GetBaseHeight gets the earliest height stored in the blockstore.db
	GetBaseHeight() int64

	// GetAppHeight gets over ABCI the latest block height tracked by the app
	GetAppHeight() (int64, error)

	// GetSnapshots gets the available snapshots over ABCI from the app
	GetSnapshots() ([]byte, error)

	// IsSnapshotAvailable gets available snapshots over ABCI from the app
	// and checks if the requested snapshot is available
	IsSnapshotAvailable(height int64) (bool, error)

	// GetSnapshotChunk gets the requested snapshot chunk over ABCI from the
	// app
	GetSnapshotChunk(height, format, chunk int64) ([]byte, error)

	// GetBlock loads the requested block from the blockstore.db
	GetBlock(height int64) ([]byte, error)

	// StartRPCServer spins up a basic rpc server of the engine which serves
	// /status, /block and /block_results
	StartRPCServer(port int64)

	// GetState rebuilds the requested state from the blockstore and state.db
	GetState(height int64) ([]byte, error)

	// GetSeenCommit loads the seen commit from the blockstore.db
	GetSeenCommit(height int64) ([]byte, error)

	// OfferSnapshot offers a snapshot over ABCI to the app
	OfferSnapshot(rawSnapshot, rawState []byte) error

	// ApplySnapshotChunk applies a snapshot chunk over ABCI to the app
	ApplySnapshotChunk(chunkIndex int64, chunk []byte) error

	// BootstrapState initializes the tendermint state
	BootstrapState(rawState, rawSeenCommit, rawBlock []byte) error

	// PruneBlocks prunes blocks from the block store and state store
	// from the earliest found base height to the specified height
	PruneBlocks(toHeight int64) error

	// ResetAll removes all the data and WAL, reset this node's validator
	// to genesis state
	ResetAll(keepAddrBook bool) error
}

Engine is an interface defining common behaviour for each consensus engine. Currently, both tendermint-v34 and cometbft-v38 are supported

type Entry added in v1.1.0

type Entry struct {
	ConfigVersion *int     `yaml:"config-version"`
	Networks      Networks `yaml:"networks"`
	SourceID      string   `yaml:"source-id"`
	Codebase      Codebase `yaml:"codebase"`
}

type FinalizedBundle

type FinalizedBundle struct {
	Id                string `json:"id,omitempty"`
	StorageId         string `json:"storage_id,omitempty"`
	StorageProviderId string `json:"storage_provider_id,omitempty"`
	CompressionId     string `json:"compression_id,omitempty"`
	FromKey           string `json:"from_key,omitempty"`
	ToKey             string `json:"to_key,omitempty"`
	DataHash          string `json:"data_hash,omitempty"`
}

type FinalizedBundlesResponse added in v1.0.0

type FinalizedBundlesResponse = struct {
	FinalizedBundles []FinalizedBundle `json:"finalized_bundles"`
	Pagination       Pagination        `json:"pagination"`
}

type Integrations added in v1.2.3

type Integrations struct {
	KSYNC *KSYNCIntegration `yaml:"ksync,omitempty"`
}

type KSYNCIntegration added in v1.2.3

type KSYNCIntegration struct {
	BlockSyncPool *int `yaml:"block-sync-pool"`
	StateSyncPool *int `yaml:"state-sync-pool"`
}

type NetworkProperties added in v1.2.3

type NetworkProperties struct {
	LatestBlockKey *string
	LatestStateKey *string
	BlockStartKey  *string
	StateStartKey  *string
	Integrations   *Integrations   `yaml:"integrations,omitempty"`
	Pools          *[]Pool         `yaml:"pools,omitempty"`
	SourceMetadata *SourceMetadata `yaml:"properties,omitempty"`
}

type Networks added in v1.2.3

type Networks struct {
	Kaon *NetworkProperties `yaml:"kaon-1,omitempty"`
	Kyve *NetworkProperties `yaml:"kyve-1,omitempty"`
}

type Pagination

type Pagination struct {
	NextKey []byte `json:"next_key"`
}

type Pool added in v1.2.3

type Pool struct {
	Id      *int   `yaml:"id"`
	Runtime string `yaml:"runtime"`
}

type PoolResponse

type PoolResponse = struct {
	Pool struct {
		Id   int64 `json:"id"`
		Data struct {
			Runtime        string `json:"runtime"`
			StartKey       string `json:"start_key"`
			CurrentKey     string `json:"current_key"`
			CurrentSummary string `json:"current_summary"`
			TotalBundles   int64  `json:"total_bundles"`
			Config         string `json:"config"`
		} `json:"data"`
	} `json:"pool"`
}

type Snapshot added in v1.0.0

type Snapshot struct {
	Height   uint64 `json:"height,omitempty"`
	Format   uint32 `json:"format,omitempty"`
	Chunks   uint32 `json:"chunks,omitempty"`
	Hash     []byte `json:"hash,omitempty"`
	Metadata []byte `json:"metadata,omitempty"`
}

type SnapshotBundle added in v1.9.0

type SnapshotBundle = []SnapshotDataItem

type SnapshotCollector added in v1.9.0

type SnapshotCollector interface {
	// GetEarliestAvailableHeight gets the earliest available snapshot height in
	// a snapshot pool
	GetEarliestAvailableHeight() int64

	// GetLatestAvailableHeight gets the latest available snapshot height in
	// a snapshot pool
	GetLatestAvailableHeight() int64

	// GetInterval gets the snapshot interval
	GetInterval() int64

	// GetCurrentHeight gets the current height of the latest snapshot. This snapshot
	// is not guaranteed to be fully available and chunks can still be missing
	GetCurrentHeight() (int64, error)

	// GetSnapshotHeight gets the exact height of the nearest snapshot before the target
	// height
	GetSnapshotHeight(targetHeight int64, isServeSnapshot bool) int64

	// GetSnapshotFromBundleId gets the snapshot from the given bundle
	GetSnapshotFromBundleId(bundleId int64) (*SnapshotDataItem, error)

	// DownloadChunkFromBundleId downloads the snapshot chunk from the given bundle
	DownloadChunkFromBundleId(bundleId int64) ([]byte, error)

	// FindSnapshotBundleIdForHeight searches and returns the bundle id which contains the first
	// snapshot chunk for the given height.
	// Since we do not know how many chunks a bundle has but expect that the snapshots are ordered by height
	// we can apply a binary search to minimize the amount of requests we have to make. This method fails
	// if there is no bundle which contains the snapshot at the target height
	FindSnapshotBundleIdForHeight(height int64) (int64, error)
}

SnapshotCollector is an interface defining behaviour for collecting snapshots

type SnapshotDataItem added in v1.9.0

type SnapshotDataItem struct {
	Key   string `json:"key"`
	Value struct {
		Snapshot   json.RawMessage `json:"snapshot"`
		Block      json.RawMessage `json:"block"`
		SeenCommit json.RawMessage `json:"seenCommit"`
		State      json.RawMessage `json:"state"`
		ChunkIndex uint32          `json:"chunkIndex"`
		Chunk      []byte          `json:"chunk"`
	} `json:"value"`
}

type SourceMetadata added in v1.1.0

type SourceMetadata struct {
	Title string `yaml:"title"`
}

type SourceRegistry added in v1.1.0

type SourceRegistry struct {
	Entries map[string]Entry `yaml:",inline"`
}

type StatusResponse added in v1.7.0

type StatusResponse struct {
	Result struct {
		SyncInfo struct {
			LatestBlockHeight   int64 `json:"latest_block_height"`
			EarliestBlockHeight int64 `json:"earliest_block_height"`
		} `json:"sync_info"`
	} `json:"result"`
}

type SupportedChain added in v1.0.0

type SupportedChain = struct {
	BlockPoolId    string `json:"block_pool_id"`
	ChainId        string `json:"chain-id"`
	LatestBlockKey string `json:"latest_block_key"`
	LatestStateKey string `json:"latest_state_key"`
	Name           string `json:"name"`
	StatePoolId    string `json:"state_pool_id"`
}

type TendermintSSyncConfig added in v1.0.0

type TendermintSSyncConfig = struct {
	Api      string `json:"api"`
	Interval int64  `json:"interval"`
}

Jump to

Keyboard shortcuts

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