port

package
v0.0.0-...-f069fcf Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2022 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Hub      = "hub"      // Hub: 同步数据,同步元数据等。
	Sidecar  = "sidecar"  // SideCar节点
	Appchain = "appchain" // 区块链客户端
	Local    = "local"
)
View Source
const (
	MinCapacity = 1
	Capacity    = 10
	MaxCapacity = 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message interface {
	Marshal() ([]byte, error)
	Unmarshal([]byte) error
}

type Port

type Port interface {
	ID() string
	Type() string
	Name() string
	Tag() string

	// Send 同步发送给绑定的对应的port dev
	Send(msg *pb.Message) (*pb.Message, error)

	// AsyncSend 异步发送给绑定的对应的port dev
	AsyncSend(msg *pb.Message) error

	// ListenIBTPX 从绑定的对应的port dev接收数据
	ListenIBTPX() <-chan *pb.Message
}

代表每一个路由端点 对router来说,只需要体现两个作用:1、did 唯一标识,2:接受一个ibtp数据函数。Send、recive(不对外开放) client 可是代表是sdk rpc 这些东西。 是否要做一个管理层,管理整个port.以及plugin。 Port

type PortMap

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

获取唯一hub 根据类型获取port 根据ID获取

func NewPortMap

func NewPortMap() *PortMap

func (*PortMap) Add

func (p *PortMap) Add(pt Port)

func (*PortMap) Adds

func (p *PortMap) Adds(pp []Port)

func (*PortMap) AllRouterPort

func (p *PortMap) AllRouterPort() []Port

func (*PortMap) GetHub

func (p *PortMap) GetHub() (Port, bool)

func (*PortMap) GetLocal

func (p *PortMap) GetLocal() (Port, bool)

func (*PortMap) IsExist

func (p *PortMap) IsExist(id string) bool

func (*PortMap) Load

func (p *PortMap) Load(key string) (value Port, ok bool)

func (*PortMap) Port

func (p *PortMap) Port(id string) (Port, bool)

func (*PortMap) RandRouterPort

func (p *PortMap) RandRouterPort() Port

func (*PortMap) Remove

func (p *PortMap) Remove(pt Port)

func (*PortMap) Removes

func (p *PortMap) Removes(ppt []Port)

func (*PortMap) RouterPortByID

func (p *PortMap) RouterPortByID(ids []string) []Port

func (*PortMap) RouterPortByTag

func (p *PortMap) RouterPortByTag(tag string) []Port

func (*PortMap) Store

func (p *PortMap) Store(id string, port Port)

type Type

type Type int

port 类型:主要是sider peer、plugin、blockchain peer。

Jump to

Keyboard shortcuts

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