Documentation ¶
Index ¶
- func ContextWithTransactionID(ctx context.Context) context.Context
- func GetContextTransactionID(ctx context.Context) string
- func SetContextTransactionID(ctx context.Context, txID string)
- type Block
- type Config
- func WithAuthToken(token string) Config
- func WithCCFetchURLDowngrade(downgrade bool) Config
- func WithCCFetchURLProxy(proxy string) Config
- func WithConditionalDependentTxID(txID string) Config
- func WithContext(ctx context.Context) Config
- func WithCreator(creator string) Config
- func WithDependentTxID(txID string) Config
- func WithDisableWritePolling(disable bool) Config
- func WithEndpoint(endpoint string) Config
- func WithHeader(key string, value string) Config
- func WithID(id string) Config
- func WithLog(log *logrus.Logger) Config
- func WithLogField(key string, value interface{}) Config
- func WithLogrusFields(fields logrus.Fields) Config
- func WithMSPFilter(mspFilter []string) Config
- func WithMinEndorsers(minEndorsers int) Config
- func WithParams(params interface{}) Config
- func WithResponse(target *interface{}) Config
- func WithTimestampGenerator(timestampGenerator func(context.Context) string) Config
- func WithTransientData(key string, val []byte) Config
- func WithTransientDataMap(data map[string][]byte) Config
- type Handle
- type RequestOptions
- type Response
- type Transaction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextWithTransactionID ¶
ContextWithTransactionID adds a unique value to a context for storing a transaction ID
func GetContextTransactionID ¶
GetContextTransactionID gets the transaction ID from a context value if present
func SetContextTransactionID ¶
SetContextTransactionID sets the transaction ID in a context value that has been initialized using ContextWithTransactionID
Types ¶
type Block ¶
type Block interface { Hash() string Transactions() []Transaction }
Block is a wrapper for summary information about a block.
type Config ¶
type Config func(*RequestOptions)
Config is a type for a function that can mutate a requestOptions object.
func WithAuthToken ¶
WithAuthToken passes authorization for the transaction issuer with a request
func WithCCFetchURLDowngrade ¶
WithCCFetchURLDowngrade allows controlling https -> http downgrade, typically useful before proxying for ccfetchurl library.
func WithCCFetchURLProxy ¶
WithCCFetchURLProxy sets the proxy for ccfetchurl library.
func WithConditionalDependentTxID ¶
WithConditionalDependentTxID allows specifying a conditional dependency on a transaction ID when polling is disabled or transaction dependencies are already enabled. This is intended for use with chained sequential calls that have a critical dependency.
func WithContext ¶
WithContext allows specifying the context to use.
func WithCreator ¶
WithCreator allows specifying the creator. Only has effect in mock mode. Also works in gateway mock mode.
func WithDependentTxID ¶
WithDependentTxID allows specifying a dependency on a transaction ID. If set, the client will poll for the presence of that transaction before simulating the request on the peer with the transaction.
func WithDisableWritePolling ¶
WithDisableWritePolling allows disabling polling for full consensus after a write is committed.
func WithEndpoint ¶
WithEndpoint allows specifying the endpoint to target. The RPC implementation will not work if an endpoint is not specified.
func WithHeader ¶
WithHeader allows specifying an additional HTTP header.
func WithID ¶
WithID allows specifying the request ID. If the request ID is not specified, a randomly-generated UUID will be used.
func WithLogField ¶
WithLogField allows specifying a log field to be included.
func WithLogrusFields ¶
WithLogrusFields allows specifying multiple log fields to be included.
func WithMSPFilter ¶
WithMSPFilter allows specifying the MSP filter. Has no effect in mock mode.
func WithMinEndorsers ¶
WithMinEndorsers allows specifying the minimum number of endorsing peers. Has no effect in mock mode.
func WithParams ¶
func WithParams(params interface{}) Config
WithParams allows specifying the phylum "parameters" argument. This must be set to something that json.Marshal accepts.
func WithResponse ¶
func WithResponse(target *interface{}) Config
WithResponse allows capturing the RPC response for futher analysis.
func WithTimestampGenerator ¶
WithTimestampGenerator allows specifying a function that will be invoked at every Upgrade, Init, and Call whose output is used to set the substrate "now" timestamp in mock mode. Has no effect outside of mock mode.
func WithTransientData ¶
WithTransientData allows specifying a single "transient data" key-value pair.
func WithTransientDataMap ¶
WithTransientDataMap allows specifying multiple "transient data" key-value pairs.
type Handle ¶
type Handle struct {
Index int
}
Handle represents a handle to a shiroclient instance.
type RequestOptions ¶
type RequestOptions struct { Log *logrus.Logger LogFields logrus.Fields Headers map[string]string Endpoint string ID string AuthToken string Params interface{} Transient map[string][]byte Target *interface{} TimestampGenerator func(context.Context) string MSPFilter []string MinEndorsers int Creator string Ctx context.Context DependentTxID string DisableWritePolling bool CCFetchURLDowngrade bool CCFetchURLProxy string }
RequestOptions are operated on by the Config functions generated by the With* functions. There is no need for a consumer of this library to directly manipulate objects of this type, but this type and its fields are public to allow substrateplugin to convert them to shiroclient options.