proc

package
v0.0.0-...-0e6f1c7 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2021 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseBridge

func CloseBridge(bd int) int

* close bridge_hub of process

  • @bd:bridge_descriptor,该进程打开的bridge描述符

* @return -1:failed 0:success

func OpenBridge

func OpenBridge(name_space string, proc_id int, slogd int) int

* open bridge * @name_space:系统的命名空间 * @proc_id:服务进程的全局ID * @slogd:slog的描述句柄 * @return: * -1:failed * >=0:SUCCESS 返回bridge句柄描述符

func RecvBridge

func RecvBridge(bd int, recv_buff []byte, recv_len int, sender *int, drop_time int) int

* recv_from_bridge * @bd:bridge_descriptor,该进程打开的bridge描述符 * @recv_buff:接收数据缓冲区 * @recv_len:接收缓冲区长度 * @sender:sender proc_id if not null * @drop_time: >=0丢弃发送时间超过drop_time(秒)的包; -1:不丢弃任何包 * @return: * -1:错误 * -2:接收缓冲区空 * -3:接收数据超出包长 * else:实际接收的长度

func SendBridge

func SendBridge(bd int, target_id int, sending_data []byte, data_len int) int

* send_to_bridge * @bd:bridge_descriptor,该进程打开的bridge描述符 * @target_id:目标服务进程的全局ID * @sending_data:发送的数据 * @len:发送数据长度 * @return: * -1:错误 * -2:发送缓冲区满 * -3:发送数据超出包长 * 0:成功

Types

type Proc

type Proc struct {
	sync.Mutex
	// contains filtered or unexported fields
}

//////////////SPEC PROC STRUCT//////////////

func Open

func Open(name_space string, proc_id int) *Proc

* 打开本进程的通信 * @name_space:系统的命名空间 * @proc_id:服务进程的全局ID * @return: * -1:failed * >=0:SUCCESS 返回bridge句柄描述符

func (*Proc) Close

func (p *Proc) Close() int

* 关闭进程通信

  • @bd:bridge_descriptor,该进程打开的bridge描述符

* @return -1:failed 0:success

func (*Proc) Recv

func (p *Proc) Recv(recv_buff []byte, recv_len int, sender *int) int

* 接收其他进程的数据 * @recv_buff:接收数据缓冲区 * @recv_len:接收缓冲区长度 * @sender:发送的进程ID * @return: * -1:错误 * -2:接收缓冲区空 * -3:接收数据超出包长 * else:实际接收的长度

func (*Proc) Send

func (p *Proc) Send(target_id int, sending_data []byte, data_len int) int

* 发送数据到目标进程 * @target_id:目标服务进程的全局ID * @sending_data:发送的数据 * @len:发送数据长度 * @return: * -1:错误 * -2:发送缓冲区满 * -3:发送数据超出包长 * 0:成功

func (*Proc) SendByLock

func (p *Proc) SendByLock(target_id int, sending_data []byte, data_len int) int

* 发送数据到目标进程.发送时加锁 * @target_id:目标服务进程的全局ID * @sending_data:发送的数据 * @len:发送数据长度 * @return: * -1:错误 * -2:发送缓冲区满 * -3:发送数据超出包长 * 0:成功

type ProcHeader

type ProcHeader interface {
	Send(target_id int, sending_data []byte, data_len int) int
	SendByLock(target_id int, sending_data []byte, data_len int) int
	Recv(recv_buff []byte, recv_len int, sender *int) int
	Close() int
}

Jump to

Keyboard shortcuts

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