Documentation
¶
Overview ¶
Package server provides the gRPC server implementation for negentropy sync.
Index ¶
- type Service
- func (s *Service) AddPeer(ctx context.Context, req *negentropyv1.AddPeerRequest) (*commonv1.Empty, error)
- func (s *Service) CloseSession(ctx context.Context, req *negentropyv1.CloseSessionRequest) (*commonv1.Empty, error)
- func (s *Service) GetPeerSyncState(ctx context.Context, req *negentropyv1.PeerSyncStateRequest) (*negentropyv1.PeerSyncStateResponse, error)
- func (s *Service) GetPeers(ctx context.Context, _ *commonv1.Empty) (*negentropyv1.PeersResponse, error)
- func (s *Service) GetSyncStatus(ctx context.Context, _ *commonv1.Empty) (*negentropyv1.SyncStatusResponse, error)
- func (s *Service) HandleNegClose(ctx context.Context, req *negentropyv1.NegCloseRequest) (*commonv1.Empty, error)
- func (s *Service) HandleNegMsg(ctx context.Context, req *negentropyv1.NegMsgRequest) (*negentropyv1.NegMsgResponse, error)
- func (s *Service) HandleNegOpen(ctx context.Context, req *negentropyv1.NegOpenRequest) (*negentropyv1.NegOpenResponse, error)
- func (s *Service) ListSessions(ctx context.Context, _ *commonv1.Empty) (*negentropyv1.ListSessionsResponse, error)
- func (s *Service) Ready(ctx context.Context, _ *commonv1.Empty) (*commonv1.ReadyResponse, error)
- func (s *Service) RemovePeer(ctx context.Context, req *negentropyv1.RemovePeerRequest) (*commonv1.Empty, error)
- func (s *Service) Start(ctx context.Context, _ *commonv1.Empty) (*commonv1.Empty, error)
- func (s *Service) Stop(ctx context.Context, _ *commonv1.Empty) (*commonv1.Empty, error)
- func (s *Service) SyncWithPeer(req *negentropyv1.SyncPeerRequest, ...) error
- func (s *Service) TriggerSync(ctx context.Context, req *negentropyv1.TriggerSyncRequest) (*commonv1.Empty, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
negentropyv1.UnimplementedNegentropyServiceServer
// contains filtered or unexported fields
}
Service implements the NegentropyServiceServer interface.
func NewService ¶
func NewService(db database.Database, mgr *negentropy.Manager) *Service
NewService creates a new negentropy gRPC service.
func (*Service) AddPeer ¶
func (s *Service) AddPeer(ctx context.Context, req *negentropyv1.AddPeerRequest) (*commonv1.Empty, error)
AddPeer adds a peer for negentropy sync.
func (*Service) CloseSession ¶
func (s *Service) CloseSession(ctx context.Context, req *negentropyv1.CloseSessionRequest) (*commonv1.Empty, error)
CloseSession forcefully closes a client session.
func (*Service) GetPeerSyncState ¶
func (s *Service) GetPeerSyncState(ctx context.Context, req *negentropyv1.PeerSyncStateRequest) (*negentropyv1.PeerSyncStateResponse, error)
GetPeerSyncState returns sync state for a specific peer.
func (*Service) GetPeers ¶
func (s *Service) GetPeers(ctx context.Context, _ *commonv1.Empty) (*negentropyv1.PeersResponse, error)
GetPeers returns the list of negentropy sync peers.
func (*Service) GetSyncStatus ¶
func (s *Service) GetSyncStatus(ctx context.Context, _ *commonv1.Empty) (*negentropyv1.SyncStatusResponse, error)
GetSyncStatus returns the current sync status.
func (*Service) HandleNegClose ¶
func (s *Service) HandleNegClose(ctx context.Context, req *negentropyv1.NegCloseRequest) (*commonv1.Empty, error)
HandleNegClose processes a NEG-CLOSE message from a client.
func (*Service) HandleNegMsg ¶
func (s *Service) HandleNegMsg(ctx context.Context, req *negentropyv1.NegMsgRequest) (*negentropyv1.NegMsgResponse, error)
HandleNegMsg processes a NEG-MSG message from a client.
func (*Service) HandleNegOpen ¶
func (s *Service) HandleNegOpen(ctx context.Context, req *negentropyv1.NegOpenRequest) (*negentropyv1.NegOpenResponse, error)
HandleNegOpen processes a NEG-OPEN message from a client.
func (*Service) ListSessions ¶
func (s *Service) ListSessions(ctx context.Context, _ *commonv1.Empty) (*negentropyv1.ListSessionsResponse, error)
ListSessions returns active client negentropy sessions.
func (*Service) Ready ¶
Ready returns whether the service is ready to serve requests.
func (*Service) RemovePeer ¶
func (s *Service) RemovePeer(ctx context.Context, req *negentropyv1.RemovePeerRequest) (*commonv1.Empty, error)
RemovePeer removes a peer from negentropy sync.
func (*Service) Start ¶
Start starts the background relay-to-relay sync.
func (*Service) Stop ¶
Stop stops the background sync.
func (*Service) SyncWithPeer ¶
func (s *Service) SyncWithPeer(req *negentropyv1.SyncPeerRequest, stream grpc.ServerStreamingServer[negentropyv1.SyncProgress]) error
SyncWithPeer initiates negentropy sync with a specific peer relay.
func (*Service) TriggerSync ¶
func (s *Service) TriggerSync(ctx context.Context, req *negentropyv1.TriggerSyncRequest) (*commonv1.Empty, error)
TriggerSync manually triggers sync with a specific peer or all peers.
Source Files
¶
- service.go