client

package
v0.0.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package client provides gRPC client implementations for Fabric-X services. It includes clients for orderer, query, and notification services with TLS support.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NotificationClient

type NotificationClient struct {
	// contains filtered or unexported fields
}

NotificationClient provides a gRPC client for receiving transaction status notifications. It manages bidirectional streaming with the committer notification service and multiplexes notifications to multiple subscribers per transaction ID.

func NewNotificationClient

func NewNotificationClient(cfg config.NotificationsConfig) (*NotificationClient, error)

NewNotificationClient creates a notification client with the provided configuration. It establishes a gRPC connection with optional TLS and starts a background listener.

func (*NotificationClient) Close

func (n *NotificationClient) Close() error

Close terminates the gRPC connection and cancels the background listener.

func (*NotificationClient) Subscribe

func (n *NotificationClient) Subscribe(ctx context.Context, txID string) (chan int, error)

Subscribe registers interest in a transaction's status and returns a channel for notifications. Multiple subscribers to the same txID share a single upstream subscription.

func (*NotificationClient) WaitForEvent

func (n *NotificationClient) WaitForEvent(ctx context.Context, subscription chan int) (int, error)

WaitForEvent blocks until a status notification arrives or the timeout expires. Returns the transaction status code or an error if the context is canceled.

type OrdererClient

type OrdererClient struct {
	// contains filtered or unexported fields
}

OrdererClient provides a gRPC client for submitting transactions to the Fabric-X ordering service. It handles connection management, TLS configuration, and transaction envelope creation.

func NewOrdererClient

func NewOrdererClient(cfg config.OrdererConfig) (*OrdererClient, error)

NewOrdererClient creates a new orderer client with the provided configuration and signing identity. It establishes a gRPC connection with optional TLS and returns an error if connection fails.

func (*OrdererClient) Broadcast

func (oc *OrdererClient) Broadcast(
	ctx context.Context,
	signer msp.SigningIdentity,
	txID string,
	tx *applicationpb.Tx,
) error

Broadcast sends the signed envelope to the ordering service. It establishes a gRPC connection, sends the envelope, and waits for acknowledgment.

func (*OrdererClient) Close

func (oc *OrdererClient) Close() error

Close terminates the gRPC connection to the ordering service.

type QueryClient

type QueryClient struct {
	// contains filtered or unexported fields
}

QueryClient provides a gRPC client for querying namespace policies from the Fabric-X committer query service.

func NewQueryClient

func NewQueryClient(cfg config.QueriesConfig) (*QueryClient, error)

NewQueryClient creates a new query client with the provided configuration. It establishes a gRPC connection with optional TLS and returns an error if connection fails.

func (*QueryClient) Close

func (qc *QueryClient) Close() error

Close terminates the gRPC connection to the query service.

func (*QueryClient) GetNamespacePolicies

func (qc *QueryClient) GetNamespacePolicies(ctx context.Context) (*applicationpb.NamespacePolicies, error)

GetNamespacePolicies retrieves all namespace policies from the query service. The request is bounded by the configured connection timeout.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL