digest

package
v0.0.0-...-dcea795 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: GPL-3.0 Imports: 41 Imported by: 0

Documentation

Overview

Package digest provides api features.

Index

Constants

View Source
const MaxContractQueryBodyBytes = 128 * 1024

Variables

View Source
var (
	DefaultColNameContract         = "digest_sc"
	DefaultColNameContractRuntime  = "digest_sc_runtime"
	DefaultColNameContractSnapshot = "digest_sc_snapshot"
)
View Source
var (
	HandlerPathContractDesign = `/contract/{contract:(?i)` + ctypes.REStringAddressString + `}`
	HandlerPathContractQuery  = `/contract/{contract:(?i)` + ctypes.REStringAddressString + `}/query`
)
View Source
var DefaultIndexes = map[string][]mongo.IndexModel{

	DefaultColNameContract:         contractDesignIndexModels,
	DefaultColNameContractRuntime:  contractRuntimeIndexModels,
	DefaultColNameContractSnapshot: contractSnapshotIndexModels,
	// contains filtered or unexported fields
}

Functions

func ContractDesign

func ContractDesign(st *cdigest.Database, contract string) (types.Design, base.State, error)

func ContractDesignFromChainState

func ContractDesignFromChainState(db *cdigest.Database, contract string) (base.Address, types.Design, base.State, error)

func ContractRuntimeFromChainState

func ContractRuntimeFromChainState(
	db *cdigest.Database,
	contract string,
) (base.Address, state.RuntimeStateValue, base.State, bool, error)

func ContractSnapshotFromChainState

func ContractSnapshotFromChainState(
	db *cdigest.Database,
	contract string,
) (base.Address, state.SnapshotStateValue, base.State, bool, error)

func DigestBlock

func DigestBlock(
	ctx context.Context,
	st *cdigest.Database,
	blk base.BlockMap,
	ops []base.Operation,
	opsTree fixedtree.Tree,
	sts []base.State,
	proposal base.ProposalSignFact,
	vs string,
) error

Types

type BlockSession

type BlockSession struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewBlockSession

func NewBlockSession(
	st *cdigest.Database,
	blk base.BlockMap,
	ops []base.Operation,
	opsTree fixedtree.Tree,
	sts []base.State,
	proposal base.ProposalSignFact,
	vs string,
) (*BlockSession, error)

func (*BlockSession) Close

func (bs *BlockSession) Close() error

func (*BlockSession) Commit

func (bs *BlockSession) Commit(ctx context.Context) error

func (*BlockSession) Prepare

func (bs *BlockSession) Prepare() error

type ContractDesignDoc

type ContractDesignDoc struct {
	mongodb.BaseDoc
	// contains filtered or unexported fields
}

func NewContractDesignDoc

func NewContractDesignDoc(st base.State, enc encoder.Encoder) (ContractDesignDoc, error)

func (ContractDesignDoc) MarshalBSON

func (doc ContractDesignDoc) MarshalBSON() ([]byte, error)

type ContractQueryOutput

type ContractQueryOutput struct {
	Result interface{} `json:"result"`
	Ok     *bool       `json:"ok,omitempty"`
}

type ContractQueryResponse

type ContractQueryResponse struct {
	Contract string              `json:"contract"`
	Function string              `json:"function"`
	Engine   string              `json:"engine"`
	ReadOnly bool                `json:"read_only"`
	Output   ContractQueryOutput `json:"output"`
}

type ContractRuntimeDoc

type ContractRuntimeDoc struct {
	mongodb.BaseDoc
	// contains filtered or unexported fields
}

func NewContractRuntimeDoc

func NewContractRuntimeDoc(st base.State, enc encoder.Encoder) (ContractRuntimeDoc, error)

func (ContractRuntimeDoc) MarshalBSON

func (doc ContractRuntimeDoc) MarshalBSON() ([]byte, error)

type ContractSnapshotDoc

type ContractSnapshotDoc struct {
	mongodb.BaseDoc
	// contains filtered or unexported fields
}

func NewContractSnapshotDoc

func NewContractSnapshotDoc(st base.State, enc encoder.Encoder) (ContractSnapshotDoc, error)

func (ContractSnapshotDoc) MarshalBSON

func (doc ContractSnapshotDoc) MarshalBSON() ([]byte, error)

type Digester

type Digester struct {
	sync.RWMutex
	*util.ContextDaemon
	*logging.Logging
	// contains filtered or unexported fields
}

func NewDigester

func NewDigester(
	st *cdigest.Database,
	root string,
	sourceReaders *isaac.BlockItemReaders,
	fromRemotes isaac.RemotesBlockItemReadFunc,
	networkID base.NetworkID,
	vs string,
	errChan chan error,
) *Digester

func (*Digester) Digest

func (di *Digester) Digest(blocks []base.BlockMap)

type Handlers

type Handlers struct {
	*zerolog.Logger
	// contains filtered or unexported fields
}

func NewHandlers

func NewHandlers(
	ctx context.Context,
	networkID base.NetworkID,
	encs *encoder.Encoders,
	enc encoder.Encoder,
	st *cdigest.Database,
	cache cdigest.Cache,
	router *mux.Router,
	routes map[string]*mux.Route,
) *Handlers

func (*Handlers) Cache

func (hd *Handlers) Cache() cdigest.Cache

func (*Handlers) Handler

func (hd *Handlers) Handler() http.Handler

func (*Handlers) Initialize

func (hd *Handlers) Initialize() error

func (*Handlers) Router

func (hd *Handlers) Router() *mux.Router

func (*Handlers) Routes

func (hd *Handlers) Routes() map[string]*mux.Route

func (*Handlers) SetLimiter

func (hd *Handlers) SetLimiter(f func(string) int64) *Handlers

Jump to

Keyboard shortcuts

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