digest

package
v0.0.0-...-0136f3d Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2024 License: GPL-3.0 Imports: 39 Imported by: 0

Documentation

Overview

Package digest provides api features.

Index

Constants

This section is empty.

Variables

View Source
var (
	HandlerPathStorageDesign  = `/storage/{contract:(?i)` + types.REStringAddressString + `}`
	HandlerPathStorageData    = `/storage/{contract:(?i)` + types.REStringAddressString + `}/datakey/{data_key:` + types.ReSpecialCh + `}`
	HandlerPathStorageHistory = `/storage/{contract:(?i)` + types.REStringAddressString + `}/datakey/{data_key:` + types.ReSpecialCh + `}/history`
)

Functions

func DigestBlock

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

func LoadStorageData

func LoadStorageData(decoder func(interface{}) error, encs *encoder.Encoders) (*types.Data, int64, string, string, bool, error)

func LoadStorageDataFromDoc

func LoadStorageDataFromDoc(b []byte, encs *encoder.Encoders) (bson.Raw, interface{}, int64, string, string, bool, error)

func SotrageDataHistoryByDataKey

func SotrageDataHistoryByDataKey(
	st *cdigest.Database,
	contract,
	key string,
	reverse bool,
	offset string,
	limit int64,
	callback func(*types.Data, int64, string, string, bool) (bool, error),
) error

func StorageData

func StorageData(db *cdigest.Database, contract, key string) (*types.Data, int64, string, string, bool, error)

func StorageDesign

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

Types

type BlockSession

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

func (*BlockSession) Close

func (bs *BlockSession) Close() error

func (*BlockSession) Commit

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

func (*BlockSession) Prepare

func (bs *BlockSession) Prepare() error

type Digester

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

func NewDigester

func NewDigester(
	st *currencydigest.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 *currencydigest.Database,
	cache currencydigest.Cache,
	router *mux.Router,
	routes map[string]*mux.Route,
) *Handlers

func (*Handlers) Cache

func (hd *Handlers) Cache() currencydigest.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

type StorageDataDoc

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

func NewStorageDataDoc

func NewStorageDataDoc(st base.State, timestamp time.Time, enc encoder.Encoder) (StorageDataDoc, error)

func (StorageDataDoc) MarshalBSON

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

type StorageDataDocBSONUnMarshaler

type StorageDataDocBSONUnMarshaler struct {
	I  bson.Raw      `bson:"_id,omitempty"`
	E  string        `bson:"_e"`
	D  bson.RawValue `bson:"d"`
	H  bool          `bson:"_hinted"`
	HT int64         `bson:"height"`
	O  string        `bson:"operation"`
	T  string        `bson:"timestamp"`
	DL bool          `bson:"deleted"`
}

type StorageDesignDoc

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

func NewStorageDesignDoc

func NewStorageDesignDoc(st base.State, enc encoder.Encoder) (StorageDesignDoc, error)

NewStorageDesignDoc get the State of Storage Design

func (StorageDesignDoc) MarshalBSON

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

Jump to

Keyboard shortcuts

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