observer

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrWrongTypeChannel   = errors.New("wrong type of channel")
	ErrWrongTypeConfigmap = errors.New("wrong type of configmap")
)

Functions

func IsConfigMapHasProfile

func IsConfigMapHasProfile(name string) bool

func Run

func Run(ctx context.Context, config *rest.Config, host, operatorNamespace, authMethod string) (err error)

Types

type AdminCredential

type AdminCredential struct {
	ID       string `yaml:"id,omitempty" json:"id,omitempty"`
	Password string `yaml:"password,omitempty" json:"password" default:"passw0rd"`
}

+k8s:deepcopy-gen=true

type ChannelInfo

type ChannelInfo struct {
	// Peers which can be used to connect to this channel
	Peers map[string]PeerInfo `yaml:"peers" json:"peers"`
}

ChannelInfo defines configurations when connect to this channel +k8s:deepcopy-gen=true

type Client

type Client struct {
	Organization string `yaml:"organization,omitempty" json:"organization,omitempty"`
	Logging      `yaml:"logging,omitempty" json:"logging,omitempty"`
	// For blockchain explorer
	AdminCredential `yaml:"adminCredential,omitempty" json:"adminCredential,omitempty"`
	CredentialStore `yaml:"credentialStore,omitempty" json:"credentialStore,omitempty"`
	TLSEnable       bool `yaml:"tlsEnable,omitempty" json:"tlsEnable,omitempty"`
}

Client defines who is trying to connect with networks

type CredentialStore

type CredentialStore struct {
	Path        string `yaml:"path,omitempty" json:"path,omitempty"`
	CryptoStore `yaml:"cryptoStore,omitempty" json:"cryptoStore,omitempty"`
}

+k8s:deepcopy-gen=true

type CryptoConfig

type CryptoConfig struct {
	Path string `yaml:"path,omitempty" json:"path,omitempty"`
}

+k8s:deepcopy-gen=true

type CryptoStore

type CryptoStore struct {
	Path string `yaml:"path,omitempty" json:"path,omitempty"`
}

+k8s:deepcopy-gen=true

type Logging

type Logging struct {
	Level string `yaml:"level,omitempty" json:"level,omitempty"`
}

+k8s:deepcopy-gen=true

type Msg

type Msg struct {
	ChannelID   string
	NetworkName string
	Type        MsgType
	Data        *network.Network
}

type MsgType

type MsgType int
const (
	Register   MsgType = 1
	Deregister MsgType = 1 << iota
	Delete     MsgType = 1 << iota
)

type NodeEndpoint

type NodeEndpoint struct {
	URL        string `yaml:"url,omitempty" json:"url,omitempty"`
	TLSCACerts `yaml:"tlsCACerts,omitempty" json:"tlsCACerts,omitempty"`
}

+k8s:deepcopy-gen=true

type OrganizationInfo

type OrganizationInfo struct {
	MSPID string          `yaml:"mspid,omitempty" json:"mspid,omitempty"`
	Users map[string]User `yaml:"users,omitempty" json:"users,omitempty"`
	Peers []string        `yaml:"peers,omitempty" json:"peers,omitempty"`

	// For blockchain explorer
	AdminPrivateKey Pem `yaml:"adminPrivateKey,omitempty" json:"adminPrivateKey,omitempty"`
	SignedCert      Pem `yaml:"signedCert,omitempty" json:"signedCert,omitempty"`
}

OrganizationInfo defines a organization along with its users and peers +k8s:deepcopy-gen=true

type PeerInfo

type PeerInfo struct {
	EndorsingPeer  *bool `yaml:"endorsingPeer,omitempty" json:"endorsingPeer,omitempty"`
	ChaincodeQuery *bool `yaml:"chaincodeQuery,omitempty" json:"chaincodeQuery,omitempty"`
	LedgerQuery    *bool `yaml:"ledgerQuery,omitempty" json:"ledgerQuery,omitempty"`
	EventSource    *bool `yaml:"eventSource,omitempty" json:"eventSource,omitempty"`
}

+k8s:deepcopy-gen=true

type Pem

type Pem struct {
	Pem string `yaml:"pem,omitempty" json:"pem,omitempty"`
}

+k8s:deepcopy-gen=true

type Profile

type Profile struct {
	Version       string `yaml:"version,omitempty" json:"version,omitempty"`
	Client        `yaml:"client,omitempty" json:"client,omitempty"`
	Channels      map[string]ChannelInfo      `yaml:"channels" json:"channels"`
	Organizations map[string]OrganizationInfo `yaml:"organizations,omitempty" json:"organizations,omitempty"`
	// Orderers defines all orderer endpoints which can be used
	Orderers map[string]NodeEndpoint `yaml:"orderers,omitempty" json:"orderers,omitempty"`
	// Peers defines all peer endpoints which can be used
	Peers map[string]NodeEndpoint `yaml:"peers,omitempty" json:"peers,omitempty"`
}

Profile contasins all we need to connect with a blockchain network. Currently we use embedded pem by default +k8s:deepcopy-gen=true

type Pusher

type Pusher struct {
	Host string
	Auth string
	Msg  <-chan Msg
}

func NewPusher

func NewPusher(host, auth string, msg <-chan Msg) *Pusher

func (*Pusher) AddAuth

func (p *Pusher) AddAuth(req *http.Request)

func (*Pusher) DeRegister

func (p *Pusher) DeRegister(name string) (err error)

func (*Pusher) Delete

func (p *Pusher) Delete(name string) (err error)

func (*Pusher) Register

func (p *Pusher) Register(key string, data *network.Network) (err error)

func (*Pusher) Run

func (p *Pusher) Run(ctx context.Context)

type TLSCACerts

type TLSCACerts struct {
	Path string `yaml:"path,omitempty" json:"path,omitempty"`
	Pem  string `yaml:"pem,omitempty" json:"pem,omitempty"`
}

+k8s:deepcopy-gen=true

type User

type User struct {
	Name string `yaml:"name,omitempty" json:"name,omitempty"`
	Key  Pem    `yaml:"key,omitempty" json:"key,omitempty"`
	Cert Pem    `yaml:"cert,omitempty" json:"cert,omitempty"`
}

User is the ca identity which has a private key(embedded pem) and signed certificate(embedded pem) +k8s:deepcopy-gen=true

type Watcher

type Watcher struct {
	Msg               chan<- Msg
	Client            *kubernetes.Clientset
	VClient           *versioned.Clientset
	Send              sync.Map
	OperatorNamespace string
}

func NewWatcher

func NewWatcher(msg chan<- Msg, client *kubernetes.Clientset, vclient *versioned.Clientset, operatorNamespace string) *Watcher

func (*Watcher) ChannelDelete

func (w *Watcher) ChannelDelete(obj interface{})

func (*Watcher) ChannelUpdate

func (w *Watcher) ChannelUpdate(old interface{}, new interface{})

func (*Watcher) HandleProfile

func (w *Watcher) HandleProfile(ctx context.Context, operatorNamespace string, channel *v1beta1.Channel) (err error)

func (*Watcher) ProfileConfigMapCreate

func (w *Watcher) ProfileConfigMapCreate(obj interface{})

func (*Watcher) ProfileConfigMapUpdate

func (w *Watcher) ProfileConfigMapUpdate(old interface{}, new interface{})

func (*Watcher) SendProfile

func (w *Watcher) SendProfile(fabProfile *network.FabProfile, networkName, channelID string, channelStatus v1beta1.IBPCRStatusType)

Jump to

Keyboard shortcuts

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