rendezvous

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: Apache-2.0, MIT Imports: 17 Imported by: 1

Documentation

Index

Constants

View Source
const DefaultRotationInterval = time.Hour * 24
View Source
const EmitterServiceType = "emitter-io"

Variables

View Source
var (
	RotationGracePeriod  = time.Minute * 10
	MinimumDelayRotation = time.Minute
)

Functions

func GenerateRendezvousPointForPeriod

func GenerateRendezvousPointForPeriod(topic, seed []byte, date time.Time) []byte

func NextTimePeriod

func NextTimePeriod(date time.Time, interval time.Duration) time.Time

func RoundTimePeriod

func RoundTimePeriod(date time.Time, interval time.Duration) time.Time

Types

type EmitterClientOptions

type EmitterClientOptions struct {
	Logger *zap.Logger
}

type EmitterOptions

type EmitterOptions struct {
	Logger           *zap.Logger
	ServerPublicAddr string
	EmitterOptions   []func(*emitter.Client)
}

type EmitterPubSub

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

func NewEmitterServer

func NewEmitterServer(serverAddr string, adminKey string, options *EmitterOptions) (*EmitterPubSub, error)

func (*EmitterPubSub) Close

func (p *EmitterPubSub) Close() error

func (*EmitterPubSub) GetServiceType

func (p *EmitterPubSub) GetServiceType() string

func (*EmitterPubSub) Register

func (p *EmitterPubSub) Register(pid peer.ID, ns string, addrs [][]byte, ttlAsSeconds int, counter uint64)

func (*EmitterPubSub) Subscribe

func (p *EmitterPubSub) Subscribe(ns string) (string, error)

func (*EmitterPubSub) Unregister

func (p *EmitterPubSub) Unregister(_ peer.ID, _ string)

type EmitterPubSubSubscriptionDetails

type EmitterPubSubSubscriptionDetails struct {
	ServerAddr  string
	ReadKey     string
	ChannelName string
}

type Point

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

func (*Point) Deadline

func (p *Point) Deadline() time.Time

func (*Point) IsExpired

func (p *Point) IsExpired() bool

func (*Point) NextPoint

func (p *Point) NextPoint() *Point

func (*Point) RawRotationTopic

func (p *Point) RawRotationTopic() []byte

func (*Point) RawTopic

func (p *Point) RawTopic() []byte

func (*Point) RotationTopic

func (p *Point) RotationTopic() string

func (*Point) Seed

func (p *Point) Seed() []byte

func (*Point) TTL

func (p *Point) TTL() time.Duration

func (*Point) Topic

func (p *Point) Topic() string

type RotationInterval

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

func NewRotationInterval

func NewRotationInterval(interval time.Duration) *RotationInterval

func NewStaticRotationInterval

func NewStaticRotationInterval() *RotationInterval

func (*RotationInterval) NewRendezvousPointForPeriod

func (r *RotationInterval) NewRendezvousPointForPeriod(at time.Time, topic string, seed []byte) (point *Point)

func (*RotationInterval) NextTimePeriod

func (r *RotationInterval) NextTimePeriod(at time.Time) time.Time

func (*RotationInterval) PointForRawRotation

func (r *RotationInterval) PointForRawRotation(rotation []byte) (*Point, error)

func (*RotationInterval) PointForRotation

func (r *RotationInterval) PointForRotation(rotation string) (*Point, error)

func (*RotationInterval) PointForTopic

func (r *RotationInterval) PointForTopic(topic string) (*Point, error)

func (*RotationInterval) RegisterRotation

func (r *RotationInterval) RegisterRotation(at time.Time, topic string, seed []byte)

func (*RotationInterval) RoundTimePeriod

func (r *RotationInterval) RoundTimePeriod(at time.Time) time.Time

type SyncClient

type SyncClient interface {
	rendezvous.RendezvousSyncClient

	io.Closer
}

func NewEmitterClient

func NewEmitterClient(opts *EmitterClientOptions) SyncClient

Jump to

Keyboard shortcuts

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