Documentation ¶
Index ¶
- type Block
- type BlockDescriptor
- type BlockHeader
- type BlockIterator
- type BlockResponse
- type BlockScanner
- type Blocks
- func NewBlockByHashHandler(channelID string, cfg Config, blockchainProvider blockchainClientProvider) *Blocks
- func NewBlockByHashHandlerWithEncoding(channelID string, cfg Config, blockchainProvider blockchainClientProvider) *Blocks
- func NewBlocksFromNumHandler(channelID string, cfg Config, blockchainProvider blockchainClientProvider) *Blocks
- func NewBlocksFromNumHandlerWithEncoding(channelID string, cfg Config, blockchainProvider blockchainClientProvider) *Blocks
- type Config
- type ConfigBlock
- func NewConfigBlockByHashHandler(channelID string, cfg Config, blockchainProvider blockchainClientProvider) *ConfigBlock
- func NewConfigBlockByHashHandlerWithEncoding(channelID string, cfg Config, blockchainProvider blockchainClientProvider) *ConfigBlock
- func NewConfigBlockHandler(channelID string, cfg Config, blockchainProvider blockchainClientProvider) *ConfigBlock
- func NewConfigBlockHandlerWithEncoding(channelID string, cfg Config, blockchainProvider blockchainClientProvider) *ConfigBlock
- type DataEncoding
- type ErrorResponse
- type FirstValid
- type ResultCode
- type Time
- type TimeResponse
- type Transaction
- type Transactions
- type TransactionsResponse
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockDescriptor ¶
BlockDescriptor contains the block number and transaction number
type BlockHeader ¶
type BlockHeader struct { Number uint64 `json:"number"` DataHash string `json:"dataHash"` PreviousHash string `json:"previousHash"` }
BlockHeader contains a block header.
type BlockIterator ¶
type BlockIterator interface {
Next() (BlockDescriptor, bool)
}
BlockIterator iterates through a set of blocks and returns a block descriptor or false if there are no more blocks
type BlockResponse ¶
type BlockResponse struct { Header BlockHeader `json:"header"` Data string `json:"data"` MetaData string `json:"metadata"` }
BlockResponse contains a block.
type BlockScanner ¶
type BlockScanner interface {
Scan(desc BlockDescriptor, maxTxns int) ([]Transaction, bool, error)
}
BlockScanner scans a block and returns the Sidetree transactions for the block. The transactions are returned along with a boolean to indicate whether the maximum count has been reached.
type Blocks ¶
type Blocks struct {
// contains filtered or unexported fields
}
Blocks retrieves blocks from the ledger
func NewBlockByHashHandler ¶
func NewBlockByHashHandler(channelID string, cfg Config, blockchainProvider blockchainClientProvider) *Blocks
NewBlockByHashHandler returns a handler that retrieves a block by hash
func NewBlockByHashHandlerWithEncoding ¶
func NewBlockByHashHandlerWithEncoding(channelID string, cfg Config, blockchainProvider blockchainClientProvider) *Blocks
NewBlockByHashHandlerWithEncoding returns a handler that retrieves a block by hash and returns the block with data encoded in the provided encoding.
func NewBlocksFromNumHandler ¶
func NewBlocksFromNumHandler(channelID string, cfg Config, blockchainProvider blockchainClientProvider) *Blocks
NewBlocksFromNumHandler returns a new handler that retrieves a range of blocks starting at the block number given by the parameter, from-time, and returns a maximum number of blocks given by parameter max-blocks. The blocks are returned in JSON encoding.
func NewBlocksFromNumHandlerWithEncoding ¶
func NewBlocksFromNumHandlerWithEncoding(channelID string, cfg Config, blockchainProvider blockchainClientProvider) *Blocks
NewBlocksFromNumHandlerWithEncoding returns a new handler that retrieves a range of blocks starting at the block number given by the parameter, from-time, and returns a maximum number of blocks given by parameter max-blocks. The blocks are returned with data encoded in the provided encoding.
func (*Blocks) Handler ¶
func (h *Blocks) Handler() common.HTTPRequestHandler
Handler returns the request handler
type Config ¶
type Config struct { Authorization authhandler.Config // BasePath is the base context path of the REST endpoint BasePath string // MaxTransactionsInResponse is the maximum number of transactions to return for the /blockchain/transactions request MaxTransactionsInResponse int // MaxBlocksInResponse is the maximum number of blocks to return for the /blockchain/blocks request MaxBlocksInResponse int }
Config defines the configuration for a blockchain handler
type ConfigBlock ¶
type ConfigBlock struct {
// contains filtered or unexported fields
}
ConfigBlock retrieves basic information about the Fabric blockchain
func NewConfigBlockByHashHandler ¶
func NewConfigBlockByHashHandler(channelID string, cfg Config, blockchainProvider blockchainClientProvider) *ConfigBlock
NewConfigBlockByHashHandler returns a new config block handler which returns the config block that was used by the block with the provided block hash
func NewConfigBlockByHashHandlerWithEncoding ¶
func NewConfigBlockByHashHandlerWithEncoding(channelID string, cfg Config, blockchainProvider blockchainClientProvider) *ConfigBlock
NewConfigBlockByHashHandlerWithEncoding returns a new config block handler which returns the config block that was used by the block with the provided block hash
func NewConfigBlockHandler ¶
func NewConfigBlockHandler(channelID string, cfg Config, blockchainProvider blockchainClientProvider) *ConfigBlock
NewConfigBlockHandler returns a new config block handler which returns the latest config block
func NewConfigBlockHandlerWithEncoding ¶
func NewConfigBlockHandlerWithEncoding(channelID string, cfg Config, blockchainProvider blockchainClientProvider) *ConfigBlock
NewConfigBlockHandlerWithEncoding returns a new config block handler which returns the latest config block
func (*ConfigBlock) Handler ¶
func (h *ConfigBlock) Handler() common.HTTPRequestHandler
Handler returns the request handler
type DataEncoding ¶
type DataEncoding string
DataEncoding specifies the encoding of the data sections of the blocks in the response
const ( // DataEncodingBase64 indicates that the data sections of the returned block should be encoded using Base64 (standard) encoding DataEncodingBase64 DataEncoding = "base64" // DataEncodingBase64URL indicates that the data sections of the returned block should be encoded using Base64 URL-encoding DataEncodingBase64URL DataEncoding = "base64url" // DataEncodingJSON indicates that the data sections of the returned block should be returned in JSON format DataEncodingJSON DataEncoding = "json" )
type ErrorResponse ¶
type ErrorResponse struct {
Code string `json:"code"`
}
ErrorResponse contains the error code for a failed response
type FirstValid ¶
type FirstValid struct {
// contains filtered or unexported fields
}
FirstValid retrieves the first valid transaction in a given set of transactions
func NewFirstValidHandler ¶
func NewFirstValidHandler(channelID string, cfg Config, blockchainProvider blockchainClientProvider) *FirstValid
NewFirstValidHandler returns a new, first valid handler
func (*FirstValid) Handler ¶
func (h *FirstValid) Handler() common.HTTPRequestHandler
Handler returns the request handler
type ResultCode ¶
type ResultCode = string
ResultCode specifies the status string of a blockchain result
const ( // InvalidTxNumOrTimeHash indicates that the given transaction number or time hash is invalid InvalidTxNumOrTimeHash ResultCode = "invalid_transaction_number_or_time_hash" // InvalidFromTime indicates that the block time parameter is missing or invalid InvalidFromTime ResultCode = "invalid_from_time" // InvalidMaxBlocks indicates that the max blocks parameter is missing or invalid InvalidMaxBlocks ResultCode = "invalid_max_blocks" // InvalidTimeHash indicates that the time hash parameter is missing or invalid InvalidTimeHash ResultCode = "invalid_time_hash" )
type Time ¶
type Time struct {
// contains filtered or unexported fields
}
Time retrieves the blockchain time from the ledger (block height and latest block hash)
func NewTimeByHashHandler ¶
func NewTimeByHashHandler(channelID string, cfg Config, blockchainProvider blockchainClientProvider) *Time
NewTimeByHashHandler returns a new blockchain time handler for a given hash
func NewTimeHandler ¶
func NewTimeHandler(channelID string, cfg Config, blockchainProvider blockchainClientProvider) *Time
NewTimeHandler returns a new blockchain time handler
func (*Time) Handler ¶
func (h *Time) Handler() common.HTTPRequestHandler
Handler returns the request handler
type TimeResponse ¶
type TimeResponse struct { Time string `json:"time"` // Hash is the base64 URL-encoded hash of the block. Hash string `json:"hash"` // PreviousHash is the base64 URL-encoded hash of the previous block's header. // This value may be used as the hash value to retrieve the previous block // using the '/time/{hash}' endpoint. PreviousHash string `json:"previousHash"` }
TimeResponse contains the response from the /time request
type Transaction ¶
type Transaction struct { TransactionNumber uint64 `json:"transactionNumber"` TransactionTime uint64 `json:"transactionTime"` TransactionTimeHash string `json:"transactionTimeHash"` AnchorString string `json:"anchorString"` }
Transaction contains data for a single Sidetree transaction
type Transactions ¶
type Transactions struct {
// contains filtered or unexported fields
}
Transactions retrieves the Sidetree transactions from the ledger
func NewTransactionsHandler ¶
func NewTransactionsHandler(channelID string, cfg Config, blockchainProvider blockchainClientProvider) *Transactions
NewTransactionsHandler returns a new blockchain Transactions handler
func NewTransactionsSinceHandler ¶
func NewTransactionsSinceHandler(channelID string, cfg Config, blockchainProvider blockchainClientProvider) *Transactions
NewTransactionsSinceHandler returns a new blockchain Transactions handler which returns all Sidetree transactions since the given block hash/transaction number
func (*Transactions) Handler ¶
func (h *Transactions) Handler() common.HTTPRequestHandler
Handler returns the request handler
type TransactionsResponse ¶
type TransactionsResponse struct { More bool `json:"moreTransactions"` Transactions []Transaction `json:"transactions"` }
TransactionsResponse contains a set of transactions and a boolean that indicates whether or not there are more transactions available to return.
type Version ¶
type Version struct {
*versionhandler.Version
}
Version handles version requests
func NewVersionHandler ¶
NewVersionHandler returns a new Version handler