Documentation
¶
Index ¶
- Variables
- type Manager
- func (m *Manager) AllPrimary() []database.Replica
- func (m *Manager) Close() error
- func (m *Manager) ID() uuid.UUID
- func (m *Manager) InRegion(regionID int32) []database.Replica
- func (m *Manager) PublishUpdate() error
- func (m *Manager) Regional() []database.Replica
- func (m *Manager) Self() database.Replica
- func (m *Manager) SetCallback(callback func())
- func (m *Manager) UpdateNow(ctx context.Context) error
- type Options
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) AllPrimary ¶
AllPrimary returns every primary replica (not workspace proxy replicas), including itself.
func (*Manager) InRegion ¶
InRegion returns every replica in the given DERP region excluding itself.
func (*Manager) PublishUpdate ¶
PublishUpdate notifies all other replicas to update.
func (*Manager) SetCallback ¶
func (m *Manager) SetCallback(callback func())
SetCallback sets a function to execute whenever new peers are refreshed or updated.
Click to show internal directories.
Click to hide internal directories.