Version: v1.65.3 Latest Latest

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

Go to latest
Published: Oct 19, 2021 License: BSD-3-Clause Imports: 11 Imported by: 0




View Source
const (
	//KeyPrefixStateDB state db key必须前缀
	KeyPrefixStateDB = "mavl-accountmanager-"
	//KeyPrefixLocalDB local db的key必须前缀
	KeyPrefixLocalDB = "LODB-accountmanager"


View Source
var (
	// ConfNameActiveTime 有效期
	ConfNameActiveTime = et.AccountmanagerX + "-" + "activeTime"
	// ConfNameLockTime 密钥重置锁定期
	ConfNameLockTime = et.AccountmanagerX + "-" + "lockTime"
	// ConfNameManagerAddr 管理员地址
	ConfNameManagerAddr = et.AccountmanagerX + "-" + "managerAddr"
	// DefaultActiveTime 默认有效期
	DefaultActiveTime = int64(5 * 360 * 24 * 3600)
	// DefaultLockTime 默认密钥重置锁定期
	DefaultLockTime = int64(15 * 24 * 3600)
	// DefaultManagerAddr 默认管理员地址
	DefaultManagerAddr = "12qyocayNF7Lv6C9qW4avxs2E7U41fKSfv"


func GetName

func GetName() string

GetName get driver name

func Init

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

Init register dapp

func InitExecType

func InitExecType()

InitExecType Init Exec Type

func NewAccountTable

func NewAccountTable(kvdb db.KV) *table.Table

NewAccountTable ...


type AccountRow

type AccountRow struct {

AccountRow account table meta 结构

func NewAccountRow

func NewAccountRow() *AccountRow

NewAccountRow 新建一个meta 结构

func (*AccountRow) CreateRow

func (m *AccountRow) CreateRow() *table.Row

CreateRow 新建数据行(注意index 数据一定也要保存到数据中,不能就保存eventid)

func (*AccountRow) Get

func (m *AccountRow) Get(key string) ([]byte, error)

Get 按照indexName 查询 indexValue

func (*AccountRow) SetPayload

func (m *AccountRow) SetPayload(data types.Message) error

SetPayload 设置数据

type Accountmanager

type Accountmanager struct {

Accountmanager ...

func (*Accountmanager) CheckAccountIDIsExist

func (a *Accountmanager) CheckAccountIDIsExist(accountID string) bool

CheckAccountIDIsExist ...

func (*Accountmanager) CheckTx

func (a *Accountmanager) CheckTx(tx *types.Transaction, index int) error

CheckTx 实现自定义检验交易接口,供框架调用

func (*Accountmanager) ExecDelLocal

func (a *Accountmanager) ExecDelLocal(tx *types.Transaction, receipt *types.ReceiptData, index int) (*types.LocalDBSet, error)

ExecDelLocal 回退自动删除,重写基类

func (*Accountmanager) ExecLocal_Apply

func (a *Accountmanager) ExecLocal_Apply(payload *et.Apply, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error)

ExecLocal_Apply ...

func (*Accountmanager) ExecLocal_Register

func (a *Accountmanager) ExecLocal_Register(payload *et.Register, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error)

ExecLocal_Register ...

func (*Accountmanager) ExecLocal_ResetKey

func (a *Accountmanager) ExecLocal_ResetKey(payload *et.ResetKey, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error)

ExecLocal_ResetKey ...

func (*Accountmanager) ExecLocal_Supervise

func (a *Accountmanager) ExecLocal_Supervise(payload *et.Supervise, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error)

ExecLocal_Supervise ...

func (*Accountmanager) ExecLocal_Transfer

func (a *Accountmanager) ExecLocal_Transfer(payload *et.Transfer, tx *types.Transaction, receiptData *types.ReceiptData, index int) (*types.LocalDBSet, error)

ExecLocal_Transfer ...

func (*Accountmanager) Exec_Apply

func (a *Accountmanager) Exec_Apply(payload *aty.Apply, tx *types.Transaction, index int) (*types.Receipt, error)

Exec_Apply ...

func (*Accountmanager) Exec_Register

func (a *Accountmanager) Exec_Register(payload *aty.Register, tx *types.Transaction, index int) (*types.Receipt, error)

Exec_Register ...

func (*Accountmanager) Exec_ResetKey

func (a *Accountmanager) Exec_ResetKey(payload *aty.ResetKey, tx *types.Transaction, index int) (*types.Receipt, error)

Exec_ResetKey ...

func (*Accountmanager) Exec_Supervise

func (a *Accountmanager) Exec_Supervise(payload *aty.Supervise, tx *types.Transaction, index int) (*types.Receipt, error)

Exec_Supervise ...

func (*Accountmanager) Exec_Transfer

func (a *Accountmanager) Exec_Transfer(payload *aty.Transfer, tx *types.Transaction, index int) (*types.Receipt, error)

Exec_Transfer ...

func (*Accountmanager) ExecutorOrder

func (a *Accountmanager) ExecutorOrder() int64

ExecutorOrder Exec 的时候 同时执行 ExecLocal

func (*Accountmanager) GetDriverName

func (a *Accountmanager) GetDriverName() string

GetDriverName ...

func (*Accountmanager) Query_QueryAccountByAddr

func (a *Accountmanager) Query_QueryAccountByAddr(in *et.QueryAccountByAddr) (types.Message, error)

Query_QueryAccountByAddr 根据ID查询账户信息

func (*Accountmanager) Query_QueryAccountByID

func (a *Accountmanager) Query_QueryAccountByID(in *et.QueryAccountByID) (types.Message, error)

Query_QueryAccountByID 根据ID查询账户信息

func (*Accountmanager) Query_QueryAccountsByStatus

func (a *Accountmanager) Query_QueryAccountsByStatus(in *et.QueryAccountsByStatus) (types.Message, error)

Query_QueryAccountsByStatus 根据状态查询账户列表|| 账户状态 1 正常, 2表示冻结, 3表示锁定 4,过期注销

func (*Accountmanager) Query_QueryBalanceByID

func (a *Accountmanager) Query_QueryBalanceByID(in *et.QueryBalanceByID) (types.Message, error)

Query_QueryBalanceByID 根据ID查询账户余额

func (*Accountmanager) Query_QueryExpiredAccounts

func (a *Accountmanager) Query_QueryExpiredAccounts(in *et.QueryExpiredAccounts) (types.Message, error)

Query_QueryExpiredAccounts 查询逾期注销的账户列表

type Action

type Action struct {
	// contains filtered or unexported fields

Action action struct

func NewAction

func NewAction(e *Accountmanager, tx *types.Transaction, index int) *Action

NewAction ...

func (*Action) Apply

func (a *Action) Apply(payload *et.Apply) (*types.Receipt, error)

Apply ...

func (*Action) GetIndex

func (a *Action) GetIndex() int64

GetIndex get index 主键索引,实际上是以过期时间为主键

func (*Action) GetKVSet

func (a *Action) GetKVSet(account *et.Account) (kvset []*types.KeyValue)

GetKVSet get kv set

func (*Action) Register

func (a *Action) Register(payload *et.Register) (*types.Receipt, error)

Register ...

func (*Action) Reset

func (a *Action) Reset(payload *et.ResetKey) (*types.Receipt, error)

Reset 为了避免别人恶意重置别人的帐号,这个操作仅有系统管理员有权限去操作

func (*Action) Supervise

func (a *Action) Supervise(payload *et.Supervise) (*types.Receipt, error)

Supervise ...

func (*Action) Transfer

func (a *Action) Transfer(payload *et.Transfer) (*types.Receipt, error)

Transfer ...

Jump to

Keyboard shortcuts

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