models

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusApplied       = "applied"
	StatusBranchDelayed = "branch_delayed"
	StatusBranchRefused = "branch_refused"
	StatusRefused       = "refused"
	StatusInChain       = "in_chain"
	StatusExpired       = "expired"
)

Statuses

View Source
const (
	IndexTypeMempool = "mempool"
)

Variables

This section is empty.

Functions

func DeleteOldGasStats

func DeleteOldGasStats(db *gorm.DB, timeout uint64) error

DeleteOldGasStats -

func DeleteOldOperations

func DeleteOldOperations(db *gorm.DB, timeout uint64, status string, kinds ...string) error

DeleteOldOperations -

func GetModelsBy

func GetModelsBy(kinds ...string) []interface{}

GetModelsBy -

func MempoolIndexName

func MempoolIndexName(network string) string

MempoolIndexName -

func OpenDatabaseConnection

func OpenDatabaseConnection(cfg config.Database, kinds ...string) (*gorm.DB, error)

OpenDatabaseConnection -

func Rollback

func Rollback(db *gorm.DB, network, branch string, level uint64, kinds ...string) error

Rollback -

func SetExpired

func SetExpired(db *gorm.DB, network, branch string, kinds ...string) error

SetExpired -

func SetInChain

func SetInChain(db *gorm.DB, network, hash, kind string, level uint64) error

SetInChain -

Types

type ActivateAccount

type ActivateAccount struct {
	MempoolOperation
	Pkh    string `json:"pkh"`
	Secret string `json:"secret"`
}

ActivateAccount -

func (ActivateAccount) TableName

func (ActivateAccount) TableName() string

TableName -

type Ballot

type Ballot struct {
	MempoolOperation
	Period int64  `json:"period"`
	Ballot string `json:"ballot"`
}

Ballot -

func (Ballot) TableName

func (Ballot) TableName() string

TableName -

type Delegation

type Delegation struct {
	MempoolOperation
	Fee          int64  `json:"fee,string"`
	Counter      int64  `gorm:"primaryKey" json:"counter,string"`
	GasLimit     int64  `json:"gas_limit,string"`
	StorageLimit int64  `json:"storage_limit,string"`
	Delegate     string `json:",omitempty"`
	Source       string `json:"source,omitempty" gorm:"delegation_source_idx"`
}

Delegation -

func (Delegation) TableName

func (Delegation) TableName() string

TableName -

type DoubleBaking

type DoubleBaking struct {
	MempoolOperation
	Bh1 DoubleBakingInfo `json:"bh1" gorm:"-"`
	Bh2 DoubleBakingInfo `json:"bh2" gorm:"-"`

	Bh1Level            uint64 `json:"-" gorm:"column:bh_1_level"`
	Bh1Proto            int64  `json:"-" gorm:"column:bh_1_proto"`
	Bh1ValidationPass   int64  `json:"-" gorm:"column:bh_1_validation_pass"`
	Bh1Priority         int64  `json:"-" gorm:"column:bh_1_priority"`
	Bh1ProofOfWorkNonce string `json:"-" gorm:"column:bh_1_proof_of_work_nonce"`

	Bh2Level            uint64 `json:"-" gorm:"column:bh_2_level"`
	Bh2Proto            int64  `json:"-" gorm:"column:bh_2_proto"`
	Bh2ValidationPass   int64  `json:"-" gorm:"column:bh_2_validation_pass"`
	Bh2Priority         int64  `json:"-" gorm:"column:bh_2_priority"`
	Bh2ProofOfWorkNonce string `json:"-" gorm:"column:bh_2_proof_of_work_nonce"`
}

DoubleBaking -

func (*DoubleBaking) Fill

func (mdb *DoubleBaking) Fill()

Fill -

func (DoubleBaking) TableName

func (DoubleBaking) TableName() string

TableName -

type DoubleBakingInfo

type DoubleBakingInfo struct {
	Level            uint64   `json:"level"`
	Proto            int64    `json:"proto"`
	ValidationPass   int64    `json:"validation_pass"`
	Fitness          []string `json:"fitness"`
	Priority         int64    `json:"priority"`
	ProofOfWorkNonce string   `json:"proof_of_work_nonce"`
}

DoubleBakingInfo -

type DoubleEndorsing

type DoubleEndorsing struct {
	MempoolOperation
	Op1Kind  string `json:"-" gorm:"column:op_1_kind"`
	Op1Level uint64 `json:"-" gorm:"column:op_1_level"`
	Op2Kind  string `json:"-" gorm:"column:op_2_kind"`
	Op2Level uint64 `json:"-" gorm:"column:op_2_level"`

	Op1 struct {
		Operations DoubleEndorsingOperations `json:"operations"`
	} `json:"op1" gorm:"-"`
	Op2 struct {
		Operations DoubleEndorsingOperations `json:"operations"`
	} `json:"op2" gorm:"-"`
}

DoubleEndorsing -

func (*DoubleEndorsing) Fill

func (mde *DoubleEndorsing) Fill()

Fill -

func (DoubleEndorsing) TableName

func (DoubleEndorsing) TableName() string

TableName -

type DoubleEndorsingOperations

type DoubleEndorsingOperations struct {
	Kind  string `json:"kind"`
	Level uint64 `json:"level"`
}

DoubleEndorsingOperations -

type Endorsement

type Endorsement struct {
	MempoolOperation
	Level uint64 `json:"level"`
	Baker string `json:"-" gorm:"transaction_baker_idx"`
}

Endorsement -

func EndorsementsWithoutBaker

func EndorsementsWithoutBaker(tx *gorm.DB) (endorsements []Endorsement, err error)

EndorsementsWithoutBaker -

func (Endorsement) Forge

func (endorsement Endorsement) Forge() ([]byte, error)

Forge -

func (Endorsement) TableName

func (Endorsement) TableName() string

TableName -

type GasStats

type GasStats struct {
	Network        string `gorm:"primaryKey" json:"network"`
	Hash           string `gorm:"primaryKey" json:"hash"`
	TotalGasUsed   uint64 `gorm:"column:total_gas_used" json:"total_gas_used"`
	TotalFee       uint64 `gorm:"column:total_fee" json:"total_fee"`
	UpdatedAt      int    `gorm:"autoUpdateTime" json:"updated_at"`
	LevelInMempool uint64 `json:"level_in_mempool"`
	LevelInChain   uint64 `json:"level_in_chain"`
}

GasStats -

func (*GasStats) Save

func (s *GasStats) Save(tx *gorm.DB) error

Append -

func (GasStats) TableName

func (GasStats) TableName() string

TableName -

type MempoolOperation

type MempoolOperation struct {
	CreatedAt       int            `gorm:"autoCreateTime"`
	UpdatedAt       int            `gorm:"autoUpdateTime"`
	Network         string         `gorm:"primaryKey" json:"network"`
	Hash            string         `gorm:"primaryKey" json:"hash"`
	Branch          string         `json:"branch"`
	Status          string         `json:"status"`
	Kind            string         `json:"kind"`
	Signature       string         `json:"signature"`
	Protocol        string         `json:"protocol"`
	Level           uint64         `json:"level"`
	Errors          datatypes.JSON `json:"errors,omitempty"`
	ExpirationLevel *uint64        `json:"expiration_level"`
	Raw             datatypes.JSON `json:"raw,omitempty"`
}

MempoolOperation -

type NonceRevelation

type NonceRevelation struct {
	MempoolOperation
	Level int    `json:"level"`
	Nonce string `json:"nonce"`
}

NonceRevelation -

func (NonceRevelation) TableName

func (NonceRevelation) TableName() string

TableName -

type Origination

type Origination struct {
	MempoolOperation
	Fee          int64  `json:"fee,string"`
	Counter      int64  `gorm:"primaryKey" json:"counter,string"`
	GasLimit     int64  `json:"gas_limit,string"`
	StorageLimit int64  `json:"storage_limit,string"`
	Balance      string `json:"balance"`
	Delegate     string `json:",omitempty"`
	Source       string `json:"source,omitempty" gorm:"origination_source_idx"`
	Script       struct {
		Storage json.RawMessage `json:"storage"`
	} `json:"script" gorm:"-"`

	Storage datatypes.JSON `json:"-"`
}

Origination -

func (*Origination) Fill

func (mo *Origination) Fill()

Fill -

func (Origination) TableName

func (Origination) TableName() string

TableName -

type Proposal

type Proposal struct {
	MempoolOperation
	Period    int64  `json:"period"`
	Proposals string `json:"proposal"`
}

Proposal -

func (Proposal) TableName

func (Proposal) TableName() string

TableName -

type RegisterGlobalConstant

type RegisterGlobalConstant struct {
	MempoolOperation
	Source       string         `json:"source"`
	Fee          string         `json:"fee"`
	Counter      string         `json:"counter"`
	GasLimit     string         `json:"gas_limit"`
	StorageLimit string         `json:"storage_limit"`
	Value        datatypes.JSON `json:"value"`
}

RegisterGlobalConstant -

func (RegisterGlobalConstant) TableName

func (RegisterGlobalConstant) TableName() string

TableName -

type Reveal

type Reveal struct {
	MempoolOperation
	Source       string `json:"source" gorm:"reveal_source_idx"`
	Fee          int64  `json:"fee,string"`
	Counter      int64  `gorm:"primaryKey" json:"counter,string"`
	GasLimit     int64  `json:"gas_limit,string"`
	StorageLimit int64  `json:"storage_limit,string"`
	PublicKey    string `json:"public_key"`
}

Reveal -

func (Reveal) TableName

func (Reveal) TableName() string

TableName -

type Transaction

type Transaction struct {
	MempoolOperation
	Source       string         `json:"source" gorm:"transaction_source_idx"`
	Fee          int64          `json:"fee,string"`
	Counter      int64          `gorm:"primaryKey" json:"counter,string"`
	GasLimit     int64          `json:"gas_limit,string"`
	StorageLimit int64          `json:"storage_limit,string"`
	Amount       string         `json:"amount"`
	Destination  string         `json:"destination" gorm:"transaction_destination_idx"`
	Parameters   datatypes.JSON `json:"parameters,omitempty"`
}

Transaction -

func (Transaction) TableName

func (Transaction) TableName() string

TableName -

Jump to

Keyboard shortcuts

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