Documentation
¶
Index ¶
- type Client
- func (c *Client) Bootstrap(ctx context.Context) error
- func (c *Client) CheckEtcdHealth(ctx context.Context, processID int, dataDir string) (*EtcdHealth, error)
- func (c *Client) Close() error
- func (c *Client) Compact(ctx context.Context, revision int64, physical bool) error
- func (c *Client) EndpointsStatus(ctx context.Context) (map[string]interface{}, error)
- func (c *Client) GetCurrentRevision(ctx context.Context) (int64, error)
- func (c *Client) GetDatabaseSize(ctx context.Context) (int64, error)
- func (c *Client) GetLeader(ctx context.Context) (interface{}, error)
- func (c *Client) GetMetrics(ctx context.Context) (map[string]interface{}, error)
- func (c *Client) GetStatus(ctx context.Context) (*Status, error)
- func (c *Client) ListAlarms(ctx context.Context) ([]string, error)
- func (c *Client) MemberList(ctx context.Context) ([]interface{}, error)
- func (c *Client) NeedsBootstrap(ctx context.Context, pid int) (bool, error)
- func (c *Client) RestoreSnapshot(ctx context.Context, opts RestoreOptions) error
- func (c *Client) SaveSnapshot(ctx context.Context, filePath string) error
- type EtcdHealth
- type RestoreOptions
- type Status
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 es el cliente de bootstrap para etcd
func (*Client) CheckEtcdHealth ¶
func (c *Client) CheckEtcdHealth(ctx context.Context, processID int, dataDir string) (*EtcdHealth, error)
CheckEtcdHealth performs a comprehensive health check on the etcd server
func (*Client) EndpointsStatus ¶
EndpointsStatus returns status for all endpoints
func (*Client) GetCurrentRevision ¶
GetCurrentRevision returns the current revision of the etcd cluster
func (*Client) GetDatabaseSize ¶
GetDatabaseSize returns the size of the etcd database in bytes
func (*Client) GetMetrics ¶
GetMetrics returns basic metrics from etcd
func (*Client) ListAlarms ¶
ListAlarms lists all alarms in the etcd cluster
func (*Client) MemberList ¶
MemberList returns list of members in the cluster
func (*Client) NeedsBootstrap ¶
* /** NeedsBootstrap checks if the etcd cluster needs to be bootstrapped by performing several validation checks:
1. Verifies if the etcd process is running using the provided process ID 2. Checks if the etcd socket is available and accessible with retries 3. Validates that the socket is not blocked with retries 4. Confirms there is an elected leader in the cluster 5. If a root user is configured, verifies if it exists
Parameters:
- ctx: Context for timeout/cancellation
- pid: Process ID of the etcd server
Returns:
- bool: true if bootstrap is needed, false otherwise
- error: Error details if any check fails
The function will retry socket checks up to 5 times with 10 second delays between attempts. It uses context for proper timeout handling and cancellation support.
Common error cases: - Process not running - Socket unavailable after retries - Socket blocked after retries - No leader elected - Root user does not exist (when configured) - Authentication/connection errors
func (*Client) RestoreSnapshot ¶
func (c *Client) RestoreSnapshot(ctx context.Context, opts RestoreOptions) error
RestoreSnapshot restores from a snapshot file
type EtcdHealth ¶
type EtcdHealth struct {
IsSocketAvailable bool
IsSocketBlocked bool
ProcessRunning bool
DataValid bool
HasLeader bool
ErrorMessage string
}
EtcdHealth contains information about the health status of etcd