hyperledger / fabric-admin-sdk

Hyperledger Fabric admin SDK
Apache License 2.0
31 stars 19 forks source link

to support list channels peer has joined #123

Closed 1gezhanghao closed 1 year ago

1gezhanghao commented 1 year ago

As a user of the admin SDK I want to list channels that a peer joined So that I can know which channels the peer node has joined.

peer cli command is as follows

List of channels peer has joined.

Usage:
  peer channel list [flags]

Flags:
  -h, --help   help for list

Global Flags:
      --cafile string                       Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint
      --certfile string                     Path to file containing PEM-encoded X509 public key to use for mutual TLS communication with the orderer endpoint
      --clientauth                          Use mutual TLS when communicating with the orderer endpoint
      --connTimeout duration                Timeout for client to connect (default 3s)
      --keyfile string                      Path to file containing PEM-encoded private key to use for mutual TLS communication with the orderer endpoint
  -o, --orderer string                      Ordering service endpoint
      --ordererTLSHostnameOverride string   The hostname override to use when validating the TLS connection to the orderer
      --tls                                 Use TLS when communicating with the orderer endpoint
      --tlsHandshakeTimeShift duration      The amount of time to shift backwards for certificate expiration checks during TLS handshakes with the orderer endpoint
SamYuan1990 commented 1 year ago

@denyeart , what do you think? can we start use admin-sdk to generate some binary and which able to replace peer cli or decouple peer cli from peer node binary?

SamYuan1990 commented 1 year ago

or @1gezhanghao , just provide API for now will good enough?

1gezhanghao commented 1 year ago

@SamYuan1990 yes, just API is good enough.

denyeart commented 1 year ago

Yes, I think a CLI based on admin SDK is the logical conclusion. Let's first get the API fairly complete though. Note that https://github.com/hyperledger/fabric-cli was started but never completed... it could be picked back up as the eventual CLI.

SamYuan1990 commented 1 year ago

Yes, I think a CLI based on admin SDK is the logical conclusion. Let's first get the API fairly complete though. Note that https://github.com/hyperledger/fabric-cli was started but never completed... it could be picked back up as the eventual CLI.

Ok, we can make admin-sdk focus on logical and API, and fabric-cli can relay on admin-sdk for features.

SamYuan1990 commented 1 year ago

@SamYuan1990 yes, just API is good enough.

https://github.com/hyperledger/fabric-admin-sdk/blob/main/pkg/channel/channel.go#L63 does this work?

1gezhanghao commented 1 year ago

no,OSN can list orderer node‘s joined channel ,not for peer.

SamYuan1990 commented 1 year ago

no,OSN can list orderer node‘s joined channel ,not for peer.

k.... as your sample is from orderer. I got it. You are looking for same thing for peer node right?

List of channels peer has joined.

Usage:
  peer channel list [flags]

Flags:
  -h, --help   help for list

Global Flags:
      --cafile string                       Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint
      --certfile string                     Path to file containing PEM-encoded X509 public key to use for mutual TLS communication with the orderer endpoint
      --clientauth                          Use mutual TLS when communicating with the orderer endpoint
      --connTimeout duration                Timeout for client to connect (default 3s)
      --keyfile string                      Path to file containing PEM-encoded private key to use for mutual TLS communication with the orderer endpoint
  -o, --orderer string                      Ordering service endpoint
      --ordererTLSHostnameOverride string   The hostname override to use when validating the TLS connection to the orderer
      --tls                                 Use TLS when communicating with the orderer endpoint
      --tlsHandshakeTimeShift duration      The amount of time to shift backwards for certificate expiration checks during TLS handshakes with the orderer endpoint
1gezhanghao commented 1 year ago

yes, the peer cmd has always supported to find channels it joined. that is peer channel list --help info , it may help you to trace the implements code. and i need this API in fabric-admin-sdk

SamYuan1990 commented 1 year ago

yes, the peer cmd has always supported to find channels it joined. that is peer channel list --help info , it may help you to trace the implements code. and i need this API in fabric-admin-sdk

I will take a look at, as orderer and peer are different interface at implementation level.