Documentation
¶
Index ¶
- Constants
- func GetCSVBlockHeader() []string
- func GetCSVLedgerViewHeader() []string
- func GetLutherRecordHeader() []string
- func NewBlockStore(path string, orderer bool) (*blockStore, error)
- func RangeBlocks(ledgerDir string, orderer bool, channel string, start uint64, end uint64) (*simpleBlockIterator, error)
- type Block
- func (b *Block) GetBlockNum() uint64
- func (b *Block) GetHash() string
- func (b *Block) GetTransactions() []*Transaction
- func (s *Block) GetValidation(txNum int) *TxValidation
- func (b *Block) ToLedgerView() *LedgerView
- func (b *Block) Write(w io.Writer)
- func (b *Block) WriteCSV(w *csv.Writer)
- func (b *Block) WriteTx(i int, w io.Writer)
- type BlockIterator
- type CommonBlock
- type Event
- type KeyRecord
- type LedgerStatistics
- type LedgerView
- type NSRWSet
- type PrivateKey
- type RSetRecord
- type RWSet
- type SnapshotState
- type SnapshotStats
- type StateKey
- type Transaction
- type TransactionDetails
- type TransactionID
- type TxValidation
- type Version
- type WSetRecord
Constants ¶
const ( LutherEventKey = "luther" LutherEventName = "txEventName" LutherEventRequestID = "txRequestID" LutherEventTxTimestamp = "txTimestamp" )
Variables ¶
This section is empty.
Functions ¶
func GetCSVBlockHeader ¶
func GetCSVBlockHeader() []string
func GetCSVLedgerViewHeader ¶
func GetCSVLedgerViewHeader() []string
GetCSVLedgerViewHeader returns the CSV header for ledger view data
func GetLutherRecordHeader ¶
func GetLutherRecordHeader() []string
func NewBlockStore ¶
Types ¶
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
Block is a container for the transaction information.
func (*Block) GetBlockNum ¶
GetBlockNum returns the block number.
func (*Block) GetTransactions ¶
func (b *Block) GetTransactions() []*Transaction
GetTransactions returns the transactions in the block.
func (*Block) GetValidation ¶
func (s *Block) GetValidation(txNum int) *TxValidation
func (*Block) ToLedgerView ¶
func (b *Block) ToLedgerView() *LedgerView
ToLedgerView converts a Block to a LedgerView
type BlockIterator ¶
type BlockIterator interface {
Next() (CommonBlock, error)
Close()
}
type CommonBlock ¶
func (*CommonBlock) Write ¶
func (s *CommonBlock) Write(w io.Writer)
func (*CommonBlock) WriteCSV ¶
func (s *CommonBlock) WriteCSV(w *csv.Writer)
type Event ¶
type Event struct {
*fabricpeer.ChaincodeEvent
}
func (*Event) GetChaincodeId ¶
func (*Event) GetLutherRecord ¶
func (*Event) GetPayload ¶
func (*Event) IsLutherEvent ¶
type KeyRecord ¶
type KeyRecord struct {
Type string // "state" or "private"
Namespace string // namespace for state, collection for private
Key string
Value []byte
ValueSize int
Version *Version // optional, for read sets
IsRead bool // true if this is from a read set
IsWrite bool // true if this is from a write set or current state
Transaction string // optional transaction ID
BlockNum uint64 // optional block number
}
KeyRecord represents a single key-value record in the ledger
type LedgerStatistics ¶
type LedgerStatistics struct {
TotalKeys int
TotalStateKeys int
TotalPrivateKeys int
TotalSize int64
TotalStateSize int64
TotalPrivateSize int64
Namespaces map[string]int
Collections map[string]int
BlockCount uint64
TransactionCount int
}
LedgerStatistics contains aggregated statistics about the ledger
type LedgerView ¶
type LedgerView struct {
Keys []*KeyRecord
Statistics *LedgerStatistics
}
LedgerView represents a unified view of ledger data that can be populated from either Fabric blocks or Badger snapshots
func (*LedgerView) AddKey ¶
func (lv *LedgerView) AddKey(key *KeyRecord)
AddKey adds a key record to the view
func (*LedgerView) Write ¶
func (lv *LedgerView) Write(w io.Writer)
Write writes a formatted summary of the ledger view
func (*LedgerView) WriteCSV ¶
func (lv *LedgerView) WriteCSV(w *csv.Writer)
WriteCSV writes ledger view data rows in CSV format. The caller is responsible for writing the header row (see GetCSVLedgerViewHeader).
type PrivateKey ¶
PrivateKey represents a private data key in the snapshot
type RSetRecord ¶
func (*RSetRecord) GetKey ¶
func (s *RSetRecord) GetKey() string
func (*RSetRecord) GetVersion ¶
func (s *RSetRecord) GetVersion() *Version
type RWSet ¶
type RWSet struct {
ReadSet []*RSetRecord
WriteSet []*WSetRecord
}
func (*RWSet) GetReadSet ¶
func (s *RWSet) GetReadSet() []*RSetRecord
func (*RWSet) GetWriteSet ¶
func (s *RWSet) GetWriteSet() []*WSetRecord
type SnapshotState ¶
type SnapshotState struct {
StateKeys []*StateKey
PrivateKeys []*PrivateKey
// contains filtered or unexported fields
}
SnapshotState represents the state of a Luther snapshot ledger
func LoadSnapshot ¶
func LoadSnapshot(r io.Reader) (*SnapshotState, error)
LoadSnapshot loads a Luther snapshot from an io.Reader
func LoadSnapshotFromFile ¶
func LoadSnapshotFromFile(filePath string) (*SnapshotState, error)
LoadSnapshotFromFile loads a snapshot from a file path
func (*SnapshotState) GetStats ¶
func (s *SnapshotState) GetStats() *SnapshotStats
GetStats returns statistics about the snapshot
func (*SnapshotState) ToLedgerView ¶
func (s *SnapshotState) ToLedgerView() *LedgerView
ToLedgerView converts a SnapshotState to a LedgerView
func (*SnapshotState) Write ¶
func (s *SnapshotState) Write(w io.Writer)
Write writes a formatted summary of the snapshot to the writer
func (*SnapshotState) WriteCSV ¶
func (s *SnapshotState) WriteCSV(w *csv.Writer)
WriteCSV writes snapshot data in CSV format
type SnapshotStats ¶
type SnapshotStats struct {
TotalStateKeys int
TotalPrivateKeys int
TotalStateSize int64
TotalPrivateSize int64
Namespaces map[string]int
Collections map[string]int
}
SnapshotStats contains statistics about the snapshot
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Transaction is a container for the transaction information exported by QueryBlock.
func NewTransaction ¶
func NewTransaction(envelopeBytes []byte) (*Transaction, error)
NewTransaction creates an immutable transaction object.
func (*Transaction) GetDetails ¶
func (t *Transaction) GetDetails() *TransactionDetails
func (*Transaction) GetNumber ¶
func (t *Transaction) GetNumber() int
func (*Transaction) GetSize ¶
func (t *Transaction) GetSize() int
type TransactionDetails ¶
type TransactionDetails struct {
// contains filtered or unexported fields
}
func NewTransactionDetails ¶
func NewTransactionDetails(txBytes []byte) (*TransactionDetails, error)
func (*TransactionDetails) GetEvent ¶
func (s *TransactionDetails) GetEvent() *Event
func (*TransactionDetails) GetNamespaceReadWriteSet ¶
func (s *TransactionDetails) GetNamespaceReadWriteSet() []*NSRWSet
func (*TransactionDetails) GetReadSetSize ¶
func (s *TransactionDetails) GetReadSetSize() int64
func (*TransactionDetails) GetWriteSetSize ¶
func (s *TransactionDetails) GetWriteSetSize() int64
type TransactionID ¶
type TransactionID string
type TxValidation ¶
type TxValidation int32
func (*TxValidation) GetReason ¶
func (s *TxValidation) GetReason() string
type WSetRecord ¶
func (*WSetRecord) GetKey ¶
func (s *WSetRecord) GetKey() string
func (*WSetRecord) GetVal ¶
func (s *WSetRecord) GetVal() []byte