go-micro: github.com/micro/go-micro/util/socket Index | Files

package socket

import "github.com/micro/go-micro/util/socket"

Package socket provides a pseudo socket

Index

Package Files

pool.go socket.go

type Pool Uses

type Pool struct {
    sync.RWMutex
    // contains filtered or unexported fields
}

func NewPool Uses

func NewPool() *Pool

NewPool returns a new socket pool

func (*Pool) Close Uses

func (p *Pool) Close()

Close the pool and delete all the sockets

func (*Pool) Get Uses

func (p *Pool) Get(id string) (*Socket, bool)

func (*Pool) Release Uses

func (p *Pool) Release(s *Socket)

type Socket Uses

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

Socket is our pseudo socket for transport.Socket

func New Uses

func New(id string) *Socket

New returns a new pseudo socket which can be used in the place of a transport socket. Messages are sent to the socket via Accept and receives from the socket via Process. SetLocal/SetRemote should be called before using the socket.

func (*Socket) Accept Uses

func (s *Socket) Accept(m *transport.Message) error

Accept passes a message to the socket which will be processed by the call to Recv

func (*Socket) Close Uses

func (s *Socket) Close() error

Close closes the socket

func (*Socket) Local Uses

func (s *Socket) Local() string

func (*Socket) Process Uses

func (s *Socket) Process(m *transport.Message) error

Process takes the next message off the send queue created by a call to Send

func (*Socket) Recv Uses

func (s *Socket) Recv(m *transport.Message) error

func (*Socket) Remote Uses

func (s *Socket) Remote() string

func (*Socket) Send Uses

func (s *Socket) Send(m *transport.Message) error

func (*Socket) SetLocal Uses

func (s *Socket) SetLocal(l string)

func (*Socket) SetRemote Uses

func (s *Socket) SetRemote(r string)

Package socket imports 3 packages (graph) and is imported by 4 packages. Updated 2020-02-17. Refresh now. Tools for package owners.