Documentation ¶
Index ¶
Constants ¶
View Source
const CName = "common.net.streampool"
Variables ¶
View Source
var ( // EncodingProto drpc.Encoding implementation for gogo protobuf EncodingProto drpc.Encoding = protoEncoding{} )
Functions ¶
This section is empty.
Types ¶
type ExecPool ¶ added in v0.1.2
type ExecPool struct {
// contains filtered or unexported fields
}
ExecPool needed for parallel execution of the incoming send tasks
func NewExecPool ¶ added in v0.1.2
NewExecPool creates new ExecPool workers - how many processes will execute tasks maxSize - limit for queue size
type MessageQueueId ¶
type PeerGetter ¶
PeerGetter should dial or return cached peers
type ProtoMessageGettable ¶ added in v0.5.0
type ProtoMessageSettable ¶ added in v0.5.0
type ProtoMessageSettable interface { ProtoMessageGettable SetProtoMessage(proto.Message) error }
type SizeableMessage ¶ added in v0.3.9
type SizeableMessage interface {
Size() int
}
type StreamConfig ¶
type StreamPool ¶
type StreamPool interface { app.ComponentRunnable // AddStream adds new outgoing stream into the pool AddStream(stream drpc.Stream, queueSize int, tags ...string) (err error) // ReadStream adds new incoming stream and synchronously read it ReadStream(stream drpc.Stream, queueSize int, tags ...string) (err error) // Send sends a message to given peers. A stream will be opened if it is not cached before. Works async. Send(ctx context.Context, msg drpc.Message, target PeerGetter) (err error) // SendById sends a message to given peerIds. Works only if stream exists SendById(ctx context.Context, msg drpc.Message, peerIds ...string) (err error) // Broadcast sends a message to all peers with given tags. Works async. Broadcast(ctx context.Context, msg drpc.Message, tags ...string) (err error) // AddTagsCtx adds tags to stream, stream will be extracted from ctx AddTagsCtx(ctx context.Context, tags ...string) error // RemoveTagsCtx removes tags from stream, stream will be extracted from ctx RemoveTagsCtx(ctx context.Context, tags ...string) error // Streams gets all streams for specific tags Streams(tags ...string) (streams []drpc.Stream) }
StreamPool keeps and read streams
func New ¶
func New() StreamPool
Source Files ¶
Click to show internal directories.
Click to hide internal directories.