replicasync

package
v0.27.3 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PubsubEvent = "replica"

Functions

This section is empty.

Types

type Manager

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

Manager keeps the replica up to date and in sync with other replicas.

func New

func New(ctx context.Context, logger slog.Logger, db database.Store, ps pubsub.Pubsub, options *Options) (*Manager, error)

New registers the replica with the database and periodically updates to ensure it's healthy. It contacts all other alive replicas to ensure they are reachable.

func (*Manager) All

func (m *Manager) All() []database.Replica

All returns every replica, including itself.

func (*Manager) Close

func (m *Manager) Close() error

func (*Manager) Regional

func (m *Manager) Regional() []database.Replica

Regional returns all replicas in the same region excluding itself.

func (*Manager) Self

func (m *Manager) Self() database.Replica

Self represents the current replica.

func (*Manager) SetCallback

func (m *Manager) SetCallback(callback func())

SetCallback sets a function to execute whenever new peers are refreshed or updated.

type Options

type Options struct {
	ID              uuid.UUID
	CleanupInterval time.Duration
	UpdateInterval  time.Duration
	PeerTimeout     time.Duration
	RelayAddress    string
	RegionID        int32
	TLSConfig       *tls.Config
}

Jump to

Keyboard shortcuts

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

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy