executor

package
v1.67.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2022 License: BSD-3-Clause Imports: 12 Imported by: 4

Documentation

Index

Constants

View Source
const (

	// Scissor 剪刀
	Scissor = int32(1)

	// Rock 石头
	Rock = int32(2)
	// Paper 布
	Paper = int32(3)

	// Unknown 未知结果
	Unknown = int32(4)

	// IsDraw 平局
	IsDraw = int32(1)

	// IsCreatorWin creator win
	IsCreatorWin = int32(2)

	// IsMatcherWin matcher win
	IsMatcherWin = int32(3)

	// IsTimeOut 开奖超时
	IsTimeOut = int32(4)

	// ListDESC  desc query
	ListDESC = int32(0)

	// ListASC  asc query
	ListASC = int32(1)

	// GameCount 根据状态,地址统计整个合约目前总共成功执行了多少场游戏
	GameCount = "GameCount"

	// MaxGameAmount max game amount.单位为types.Coin  1e8
	MaxGameAmount = int64(100)

	// MinGameAmount min game amount
	MinGameAmount = int64(2)

	// DefaultCount 默认一次取多少条记录
	DefaultCount = int64(20)

	// MaxCount 最多取100条
	MaxCount = int64(100)

	//ActiveTime 从有matcher参与游戏开始计算本局游戏开奖的有效时间,单位为天
	ActiveTime = int64(24)
)

Variables

View Source
var (
	ConfNameActiveTime    = gt.GameX + ":" + "activeTime"
	ConfNameDefaultCount  = gt.GameX + ":" + "defaultCount"
	ConfNameMaxCount      = gt.GameX + ":" + "maxCount"
	ConfNameMaxGameAmount = gt.GameX + ":" + "maxGameAmount"
	ConfNameMinGameAmount = gt.GameX + ":" + "minGameAmount"
)

name configured in manager

Functions

func GetGameList

func GetGameList(db dbm.KV, values []string) []*gt.Game

GetGameList 安全批量查询方式,防止因为脏数据导致查询接口奔溃

func GetName

func GetName() string

GetName get name

func Init

func Init(name string, cfg *types.Chain33Config, sub []byte)

Init register dapp

func InitExecType

func InitExecType()

InitExecType ...

func Key

func Key(id string) (key []byte)

Key gameId to save key

func List

List query game list

func QueryCountByStatusAndAddr

func QueryCountByStatusAndAddr(stateDB dbm.KV, status int32, addr string) int64

QueryCountByStatusAndAddr query game count by status and addr

func QueryGameListByIds

func QueryGameListByIds(db dbm.KV, infos *gt.QueryGameInfos) (types.Message, error)

QueryGameListByIds query game list by gameIds

func QueryGameListByPage

func QueryGameListByPage(cfg *types.Chain33Config, db dbm.Lister, stateDB dbm.KV, param *gt.QueryGameListByStatusAndAddr) (types.Message, error)

QueryGameListByPage 分页查询

func QueryGameListCount

func QueryGameListCount(stateDB dbm.KV, param *gt.QueryGameListCount) (types.Message, error)

QueryGameListCount count数查询

Types

type Action

type Action struct {
	// contains filtered or unexported fields
}

Action action struct

func NewAction

func NewAction(g *Game, tx *types.Transaction, index int) *Action

NewAction new action

func (*Action) GameCancel

func (action *Action) GameCancel(cancel *gt.GameCancel) (*types.Receipt, error)

GameCancel cancel game

func (*Action) GameClose

func (action *Action) GameClose(close *gt.GameClose) (*types.Receipt, error)

GameClose close game

func (*Action) GameCreate

func (action *Action) GameCreate(create *gt.GameCreate) (*types.Receipt, error)

GameCreate create game

func (*Action) GameMatch

func (action *Action) GameMatch(match *gt.GameMatch) (*types.Receipt, error)

GameMatch match game

func (*Action) GetIndex

func (action *Action) GetIndex(game *gt.Game) int64

GetIndex get index

func (*Action) GetKVSet

func (action *Action) GetKVSet(game *gt.Game) (kvset []*types.KeyValue)

GetKVSet get kv set

func (*Action) GetReceiptLog

func (action *Action) GetReceiptLog(game *gt.Game) *types.ReceiptLog

GetReceiptLog get receipt log

type Game

type Game struct {
	drivers.DriverBase
}

Game the game inherits all the attributes of the driverBase.

func (*Game) CheckReceiptExecOk

func (g *Game) CheckReceiptExecOk() bool

CheckReceiptExecOk return true to check if receipt ty is ok

func (*Game) ExecDelLocal_Cancel

func (g *Game) ExecDelLocal_Cancel(payload *gt.GameCancel, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error)

ExecDelLocal_Cancel roll back local db data for cancel

func (*Game) ExecDelLocal_Close

func (g *Game) ExecDelLocal_Close(payload *gt.GameClose, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error)

ExecDelLocal_Close roll back local db data for close

func (*Game) ExecDelLocal_Create

func (g *Game) ExecDelLocal_Create(payload *gt.GameCreate, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error)

ExecDelLocal_Create roll back local db data for create

func (*Game) ExecDelLocal_Match

func (g *Game) ExecDelLocal_Match(payload *gt.GameMatch, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error)

ExecDelLocal_Match roll back local db data for match

func (*Game) ExecLocal_Cancel

func (g *Game) ExecLocal_Cancel(payload *gt.GameCancel, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error)

ExecLocal_Cancel save receiptData for cancel

func (*Game) ExecLocal_Close

func (g *Game) ExecLocal_Close(payload *gt.GameClose, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error)

ExecLocal_Close save receiptData for close

func (*Game) ExecLocal_Create

func (g *Game) ExecLocal_Create(payload *gt.GameCreate, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error)

ExecLocal_Create save receiptData for create

func (*Game) ExecLocal_Match

func (g *Game) ExecLocal_Match(payload *gt.GameMatch, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error)

ExecLocal_Match save receiptData for Match

func (*Game) Exec_Cancel

func (g *Game) Exec_Cancel(payload *gt.GameCancel, tx *types.Transaction, index int) (*types.Receipt, error)

Exec_Cancel Cancel game

func (*Game) Exec_Close

func (g *Game) Exec_Close(payload *gt.GameClose, tx *types.Transaction, index int) (*types.Receipt, error)

Exec_Close Close game

func (*Game) Exec_Create

func (g *Game) Exec_Create(payload *gt.GameCreate, tx *types.Transaction, index int) (*types.Receipt, error)

Exec_Create Create game

func (*Game) Exec_Match

func (g *Game) Exec_Match(payload *gt.GameMatch, tx *types.Transaction, index int) (*types.Receipt, error)

Exec_Match Match game

func (*Game) GetDriverName

func (g *Game) GetDriverName() string

GetDriverName get driver name

func (*Game) GetPayloadValue

func (g *Game) GetPayloadValue() types.Message

GetPayloadValue get payload value

func (*Game) GetTypeMap

func (g *Game) GetTypeMap() map[string]int32

GetTypeMap get TypeMap

func (*Game) Query_QueryGameById

func (g *Game) Query_QueryGameById(in *gt.QueryGameInfo) (types.Message, error)

Query_QueryGameById query game by gameID

func (*Game) Query_QueryGameListByIds

func (g *Game) Query_QueryGameListByIds(in *gt.QueryGameInfos) (types.Message, error)

Query_QueryGameListByIds query game list by gameIDs

func (*Game) Query_QueryGameListByStatusAndAddr

func (g *Game) Query_QueryGameListByStatusAndAddr(in *gt.QueryGameListByStatusAndAddr) (types.Message, error)

Query_QueryGameListByStatusAndAddr query game list by status and addr

func (*Game) Query_QueryGameListCount

func (g *Game) Query_QueryGameListCount(in *gt.QueryGameListCount) (types.Message, error)

Query_QueryGameListCount query game count by status and addr

type ReplyGame

type ReplyGame struct {
	Game *Game `json:"game"`
}

ReplyGame the data structure returned when querying a single game.

type ReplyGameList

type ReplyGameList struct {
	Games []*Game `json:"games"`
}

ReplyGameList the data structure returned when querying the game list.

Jump to

Keyboard shortcuts

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