resource

package
v0.0.0-...-d0512a4 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CurrencyDisplayScale = big.NewFloat(1.0e-18)

Functions

func ConvertPricingTables

func ConvertPricingTables(tables []*pb.PricingTable) map[common.Address]PricingTableMap

func FormatWithScaleFactor

func FormatWithScaleFactor(amount *big.Float) string

func GetTablesPrices

func GetTablesPrices(pricingTables map[common.Address]PricingTableMap) ([][numResources]*big.Int, error)

Types

type NamespaceConsumptions

type NamespaceConsumptions map[string]ResourceConsumptions

func (NamespaceConsumptions) Add

func (r NamespaceConsumptions) Add(namespace string, resource *Resource, value *big.Float)

func (NamespaceConsumptions) Display

func (r NamespaceConsumptions) Display(writer io.Writer, priceTableMap PricingTableMap)

func (NamespaceConsumptions) Price

func (r NamespaceConsumptions) Price(priceTableMap PricingTableMap) map[string]*big.Int

type PricingTableMap

type PricingTableMap map[*Resource]*big.Float

func NewPricingTableMap

func NewPricingTableMap(table *pb.PricingTable) PricingTableMap

type Resource

type Resource struct {
	Name      string
	Kind      ResourceKind
	Unit      string
	UseMillis bool
}

func GetResource

func GetResource(name string, kind ResourceKind) *Resource

func (*Resource) Format

func (r *Resource) Format(amount *big.Float) string

type ResourceConsumptions

type ResourceConsumptions map[*Resource]consumption

func (ResourceConsumptions) Price

func (r ResourceConsumptions) Price(priceTableMap PricingTableMap) *big.Int

type ResourceKind

type ResourceKind uint8
const (
	ResourceKindReservation ResourceKind = 0
	ResourceKindUsage       ResourceKind = 1
)

func (ResourceKind) Text

func (r ResourceKind) Text() string

Jump to

Keyboard shortcuts

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