github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/core/common/sysccprovider/sysccprovider.go (about)

     1  /*
     2  Copyright hechain. 2017 All Rights Reserved.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8  		 http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package sysccprovider
    18  
    19  import (
    20  	"github.com/hechain20/hechain/common/channelconfig"
    21  	"github.com/hechain20/hechain/common/policies"
    22  	"github.com/hechain20/hechain/core/ledger"
    23  )
    24  
    25  // SystemChaincodeProvider provides an abstraction layer that is
    26  // used for different packages to interact with code in the
    27  // system chaincode package without importing it; more methods
    28  // should be added below if necessary
    29  type SystemChaincodeProvider interface {
    30  	// GetQueryExecutorForLedger returns a query executor for the
    31  	// ledger of the supplied channel.
    32  	// That's useful for system chaincodes that require unfettered
    33  	// access to the ledger
    34  	GetQueryExecutorForLedger(cid string) (ledger.QueryExecutor, error)
    35  
    36  	// GetApplicationConfig returns the configtxapplication.SharedConfig for the channel
    37  	// and whether the Application config exists
    38  	GetApplicationConfig(cid string) (channelconfig.Application, bool)
    39  
    40  	// Returns the policy manager associated to the passed channel
    41  	// and whether the policy manager exists
    42  	PolicyManager(channelID string) (policies.Manager, bool)
    43  }
    44  
    45  // ChaincodeInstance is unique identifier of chaincode instance
    46  type ChaincodeInstance struct {
    47  	ChannelID        string
    48  	ChaincodeName    string
    49  	ChaincodeVersion string
    50  }
    51  
    52  func (ci *ChaincodeInstance) String() string {
    53  	return ci.ChannelID + "." + ci.ChaincodeName + "#" + ci.ChaincodeVersion
    54  }