server

package
v0.55.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2026 License: Unlicense Imports: 9 Imported by: 0

Documentation

Overview

Package server provides the gRPC server implementation for distributed sync.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	distributedv1.UnimplementedDistributedSyncServiceServer
	// contains filtered or unexported fields
}

Service implements the DistributedSyncServiceServer interface.

func NewService

func NewService(db database.Database, mgr *distributed.Manager) *Service

NewService creates a new distributed sync gRPC service.

func (*Service) GetCurrentSerial

GetCurrentSerial returns this relay's current serial number.

func (*Service) GetEventIDs

GetEventIDs returns event IDs for a serial range.

func (*Service) GetInfo

func (s *Service) GetInfo(ctx context.Context, _ *commonv1.Empty) (*commonv1.SyncInfo, error)

GetInfo returns current sync service information.

func (*Service) GetPeerPubkey

GetPeerPubkey fetches the pubkey for a peer relay via NIP-11.

func (*Service) GetPeers

GetPeers returns the current list of sync peers.

func (*Service) GetSyncStatus

GetSyncStatus returns current sync status for all peers.

func (*Service) HandleCurrentRequest

func (s *Service) HandleCurrentRequest(ctx context.Context, req *commonv1.HTTPRequest) (*commonv1.HTTPResponse, error)

HandleCurrentRequest proxies /api/sync/current HTTP requests.

func (*Service) HandleEventIDsRequest

func (s *Service) HandleEventIDsRequest(ctx context.Context, req *commonv1.HTTPRequest) (*commonv1.HTTPResponse, error)

HandleEventIDsRequest proxies /api/sync/event-ids HTTP requests.

func (*Service) IsAuthorizedPeer

IsAuthorizedPeer checks if a peer is authorized by validating its NIP-11 pubkey.

func (*Service) NotifyNewEvent

func (s *Service) NotifyNewEvent(ctx context.Context, req *distributedv1.NewEventNotification) (*commonv1.Empty, error)

NotifyNewEvent notifies the service of a new event being stored.

func (*Service) Ready

Ready returns whether the service is ready to serve requests.

func (*Service) TriggerSync

func (s *Service) TriggerSync(ctx context.Context, _ *commonv1.Empty) (*commonv1.Empty, error)

TriggerSync manually triggers a sync cycle with all peers.

func (*Service) UpdatePeers

UpdatePeers updates the peer list.

func (*Service) UpdateSerial

func (s *Service) UpdateSerial(ctx context.Context, _ *commonv1.Empty) (*commonv1.Empty, error)

UpdateSerial updates the current serial from database.

Source Files

  • service.go

Jump to

Keyboard shortcuts

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