_1_communicate_by_sharing_memory

package
v0.0.0-...-a7c7adb Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Host

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

Host 代表当前节点的连接管理

func NewHost

func NewHost() *Host

NewHost()用来创建一个Host对象,用来代表当前节点。

func (*Host) AddPeer

func (h *Host) AddPeer(p *Peer)

添加

func (*Host) BroadcastMsg

func (h *Host) BroadcastMsg(msg string)

广播消息

func (*Host) GePeer

func (h *Host) GePeer(pid string) *Peer

获取

func (*Host) Remove

func (h *Host) Remove(pid string)

删除

type Peer

type Peer struct {
	ID string
}

Peer代表一个节点

func (*Peer) WriteMsg

func (p *Peer) WriteMsg(msg string)

Jump to

Keyboard shortcuts

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