Documentation
¶
Overview ¶
Package server provides the gRPC server implementation for distributed sync.
Index ¶
- type Service
- func (s *Service) GetCurrentSerial(ctx context.Context, req *distributedv1.CurrentRequest) (*distributedv1.CurrentResponse, error)
- func (s *Service) GetEventIDs(ctx context.Context, req *distributedv1.EventIDsRequest) (*distributedv1.EventIDsResponse, error)
- func (s *Service) GetInfo(ctx context.Context, _ *commonv1.Empty) (*commonv1.SyncInfo, error)
- func (s *Service) GetPeerPubkey(ctx context.Context, req *distributedv1.PeerPubkeyRequest) (*distributedv1.PeerPubkeyResponse, error)
- func (s *Service) GetPeers(ctx context.Context, _ *commonv1.Empty) (*distributedv1.PeersResponse, error)
- func (s *Service) GetSyncStatus(ctx context.Context, _ *commonv1.Empty) (*distributedv1.SyncStatusResponse, error)
- func (s *Service) HandleCurrentRequest(ctx context.Context, req *commonv1.HTTPRequest) (*commonv1.HTTPResponse, error)
- func (s *Service) HandleEventIDsRequest(ctx context.Context, req *commonv1.HTTPRequest) (*commonv1.HTTPResponse, error)
- func (s *Service) IsAuthorizedPeer(ctx context.Context, req *distributedv1.AuthorizedPeerRequest) (*distributedv1.AuthorizedPeerResponse, error)
- func (s *Service) NotifyNewEvent(ctx context.Context, req *distributedv1.NewEventNotification) (*commonv1.Empty, error)
- func (s *Service) Ready(ctx context.Context, _ *commonv1.Empty) (*commonv1.ReadyResponse, error)
- func (s *Service) TriggerSync(ctx context.Context, _ *commonv1.Empty) (*commonv1.Empty, error)
- func (s *Service) UpdatePeers(ctx context.Context, req *distributedv1.UpdatePeersRequest) (*commonv1.Empty, error)
- func (s *Service) UpdateSerial(ctx context.Context, _ *commonv1.Empty) (*commonv1.Empty, error)
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 ¶
func (s *Service) GetCurrentSerial(ctx context.Context, req *distributedv1.CurrentRequest) (*distributedv1.CurrentResponse, error)
GetCurrentSerial returns this relay's current serial number.
func (*Service) GetEventIDs ¶
func (s *Service) GetEventIDs(ctx context.Context, req *distributedv1.EventIDsRequest) (*distributedv1.EventIDsResponse, error)
GetEventIDs returns event IDs for a serial range.
func (*Service) GetInfo ¶
GetInfo returns current sync service information.
func (*Service) GetPeerPubkey ¶
func (s *Service) GetPeerPubkey(ctx context.Context, req *distributedv1.PeerPubkeyRequest) (*distributedv1.PeerPubkeyResponse, error)
GetPeerPubkey fetches the pubkey for a peer relay via NIP-11.
func (*Service) GetPeers ¶
func (s *Service) GetPeers(ctx context.Context, _ *commonv1.Empty) (*distributedv1.PeersResponse, error)
GetPeers returns the current list of sync peers.
func (*Service) GetSyncStatus ¶
func (s *Service) GetSyncStatus(ctx context.Context, _ *commonv1.Empty) (*distributedv1.SyncStatusResponse, error)
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 ¶
func (s *Service) IsAuthorizedPeer(ctx context.Context, req *distributedv1.AuthorizedPeerRequest) (*distributedv1.AuthorizedPeerResponse, error)
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 ¶
TriggerSync manually triggers a sync cycle with all peers.
func (*Service) UpdatePeers ¶
func (s *Service) UpdatePeers(ctx context.Context, req *distributedv1.UpdatePeersRequest) (*commonv1.Empty, error)
UpdatePeers updates the peer list.
Source Files
¶
- service.go