github.com/lzy4123/fabric@v2.1.1+incompatible/core/committer/committer.go (about)

     1  /*
     2  Copyright IBM Corp. 2016 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 committer
    18  
    19  import (
    20  	"github.com/hyperledger/fabric-protos-go/common"
    21  	"github.com/hyperledger/fabric/core/ledger"
    22  )
    23  
    24  // Committer is the interface supported by committers
    25  // The only committer is noopssinglechain committer.
    26  // The interface is intentionally sparse with the sole
    27  // aim of "leave-everything-to-the-committer-for-now".
    28  // As we solidify the bootstrap process and as we add
    29  // more support (such as Gossip) this interface will
    30  // change
    31  type Committer interface {
    32  
    33  	// CommitLegacy block and private data into the ledger
    34  	CommitLegacy(blockAndPvtData *ledger.BlockAndPvtData, commitOpts *ledger.CommitOptions) error
    35  
    36  	// GetPvtDataAndBlockByNum retrieves block with private data with given
    37  	// sequence number
    38  	GetPvtDataAndBlockByNum(seqNum uint64) (*ledger.BlockAndPvtData, error)
    39  
    40  	// GetPvtDataByNum returns a slice of the private data from the ledger
    41  	// for given block and based on the filter which indicates a map of
    42  	// collections and namespaces of private data to retrieve
    43  	GetPvtDataByNum(blockNum uint64, filter ledger.PvtNsCollFilter) ([]*ledger.TxPvtData, error)
    44  
    45  	// Get recent block sequence number
    46  	LedgerHeight() (uint64, error)
    47  
    48  	// DoesPvtDataInfoExistInLedger returns true if the ledger has pvtdata info
    49  	// about a given block number.
    50  	DoesPvtDataInfoExistInLedger(blockNum uint64) (bool, error)
    51  
    52  	// Gets blocks with sequence numbers provided in the slice
    53  	GetBlocks(blockSeqs []uint64) []*common.Block
    54  
    55  	// GetConfigHistoryRetriever returns the ConfigHistoryRetriever
    56  	GetConfigHistoryRetriever() (ledger.ConfigHistoryRetriever, error)
    57  
    58  	// CommitPvtDataOfOldBlocks commits the private data corresponding to already committed block
    59  	// If hashes for some of the private data supplied in this function does not match
    60  	// the corresponding hash present in the block, the unmatched private data is not
    61  	// committed and instead the mismatch inforation is returned back
    62  	CommitPvtDataOfOldBlocks(reconciledPvtdata []*ledger.ReconciledPvtdata) ([]*ledger.PvtdataHashMismatch, error)
    63  
    64  	// GetMissingPvtDataTracker return the MissingPvtDataTracker
    65  	GetMissingPvtDataTracker() (ledger.MissingPvtDataTracker, error)
    66  
    67  	// Closes committing service
    68  	Close()
    69  }