grpc

package
v0.0.0-...-61fb44a Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListenAndServe

func ListenAndServe(port uint64) error

ListenAndServe binds the GRPC server to the port and starts listening

Types

type Client

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

Client is the GRPC client struct

func NewClient

func NewClient(url string) *Client

NewClient returns a new GRPC client give its URL IP:PORT or DNS:PORT

func (*Client) Consume

func (c *Client) Consume(count int64) ([]*types.Payload, error)

Consume data from the GRPC server

func (*Client) Publish

func (c *Client) Publish(payloads []*types.Payload) error

Publish data to the GRPC server

type List

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

List is a lock-free linked list theory -> https://www.cs.rochester.edu/u/scott/papers/1996_PODC_queues.pdf pseudocode -> https://www.cs.rochester.edu/research/synchronization/pseudocode/queues.html much faster and efficient than container/list + sync.Mutex Used as a thread-safe in-memory storage for payload objects by the GRPC server

func NewList

func NewList() List

NewList returns a new list

func (*List) Dequeue

func (l *List) Dequeue() (value *types.Payload)

Dequeue removes and returns the value at the head of the queue to the memory pool It returns nil if the list is empty

func (*List) Enqueue

func (l *List) Enqueue(value *types.Payload)

Enqueue inserts a value into the list

Jump to

Keyboard shortcuts

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