Documentation
¶
Overview ¶
Package grpc provides a gRPC client for the negentropy sync service.
Index ¶
- type Client
- func (c *Client) AddPeer(ctx context.Context, peerURL string) error
- func (c *Client) Close() error
- func (c *Client) CloseSession(ctx context.Context, connectionID, subscriptionID string) error
- func (c *Client) GetPeerSyncState(ctx context.Context, peerURL string) (*PeerSyncState, bool, error)
- func (c *Client) GetPeers(ctx context.Context) ([]string, error)
- func (c *Client) GetSyncStatus(ctx context.Context) (*SyncStatus, error)
- func (c *Client) HandleNegClose(ctx context.Context, connectionID, subscriptionID string) error
- func (c *Client) HandleNegMsg(ctx context.Context, connectionID, subscriptionID string, message []byte) ([]byte, [][]byte, [][]byte, bool, string, error)
- func (c *Client) HandleNegOpen(ctx context.Context, connectionID, subscriptionID string, ...) ([]byte, [][]byte, [][]byte, bool, string, error)
- func (c *Client) ListSessions(ctx context.Context) ([]*negentropyiface.ClientSession, error)
- func (c *Client) Ready() <-chan struct{}
- func (c *Client) RemovePeer(ctx context.Context, peerURL string) error
- func (c *Client) Start(ctx context.Context) error
- func (c *Client) Stop(ctx context.Context) error
- func (c *Client) SyncWithPeer(ctx context.Context, peerURL string, filter *commonv1.Filter, since int64) (<-chan *SyncProgress, error)
- func (c *Client) TriggerSync(ctx context.Context, peerURL string, filter *commonv1.Filter) error
- type ClientConfig
- type PeerSyncState
- type SyncProgress
- type SyncStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a gRPC client for the negentropy sync service.
func New ¶
func New(ctx context.Context, cfg *ClientConfig) (*Client, error)
New creates a new gRPC negentropy sync client.
func (*Client) CloseSession ¶
CloseSession forcefully closes a client session.
func (*Client) GetPeerSyncState ¶
func (c *Client) GetPeerSyncState(ctx context.Context, peerURL string) (*PeerSyncState, bool, error)
GetPeerSyncState returns sync state for a specific peer.
func (*Client) GetSyncStatus ¶
func (c *Client) GetSyncStatus(ctx context.Context) (*SyncStatus, error)
GetSyncStatus returns the current sync status.
func (*Client) HandleNegClose ¶
HandleNegClose processes a NEG-CLOSE message from a client.
func (*Client) HandleNegMsg ¶
func (c *Client) HandleNegMsg(ctx context.Context, connectionID, subscriptionID string, message []byte) ([]byte, [][]byte, [][]byte, bool, string, error)
HandleNegMsg processes a NEG-MSG message from a client.
func (*Client) HandleNegOpen ¶
func (c *Client) HandleNegOpen(ctx context.Context, connectionID, subscriptionID string, filter *commonv1.Filter, initialMessage []byte) ([]byte, [][]byte, [][]byte, bool, string, error)
HandleNegOpen processes a NEG-OPEN message from a client. Returns: message, haveIDs, needIDs, complete, errorStr, error
func (*Client) ListSessions ¶
func (c *Client) ListSessions(ctx context.Context) ([]*negentropyiface.ClientSession, error)
ListSessions returns active client negentropy sessions.
func (*Client) Ready ¶
func (c *Client) Ready() <-chan struct{}
Ready returns a channel that closes when the client is ready.
func (*Client) RemovePeer ¶
RemovePeer removes a peer from negentropy sync.
type ClientConfig ¶
ClientConfig holds configuration for the gRPC client.
type PeerSyncState ¶
type PeerSyncState struct {
PeerURL string
LastSync int64
EventsSynced int64
Status string
LastError string
ConsecutiveFailures int32
}
PeerSyncState represents sync state for a peer.
type SyncProgress ¶
type SyncProgress struct {
PeerURL string
Round int32
HaveCount int64
NeedCount int64
FetchedCount int64
SentCount int64
Complete bool
Error string
}
SyncProgress represents progress during a peer sync operation.
type SyncStatus ¶
type SyncStatus struct {
Active bool
LastSync int64
PeerCount int32
PeerStates []*PeerSyncState
}
SyncStatus represents the sync status response.