github.com/turingchain2020/turingchain@v1.1.21/system/dapp/none/executor/none.go (about)

     1  // Copyright Turing Corp. 2018 All Rights Reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Package executor none执行器
     6  package executor
     7  
     8  // package none execer for unknow execer
     9  // all none transaction exec ok, execept nofee
    10  // nofee transaction will not pack into block
    11  
    12  import (
    13  	drivers "github.com/turingchain2020/turingchain/system/dapp"
    14  	"github.com/turingchain2020/turingchain/types"
    15  )
    16  
    17  var driverName = "none"
    18  
    19  // Init register newnone
    20  func Init(name string, cfg *types.TuringchainConfig, sub []byte) {
    21  	if name != driverName {
    22  		panic("system dapp can't be rename")
    23  	}
    24  	driverName = name
    25  	drivers.Register(cfg, name, newNone, 0)
    26  }
    27  
    28  // GetName return name at execution time
    29  func GetName() string {
    30  	return newNone().GetName()
    31  }
    32  
    33  // None defines a none type
    34  type None struct {
    35  	drivers.DriverBase
    36  }
    37  
    38  func newNone() drivers.Driver {
    39  	n := &None{}
    40  	n.SetChild(n)
    41  	return n
    42  }
    43  
    44  // GetDriverName return dcrivername at register
    45  func (n *None) GetDriverName() string {
    46  	return driverName
    47  }