bytesub

package
v1.3.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package bytesub provides the ability for many clients to subscribe to the latest value of a byte array.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByteSub

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

func New

func New() *ByteSub

func (*ByteSub) AnnounceLatest

func (s *ByteSub) AnnounceLatest(b []byte)

AnnounceLatest writes b to all of the subscribers, with caveats listed in Subscribe.

func (*ByteSub) Subscribe

func (s *ByteSub) Subscribe(ctx context.Context, w io.Writer) error

Subscribe writes the latest value in a single call to w.Write. It does not guarantee that all values published to AnnounceLatest will be written. However once things catch up, it will write the latest value. If no values have been announced, waits for a value before writing.

Jump to

Keyboard shortcuts

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