sync

package
v0.55.10 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: Unlicense Imports: 11 Imported by: 0

Documentation

Overview

Package sync provides backward compatibility facade for sync services New code should import the specific subpackages directly:

  • next.orly.dev/pkg/sync/distributed
  • next.orly.dev/pkg/sync/cluster
  • next.orly.dev/pkg/sync/relaygroup
  • next.orly.dev/pkg/sync/negentropy

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasDriver added in v0.55.4

func HasDriver(name string) bool

HasDriver returns true if the named driver is registered.

func ListDrivers added in v0.55.4

func ListDrivers() []string

ListDrivers returns a sorted list of registered driver names.

func RegisterDriver added in v0.55.4

func RegisterDriver(name, description string, factory DriverFactory)

RegisterDriver registers a sync driver with the given name and factory. This is typically called from init() in the driver package.

Types

type ClusterManager added in v0.24.2

type ClusterManager = cluster.Manager

ClusterManager is the cluster replication manager

func NewClusterManager added in v0.24.2

func NewClusterManager(ctx context.Context, db *database.D, adminNpubs []string, propagatePrivilegedEvents bool, publisher interface{ Deliver(*event.E) }) *ClusterManager

NewClusterManager creates a new cluster manager with backward compatible signature

type DriverConfig added in v0.55.4

type DriverConfig struct {
	// Common settings
	LogLevel string

	// Negentropy-specific settings
	TargetRelays []string
	Filter       string
	SyncInterval string
	BatchSize    int

	// Cluster-specific settings
	AdminNpubs                []string
	PropagatePrivilegedEvents bool
	PollInterval              string

	// Distributed-specific settings
	NodeID   string
	RelayURL string
	Peers    []string

	// Relay group settings
	RelayGroups []string
}

DriverConfig holds configuration for sync drivers.

type DriverFactory added in v0.55.4

type DriverFactory func(ctx context.Context, db database.Database, cfg *DriverConfig) (Service, error)

DriverFactory is the signature for sync driver factory functions.

func GetDriver added in v0.55.4

func GetDriver(name string) DriverFactory

GetDriver returns the factory for the named driver, or nil if not found.

type DriverInfo added in v0.55.4

type DriverInfo struct {
	Name        string
	Description string
	Factory     DriverFactory
}

DriverInfo contains metadata about a registered sync driver.

func ListDriversWithInfo added in v0.55.4

func ListDriversWithInfo() []*DriverInfo

ListDriversWithInfo returns information about all registered drivers.

type Manager

type Manager = distributed.Manager

Manager is the distributed sync manager

func NewManager

func NewManager(ctx context.Context, db *database.D, nodeID, relayURL string, peers []string, relayGroupMgr *RelayGroupManager, policyManager interface {
	CheckPolicy(action string, ev *event.E, pubkey []byte, remote string) (bool, error)
}) *Manager

NewManager creates a new distributed sync manager with backward compatible signature

type NIP11Cache added in v0.24.1

type NIP11Cache = common.NIP11Cache

NIP11Cache is the NIP-11 relay info cache

func NewNIP11Cache added in v0.24.1

func NewNIP11Cache(ttl time.Duration) *NIP11Cache

NewNIP11Cache creates a new NIP-11 cache

type RelayGroupConfig added in v0.24.1

type RelayGroupConfig = relaygroup.Config

RelayGroupConfig is the relay group configuration

type RelayGroupManager added in v0.24.1

type RelayGroupManager = relaygroup.Manager

RelayGroupManager is the relay group configuration manager

func NewRelayGroupManager added in v0.24.1

func NewRelayGroupManager(db *database.D, adminNpubs []string) *RelayGroupManager

NewRelayGroupManager creates a new relay group manager with backward compatible signature

type Service added in v0.55.4

type Service interface {
	// Start begins the sync service
	Start() error
	// Stop stops the sync service
	Stop() error
	// Type returns the service type name
	Type() string
}

Service is the interface that sync drivers must implement.

func NewFromDriver added in v0.55.4

func NewFromDriver(ctx context.Context, driverName string, db database.Database, cfg *DriverConfig) (Service, error)

NewFromDriver creates a sync service using the named driver. Returns an error if the driver is not registered.

Source Files

  • register_cluster.go
  • register_distributed.go
  • register_negentropy.go
  • register_relaygroup.go
  • registry.go
  • sync.go

Directories

Path Synopsis
Package cluster provides cluster replication with persistent state
Package cluster provides cluster replication with persistent state
grpc
Package grpc provides a gRPC client for the cluster sync service.
Package grpc provides a gRPC client for the cluster sync service.
server
Package server provides the gRPC server implementation for cluster sync.
Package server provides the gRPC server implementation for cluster sync.
Package common provides shared utilities for sync services
Package common provides shared utilities for sync services
Package distributed provides serial-based peer-to-peer synchronization
Package distributed provides serial-based peer-to-peer synchronization
grpc
Package grpc provides a gRPC client for the distributed sync service.
Package grpc provides a gRPC client for the distributed sync service.
server
Package server provides the gRPC server implementation for distributed sync.
Package server provides the gRPC server implementation for distributed sync.
Package negentropy provides NIP-77 negentropy-based set reconciliation for both relay-to-relay sync and client-facing WebSocket operations.
Package negentropy provides NIP-77 negentropy-based set reconciliation for both relay-to-relay sync and client-facing WebSocket operations.
grpc
Package grpc provides a gRPC client for the negentropy sync service.
Package grpc provides a gRPC client for the negentropy sync service.
server
Package server provides the gRPC server implementation for negentropy sync.
Package server provides the gRPC server implementation for negentropy sync.
Package relaygroup provides relay group configuration management
Package relaygroup provides relay group configuration management
grpc
Package grpc provides a gRPC client for the relay group service.
Package grpc provides a gRPC client for the relay group service.
server
Package server provides the gRPC server implementation for relay group.
Package server provides the gRPC server implementation for relay group.

Jump to

Keyboard shortcuts

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